Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

10.6: Fix creation of widgets due to custom style sheets Web Browsers
Snow Leopard only hintIf you find you cannot create web clip widgets (File » Open in Dashboard) from Safari, try looking into Preferences » Advanced tab. If there is a custom style sheet under 'Style sheet' option, set it to None selected, create the web clip and it should work. Then it's OK to re-enable the custom style sheet.

I thought it might be worthwhile to summarize this possibility in a hint because I spent an hour wondering what was wrong with an almost-freshly-installed Snow Leopard on a Mac Book Pro -- all I could get was a white rectangle and a com.apple.widget.web-clip: illegal type passed to setPreferenceForKey: undefined error message in the Console.

While you'd definitely remember setting your own CSS, some third party plug-ins (notably, ad/scam blockers and content filters) may set a custom CSS for their own needs without your knowledge.

[crarko adds: I tried this with a custom style sheet I had and had no problem saving clippings to the Dashboard. There must be some specific setting in some style sheets which can cause the issue, but I don't know what that setting is. This may be specific to 10.6, so I've left it marked as the author submitted it -- but if you're having the same issue in 10.5, please let me know.]
  Post a comment  •  Comments (3)  
  • Currently 2.88 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (8 votes cast)
 
[4,269 views] Email Article To a Friend View Printable Version
Use a Chromium build with left-positioned tab close buttons Web Browsers
If you're really annoyed by Chromium's placement of the tab close widget on the right side of the tab (as opposed to the left, as in Safari), here's a workaround, gleaned from the linked discussion...

In that discussion, user thakis posted a number of alternative placement thoughts, along with a patch that puts both the close icon and fav icon to the left of the tab name. User drew.ramos then applied that patch to a couple of Chromium builds:
  • Build 43024, which looks like the current Chrome for Mac beta, omnibox-wise.
  • Build 46672, which is fairly close to the latest development build.
[crarko adds: As Chrome/Chromium progresses, these builds (obviously) will become less current. You could follow the linked conversation, though, to spot newer builds with the close tab button on the left of the tab.]
  Post a comment  •  Comments (4)  
  • Currently 2.93 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (15 votes cast)
 
[5,916 views] Email Article To a Friend View Printable Version
Open external links in currently running browser Web Browsers
If you are using multiple browsers, and are annoyed by Safari (or your designated preferred browser) popping up while using a different browser, this hint can remove that annoyance.

I'm a web developer, and while my main browser is WebKit, I also have Opera, Chrome and Firefox installed. If I'm using Opera and click a link in Mail, that link will open in Safari. So I wind up with two running browsers, or having to copy the URL over to Firefox manually. Not cool.

I have figured out a way to make an AppleScript 'proxy' app that delegates URLs to the browser that is currently running, no matter which is set as the default. Paste the following code into AppleScript Editor:
on open location the_url
  tell application "System Events"
    set browser_apps to the name of every process whose visible is true
    if "Opera" is in browser_apps then
      tell application "Opera"
        open location the_url
        activate
      end tell
    else if "firefox-bin" is in browser_apps then
      tell application "Firefox"
        open location the_url
        activate
      end tell
    else if "Google Chrome" is in browser_apps then
      tell application "Google Chrome"
        open location the_url
        activate
      end tell
    else
      tell application "WebKit"
        open location the_url
        activate
      end tell
    end if
  end tell
end open location
Modify the above as needed to reflect your own suite of browsers, then save this script as an application bundle somewhere. Next, you need modify a bit of the application bundle you just created.
read more (169 words)   Post a comment  •  Comments (15)  
  • Currently 3.81 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (21 votes cast)
 
[9,093 views] Email Article To a Friend View Printable Version
Arrange Safari and Opera windows via AppleScript Web Browsers
I wrote two AppleScripts that arrange windows in Safari and Opera. The scripts don't just tile horizontally or vertically, but order browser windows in the most optimal way. The scripts automatically detect the screen resolution, and the number of open browser windows; they can arrange up to 12 separate windows. The Opera script, due to an Opera bug (perhaps?) has to be run twice.

Here's the Safari AppleScript:
################# Arrange_logically_Safari_windows:

-- Script by Julian (looiopnr/zec0ect/ristQws/pasurimi) 22.04.10
-- Purpose: Arrange logically Safari windows
-- Will detect automatically the screen resolution and the number of open Safari windows
-- Will arrange up to 12 windows.


tell application "Safari"
  set open_windows to (every window where visible is true)
  set n to count of open_windows
  
  tell application "Finder"
    set scr_size to bounds of window of desktop
    set scr_width to item 3 of scr_size
    set scr_height to item 4 of scr_size
  end tell
  
  set Compensation_A to 11
  set Compensation_B to 14
  set Compensation_C to 7
  
  if n = 1 then
    tell application "Safari"
      activate
      tell window 1
        set bounds to {0, 0, scr_width, scr_height}
      end tell
    end tell
  end if
  
  if n = 2 then
    tell application "Safari"
      activate
      tell window 1
        set bounds to {0, 0, scr_width / 2, scr_height}
      end tell
      activate
      tell window 2
        set bounds to {scr_width / 2, 0, scr_width, scr_height}
      end tell
    end tell
  end if
  
  if n = 3 then
    tell application "Safari"
      activate
      tell window 1
        set bounds to {0, 0, scr_width / 2, scr_height}
      end tell
      activate
      tell window 2
        set bounds to {((scr_width / 4) * 2), 0, scr_width, (scr_height / 2) - Compensation_A}
      end tell
      activate
      tell window 3
        set bounds to {((scr_width / 4) * 2), (scr_height / 2) + Compensation_A, scr_width, scr_height}
      end tell
    end tell
  end if
  
  if n = 4 then
    tell application "Safari"
      activate
      tell window 1
        set bounds to {0, 0, ((scr_width / 4) * 2), (scr_height / 2) - Compensation_A}
      end tell
      activate
      tell window 2
        set bounds to {((scr_width / 4) * 2), 0, scr_width, (scr_height / 2) - Compensation_A}
      end tell
      activate
      tell window 3
        set bounds to {0, (scr_height / 2) + Compensation_A, ((scr_width / 4) * 2), scr_height}
      end tell
      activate
      tell window 4
        set bounds to {((scr_width / 4) * 2), (scr_height / 2) + Compensation_A, scr_width, scr_height}
      end tell
    end tell
  end if
  
  if n = 5 then
    tell application "Safari"
      activate
      tell window 1
        set bounds to {0, 0, ((scr_width / 4) * 2), (scr_height / 2) - Compensation_A}
      end tell
      activate
      tell window 2
        set bounds to {0, (scr_height / 2) + Compensation_A, ((scr_width / 4) * 2), scr_height}
      end tell
      activate
      tell window 3
        set bounds to {((scr_width / 4) * 2), 0, scr_width, (scr_height / 3) - Compensation_C}
      end tell
      activate
      tell window 4
        set bounds to {((scr_width / 4) * 2), (scr_height / 3) + Compensation_B, scr_width, ((scr_height / 3) * 2) + Compensation_C}
      end tell
      activate
      tell window 5
        set bounds to {((scr_width / 4) * 2), ((scr_height / 3) * 2) + Compensation_C, scr_width, scr_height}
      end tell
    end tell
  end if
  
  if n = 6 then
    tell application "Safari"
      activate
      tell window 1
        set bounds to {0, 0, ((scr_width / 4) * 2), (scr_height / 3) - Compensation_C}
      end tell
      activate
      tell window 3
        set bounds to {0, (scr_height / 3) + Compensation_B, ((scr_width / 4) * 2), ((scr_height / 3) * 2) + Compensation_C}
      end tell
      activate
      tell window 5
        set bounds to {0, ((scr_height / 3) * 2) + Compensation_C, ((scr_width / 4) * 2), scr_height}
      end tell
      activate
      tell window 2
        set bounds to {((scr_width / 4) * 2), 0, scr_width, (scr_height / 3) - Compensation_C}
      end tell
      activate
      tell window 4
        set bounds to {((scr_width / 4) * 2), (scr_height / 3) + Compensation_B, scr_width, ((scr_height / 3) * 2) + Compensation_C}
      end tell
      activate
      tell window 6
        set bounds to {((scr_width / 4) * 2), ((scr_height / 3) * 2) + Compensation_C, scr_width, scr_height}
      end tell
    end tell
  end if
  
  if n = 7 then
    tell application "Safari"
      activate
      activate
      tell window 1
        set bounds to {0, 0, (scr_width / 3), (scr_height / 2) - Compensation_A}
      end tell
      activate
      tell window 2
        set bounds to {(scr_width / 3), 0, ((scr_width / 3) * 2), (scr_height / 2) - Compensation_A}
      end tell
      activate
      tell window 3
        set bounds to {0, (scr_height / 2) + Compensation_A, (scr_width / 3), scr_height}
      end tell
      activate
      tell window 4
        set bounds to {(scr_width / 3), (scr_height / 2) + Compensation_A, ((scr_width / 3) * 2), scr_height}
      end tell
      activate
      tell window 5
        set bounds to {((scr_width / 3) * 2), 0, scr_width, (scr_height / 3) - Compensation_C}
      end tell
      activate
      tell window 6
        set bounds to {((scr_width / 3) * 2), (scr_height / 3) + Compensation_B, scr_width, ((scr_height / 3) * 2) + Compensation_C}
      end tell
      activate
      tell window 7
        set bounds to {((scr_width / 3) * 2), ((scr_height / 3) * 2) + Compensation_C, scr_width, scr_height}
      end tell
    end tell
  end if
  
  if n = 8 then
    tell application "Safari"
      activate
      activate
      tell window 1
        set bounds to {0, 0, (scr_width / 3), (scr_height / 2) - Compensation_A}
      end tell
      activate
      tell window 2
        set bounds to {0, (scr_height / 2) + Compensation_A, (scr_width / 3), scr_height}
      end tell
      activate
      tell window 3
        set bounds to {(scr_width / 3), 0, ((scr_width / 3) * 2), (scr_height / 3) - Compensation_C}
      end tell
      activate
      tell window 4
        set bounds to {(scr_width / 3), (scr_height / 3) + Compensation_B, ((scr_width / 3) * 2), ((scr_height / 3) * 2) + Compensation_C}
      end tell
      activate
      tell window 5
        set bounds to {(scr_width / 3), ((scr_height / 3) * 2) + Compensation_C, ((scr_width / 3) * 2), scr_height}
      end tell
      activate
      tell window 6
        set bounds to {((scr_width / 3) * 2), 0, scr_width, (scr_height / 3) - Compensation_C}
      end tell
      activate
      tell window 7
        set bounds to {((scr_width / 3) * 2), (scr_height / 3) + Compensation_B, scr_width, ((scr_height / 3) * 2) + Compensation_C}
      end tell
      activate
      tell window 8
        set bounds to {((scr_width / 3) * 2), ((scr_height / 3) * 2) + Compensation_C, scr_width, scr_height}
      end tell
    end tell
  end if
  
  if n = 9 then
    tell application "Safari"
      activate
      activate
      tell window 1
        set bounds to {0, 0, (scr_width / 3), (scr_height / 3) - Compensation_C}
      end tell
      activate
      tell window 2
        set bounds to {0, (scr_height / 3) + Compensation_B, (scr_width / 3), ((scr_height / 3) * 2) + Compensation_C}
      end tell
      activate
      tell window 3
        set bounds to {0, ((scr_height / 3) * 2) + Compensation_C, (scr_width / 3), scr_height}
      end tell
      activate
      tell window 4
        set bounds to {(scr_width / 3), 0, ((scr_width / 3) * 2), (scr_height / 3) - Compensation_C}
      end tell
      activate
      tell window 5
        set bounds to {(scr_width / 3), (scr_height / 3) + Compensation_B, ((scr_width / 3) * 2), ((scr_height / 3) * 2) + Compensation_C}
      end tell
      activate
      tell window 6
        set bounds to {(scr_width / 3), ((scr_height / 3) * 2) + Compensation_C, ((scr_width / 3) * 2), scr_height}
      end tell
      activate
      tell window 7
        set bounds to {((scr_width / 3) * 2), 0, scr_width, (scr_height / 3) - Compensation_C}
      end tell
      activate
      tell window 8
        set bounds to {((scr_width / 3) * 2), (scr_height / 3) + Compensation_B, scr_width, ((scr_height / 3) * 2) + Compensation_C}
      end tell
      activate
      tell window 9
        set bounds to {((scr_width / 3) * 2), ((scr_height / 3) * 2) + Compensation_C, scr_width, scr_height}
      end tell
    end tell
  end if
  
  if n = 10 then
    tell application "Safari"
      activate
      activate
      tell window 1
        set bounds to {0, 0, (scr_width / 4), (scr_height / 2) - Compensation_A}
      end tell
      activate
      tell window 2
        set bounds to {(scr_width / 4), 0, ((scr_width / 4) * 2), (scr_height / 2) - Compensation_A}
      end tell
      activate
      tell window 3
        set bounds to {0, (scr_height / 2) + Compensation_A, (scr_width / 4), scr_height}
      end tell
      activate
      tell window 4
        set bounds to {(scr_width / 4), (scr_height / 2) + Compensation_A, ((scr_width / 4) * 2), scr_height}
      end tell
      activate
      tell window 5
        set bounds to {((scr_width / 4) * 2), 0, ((scr_width / 4) * 3), (scr_height / 3) - Compensation_C}
      end tell
      activate
      tell window 6
        set bounds to {((scr_width / 4) * 2), (scr_height / 3) + Compensation_B, ((scr_width / 4) * 3), ((scr_height / 3) * 2) + Compensation_C}
      end tell
      activate
      tell window 7
        set bounds to {((scr_width / 4) * 2), ((scr_height / 3) * 2) + Compensation_C, ((scr_width / 4) * 3), scr_height}
      end tell
      activate
      tell window 8
        set bounds to {((scr_width / 4) * 3), 0, scr_width, (scr_height / 3) - Compensation_C}
      end tell
      activate
      tell window 9
        set bounds to {((scr_width / 4) * 3), (scr_height / 3) + Compensation_B, scr_width, ((scr_height / 3) * 2) + Compensation_C}
      end tell
      activate
      tell window 10
        set bounds to {((scr_width / 4) * 3), ((scr_height / 3) * 2) + Compensation_C, scr_width, scr_height}
      end tell
    end tell
  end if
  
  if n = 11 then
    tell application "Safari"
      activate
      activate
      tell window 1
        set bounds to {0, 0, ((scr_width / 4) * 2), (scr_height / 3) - Compensation_C}
      end tell
      activate
      tell window 2
        set bounds to {0, (scr_height / 3) + Compensation_B, (scr_width / 4), ((scr_height / 3) * 2) + Compensation_C}
      end tell
      activate
      tell window 3
        set bounds to {0, ((scr_height / 3) * 2) + Compensation_C, (scr_width / 4), scr_height}
      end tell
      activate
      tell window 4
        set bounds to {(scr_width / 4), (scr_height / 3) + Compensation_B, ((scr_width / 4) * 2), ((scr_height / 3) * 2) + Compensation_C}
      end tell
      activate
      tell window 5
        set bounds to {(scr_width / 4), ((scr_height / 3) * 2) + Compensation_C, ((scr_width / 4) * 2), scr_height}
      end tell
      activate
      tell window 6
        set bounds to {((scr_width / 4) * 2), 0, ((scr_width / 4) * 3), (scr_height / 3) - Compensation_C}
      end tell
      activate
      tell window 7
        set bounds to {((scr_width / 4) * 2), (scr_height / 3) + Compensation_B, ((scr_width / 4) * 3), ((scr_height / 3) * 2) + Compensation_C}
      end tell
      activate
      tell window 8
        set bounds to {((scr_width / 4) * 2), ((scr_height / 3) * 2) + Compensation_C, ((scr_width / 4) * 3), scr_height}
      end tell
      activate
      tell window 9
        set bounds to {((scr_width / 4) * 3), 0, scr_width, (scr_height / 3) - Compensation_C}
      end tell
      activate
      tell window 10
        set bounds to {((scr_width / 4) * 3), (scr_height / 3) + Compensation_B, scr_width, ((scr_height / 3) * 2) + Compensation_C}
      end tell
      activate
      tell window 11
        set bounds to {((scr_width / 4) * 3), ((scr_height / 3) * 2) + Compensation_C, scr_width, scr_height}
      end tell
    end tell
  end if
  
  if n = 12 then
    tell application "Safari"
      activate
      activate
      tell window 1
        set bounds to {0, 0, (scr_width / 4), (scr_height / 3) - Compensation_C}
      end tell
      activate
      tell window 2
        set bounds to {0, (scr_height / 3) + Compensation_B, (scr_width / 4), ((scr_height / 3) * 2) + Compensation_C}
      end tell
      activate
      tell window 3
        set bounds to {0, ((scr_height / 3) * 2) + Compensation_C, (scr_width / 4), scr_height}
      end tell
      activate
      tell window 4
        set bounds to {(scr_width / 4), 0, ((scr_width / 4) * 2), (scr_height / 3) - Compensation_C}
      end tell
      activate
      tell window 5
        set bounds to {(scr_width / 4), (scr_height / 3) + Compensation_B, ((scr_width / 4) * 2), ((scr_height / 3) * 2) + Compensation_C}
      end tell
      activate
      tell window 6
        set bounds to {(scr_width / 4), ((scr_height / 3) * 2) + Compensation_C, ((scr_width / 4) * 2), scr_height}
      end tell
      activate
      tell window 7
        set bounds to {((scr_width / 4) * 2), 0, ((scr_width / 4) * 3), (scr_height / 3) - Compensation_C}
      end tell
      activate
      tell window 8
        set bounds to {((scr_width / 4) * 2), (scr_height / 3) + Compensation_B, ((scr_width / 4) * 3), ((scr_height / 3) * 2) + Compensation_C}
      end tell
      activate
      tell window 9
        set bounds to {((scr_width / 4) * 2), ((scr_height / 3) * 2) + Compensation_C, ((scr_width / 4) * 3), scr_height}
      end tell
      activate
      tell window 10
        set bounds to {((scr_width / 4) * 3), 0, scr_width, (scr_height / 3) - Compensation_C}
      end tell
      activate
      tell window 11
        set bounds to {((scr_width / 4) * 3), (scr_height / 3) + Compensation_B, scr_width, ((scr_height / 3) * 2) + Compensation_C}
      end tell
      activate
      tell window 12
        set bounds to {((scr_width / 4) * 3), ((scr_height / 3) * 2) + Compensation_C, scr_width, scr_height}
      end tell
    end tell
  end if
  
end tell
And for Opera:
### Arrange_logically_Opera_windows:

-- Script by Julian (looiopnr/zec0ect/ristQws/pasurimi) 22.04.10
-- Purpose: Arrange logically Opera windows
-- Will detect automatically the screen resolution and the number of open Opera windows
-- Will arrange logically up to 12 windows.
-- Due to a Opera bug(?) you have to run it twice.

tell application "Opera"
  set open_windows to (every window)
  set n to count of open_windows
  
  tell application "Finder"
    set scr_size to bounds of window of desktop
    set scr_width to item 3 of scr_size
    set scr_height to item 4 of scr_size
  end tell
  
  set Compensation_A to 33
  set Compensation_B to 32
  set Compensation_C to 34
  set Compensation_D to 5
  set Compensation_E to 27
  
  if n = 1 then
    tell application "Opera"
      activate
      tell window 1
        set bounds to {0, 0, scr_width, scr_height}
      end tell
    end tell
  end if
  
  if n = 2 then
    tell application "Opera"
      activate
      tell window 1
        set bounds to {0, 0, scr_width / 2, scr_height}
      end tell
      activate
      tell window 2
        set bounds to {scr_width / 2, 0, scr_width, scr_height}
      end tell
    end tell
  end if
  
  if n = 3 then
    tell application "Opera"
      activate
      tell window 1
        set bounds to {0, 0, scr_width / 2, scr_height}
      end tell
      activate
      tell window 2
        set bounds to {((scr_width / 4) * 2), 0, scr_width, (scr_height / 2) - Compensation_A}
      end tell
      activate
      tell window 3
        set bounds to {((scr_width / 4) * 2), (scr_height / 2) + Compensation_A, scr_width, scr_height}
      end tell
    end tell
  end if
  
  if n = 4 then
    tell application "Opera"
      activate
      tell window 1
        set bounds to {0, 0, ((scr_width / 4) * 2), (scr_height / 2) - Compensation_A}
      end tell
      activate
      tell window 2
        set bounds to {((scr_width / 4) * 2), 0, scr_width, (scr_height / 2) - Compensation_A}
      end tell
      activate
      tell window 3
        set bounds to {0, (scr_height / 2) + Compensation_A, ((scr_width / 4) * 2), scr_height}
      end tell
      activate
      tell window 4
        set bounds to {((scr_width / 4) * 2), (scr_height / 2) + Compensation_A, scr_width, scr_height}
      end tell
    end tell
  end if
  
  if n = 5 then
    tell application "Opera"
      activate
      tell window 1
        set bounds to {0, 0, ((scr_width / 4) * 2), (scr_height / 2) - Compensation_A}
      end tell
      activate
      tell window 2
        set bounds to {0, (scr_height / 2) + Compensation_A, ((scr_width / 4) * 2), scr_height}
      end tell
      activate
      tell window 3
        set bounds to {((scr_width / 4) * 2), 0, scr_width, (scr_height / 3) - Compensation_B}
      end tell
      activate
      tell window 4
        set bounds to {((scr_width / 4) * 2), (scr_height / 3) + Compensation_C, scr_width, ((scr_height / 3) * 2) + Compensation_D}
      end tell
      activate
      tell window 5
        set bounds to {((scr_width / 4) * 2), ((scr_height / 3) * 2) + Compensation_E, scr_width, scr_height}
      end tell
    end tell
  end if
  
  if n = 6 then
    tell application "Opera"
      activate
      tell window 1
        set bounds to {0, 0, ((scr_width / 4) * 2), (scr_height / 3) - Compensation_B}
      end tell
      activate
      tell window 3
        set bounds to {0, (scr_height / 3) + Compensation_C, ((scr_width / 4) * 2), ((scr_height / 3) * 2) + Compensation_D}
      end tell
      activate
      tell window 5
        set bounds to {0, ((scr_height / 3) * 2) + Compensation_E, ((scr_width / 4) * 2), scr_height}
      end tell
      activate
      tell window 2
        set bounds to {((scr_width / 4) * 2), 0, scr_width, (scr_height / 3) - Compensation_B}
      end tell
      activate
      tell window 4
        set bounds to {((scr_width / 4) * 2), (scr_height / 3) + Compensation_C, scr_width, ((scr_height / 3) * 2) + Compensation_D}
      end tell
      activate
      tell window 6
        set bounds to {((scr_width / 4) * 2), ((scr_height / 3) * 2) + Compensation_E, scr_width, scr_height}
      end tell
    end tell
  end if
  
  if n = 7 then
    tell application "Opera"
      activate
      activate
      tell window 1
        set bounds to {0, 0, (scr_width / 3), (scr_height / 2) - Compensation_A}
      end tell
      activate
      tell window 2
        set bounds to {(scr_width / 3), 0, ((scr_width / 3) * 2), (scr_height / 2) - Compensation_A}
      end tell
      activate
      tell window 3
        set bounds to {0, (scr_height / 2) + Compensation_A, (scr_width / 3), scr_height}
      end tell
      activate
      tell window 4
        set bounds to {(scr_width / 3), (scr_height / 2) + Compensation_A, ((scr_width / 3) * 2), scr_height}
      end tell
      activate
      tell window 5
        set bounds to {((scr_width / 3) * 2), 0, scr_width, (scr_height / 3) - Compensation_B}
      end tell
      activate
      tell window 6
        set bounds to {((scr_width / 3) * 2), (scr_height / 3) + Compensation_C, scr_width, ((scr_height / 3) * 2) + Compensation_D}
      end tell
      activate
      tell window 7
        set bounds to {((scr_width / 3) * 2), ((scr_height / 3) * 2) + Compensation_E, scr_width, scr_height}
      end tell
    end tell
  end if
  
  if n = 8 then
    tell application "Opera"
      activate
      activate
      tell window 1
        set bounds to {0, 0, (scr_width / 3), (scr_height / 2) - Compensation_A}
      end tell
      activate
      tell window 2
        set bounds to {0, (scr_height / 2) + Compensation_A, (scr_width / 3), scr_height}
      end tell
      activate
      tell window 3
        set bounds to {(scr_width / 3), 0, ((scr_width / 3) * 2), (scr_height / 3) - Compensation_B}
      end tell
      activate
      tell window 4
        set bounds to {(scr_width / 3), (scr_height / 3) + Compensation_C, ((scr_width / 3) * 2), ((scr_height / 3) * 2) + Compensation_D}
      end tell
      activate
      tell window 5
        set bounds to {(scr_width / 3), ((scr_height / 3) * 2) + Compensation_E, ((scr_width / 3) * 2), scr_height}
      end tell
      activate
      tell window 6
        set bounds to {((scr_width / 3) * 2), 0, scr_width, (scr_height / 3) - Compensation_B}
      end tell
      activate
      tell window 7
        set bounds to {((scr_width / 3) * 2), (scr_height / 3) + Compensation_C, scr_width, ((scr_height / 3) * 2) + Compensation_D}
      end tell
      activate
      tell window 8
        set bounds to {((scr_width / 3) * 2), ((scr_height / 3) * 2) + Compensation_E, scr_width, scr_height}
      end tell
    end tell
  end if
  
  if n = 9 then
    tell application "Opera"
      activate
      activate
      tell window 1
        set bounds to {0, 0, (scr_width / 3), (scr_height / 3) - Compensation_B}
      end tell
      activate
      tell window 2
        set bounds to {0, (scr_height / 3) + Compensation_C, (scr_width / 3), ((scr_height / 3) * 2) + Compensation_D}
      end tell
      activate
      tell window 3
        set bounds to {0, ((scr_height / 3) * 2) + Compensation_E, (scr_width / 3), scr_height}
      end tell
      activate
      tell window 4
        set bounds to {(scr_width / 3), 0, ((scr_width / 3) * 2), (scr_height / 3) - Compensation_B}
      end tell
      activate
      tell window 5
        set bounds to {(scr_width / 3), (scr_height / 3) + Compensation_C, ((scr_width / 3) * 2), ((scr_height / 3) * 2) + Compensation_D}
      end tell
      activate
      tell window 6
        set bounds to {(scr_width / 3), ((scr_height / 3) * 2) + Compensation_E, ((scr_width / 3) * 2), scr_height}
      end tell
      activate
      tell window 7
        set bounds to {((scr_width / 3) * 2), 0, scr_width, (scr_height / 3) - Compensation_B}
      end tell
      activate
      tell window 8
        set bounds to {((scr_width / 3) * 2), (scr_height / 3) + Compensation_C, scr_width, ((scr_height / 3) * 2) + Compensation_D}
      end tell
      activate
      tell window 9
        set bounds to {((scr_width / 3) * 2), ((scr_height / 3) * 2) + Compensation_E, scr_width, scr_height}
      end tell
    end tell
  end if
  
  if n = 10 then
    tell application "Opera"
      activate
      activate
      tell window 1
        set bounds to {0, 0, (scr_width / 4), (scr_height / 2) - Compensation_A}
      end tell
      activate
      tell window 2
        set bounds to {(scr_width / 4), 0, ((scr_width / 4) * 2), (scr_height / 2) - Compensation_A}
      end tell
      activate
      tell window 3
        set bounds to {0, (scr_height / 2) + Compensation_A, (scr_width / 4), scr_height}
      end tell
      activate
      tell window 4
        set bounds to {(scr_width / 4), (scr_height / 2) + Compensation_A, ((scr_width / 4) * 2), scr_height}
      end tell
      activate
      tell window 5
        set bounds to {((scr_width / 4) * 2), 0, ((scr_width / 4) * 3), (scr_height / 3) - Compensation_B}
      end tell
      activate
      tell window 6
        set bounds to {((scr_width / 4) * 2), (scr_height / 3) + Compensation_C, ((scr_width / 4) * 3), ((scr_height / 3) * 2) + Compensation_D}
      end tell
      activate
      tell window 7
        set bounds to {((scr_width / 4) * 2), ((scr_height / 3) * 2) + Compensation_E, ((scr_width / 4) * 3), scr_height}
      end tell
      activate
      tell window 8
        set bounds to {((scr_width / 4) * 3), 0, scr_width, (scr_height / 3) - Compensation_B}
      end tell
      activate
      tell window 9
        set bounds to {((scr_width / 4) * 3), (scr_height / 3) + Compensation_C, scr_width, ((scr_height / 3) * 2) + Compensation_D}
      end tell
      activate
      tell window 10
        set bounds to {((scr_width / 4) * 3), ((scr_height / 3) * 2) + Compensation_E, scr_width, scr_height}
      end tell
    end tell
  end if
  
  if n = 11 then
    tell application "Opera"
      activate
      activate
      tell window 1
        set bounds to {0, 0, ((scr_width / 4) * 2), (scr_height / 3) - Compensation_B}
      end tell
      activate
      tell window 2
        set bounds to {0, (scr_height / 3) + Compensation_C, (scr_width / 4), ((scr_height / 3) * 2) + Compensation_D}
      end tell
      activate
      tell window 3
        set bounds to {0, ((scr_height / 3) * 2) + Compensation_E, (scr_width / 4), scr_height}
      end tell
      activate
      tell window 4
        set bounds to {(scr_width / 4), (scr_height / 3) + Compensation_C, ((scr_width / 4) * 2), ((scr_height / 3) * 2) + Compensation_D}
      end tell
      activate
      tell window 5
        set bounds to {(scr_width / 4), ((scr_height / 3) * 2) + Compensation_C, ((scr_width / 4) * 2), scr_height + Compensation_D}
      end tell
      activate
      tell window 6
        set bounds to {((scr_width / 4) * 2), 0, ((scr_width / 4) * 3), (scr_height / 3) - Compensation_E}
      end tell
      activate
      tell window 7
        set bounds to {((scr_width / 4) * 2), (scr_height / 3) + Compensation_C, ((scr_width / 4) * 3), ((scr_height / 3) * 2) + Compensation_D}
      end tell
      activate
      tell window 8
        set bounds to {((scr_width / 4) * 2), ((scr_height / 3) * 2) + Compensation_E, ((scr_width / 4) * 3), scr_height}
      end tell
      activate
      tell window 9
        set bounds to {((scr_width / 4) * 3), 0, scr_width, (scr_height / 3) - Compensation_B}
      end tell
      activate
      tell window 10
        set bounds to {((scr_width / 4) * 3), (scr_height / 3) + Compensation_C, scr_width, ((scr_height / 3) * 2) + Compensation_D}
      end tell
      activate
      tell window 11
        set bounds to {((scr_width / 4) * 3), ((scr_height / 3) * 2) + Compensation_E, scr_width, scr_height}
      end tell
    end tell
  end if
  
  if n = 12 then
    tell application "Opera"
      activate
      activate
      tell window 1
        set bounds to {0, 0, (scr_width / 4), (scr_height / 3) - Compensation_B}
      end tell
      activate
      tell window 2
        set bounds to {0, (scr_height / 3) + Compensation_C, (scr_width / 4), ((scr_height / 3) * 2) + Compensation_D}
      end tell
      activate
      tell window 3
        set bounds to {0, ((scr_height / 3) * 2) + Compensation_E, (scr_width / 4), scr_height}
      end tell
      activate
      tell window 4
        set bounds to {(scr_width / 4), 0, ((scr_width / 4) * 2), (scr_height / 3) - Compensation_B}
      end tell
      activate
      tell window 5
        set bounds to {(scr_width / 4), (scr_height / 3) + Compensation_C, ((scr_width / 4) * 2), ((scr_height / 3) * 2) + Compensation_D}
      end tell
      activate
      tell window 6
        set bounds to {(scr_width / 4), ((scr_height / 3) * 2) + Compensation_E, ((scr_width / 4) * 2), scr_height}
      end tell
      activate
      tell window 7
        set bounds to {((scr_width / 4) * 2), 0, ((scr_width / 4) * 3), (scr_height / 3) - Compensation_B}
      end tell
      activate
      tell window 8
        set bounds to {((scr_width / 4) * 2), (scr_height / 3) + Compensation_C, ((scr_width / 4) * 3), ((scr_height / 3) * 2) + Compensation_D}
      end tell
      activate
      tell window 9
        set bounds to {((scr_width / 4) * 2), ((scr_height / 3) * 2) + Compensation_E, ((scr_width / 4) * 3), scr_height}
      end tell
      activate
      tell window 10
        set bounds to {((scr_width / 4) * 3), 0, scr_width, (scr_height / 3) - Compensation_B}
      end tell
      activate
      tell window 11
        set bounds to {((scr_width / 4) * 3), (scr_height / 3) + Compensation_C, scr_width, ((scr_height / 3) * 2) + Compensation_D}
      end tell
      activate
      tell window 12
        set bounds to {((scr_width / 4) * 3), ((scr_height / 3) * 2) + Compensation_E, scr_width, scr_height}
      end tell
    end tell
  end if
  
end tell
Perhaps useful for someone...

[robg adds: On my multi-monitor Mac, these scripts didn't work exactly as I expected -- they arranged the open windows across two of my three displays.]
  Post a comment  •  Comments (8)  
  • Currently 2.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (4 votes cast)
 
[6,850 views] Email Article To a Friend View Printable Version
Prevent Google Chrome's updater from running Web Browsers
An earlier hint I found said to use Lingon to edit the launchd file and remove Google's updater task from the Chrome browser. It works great until the next time you run Chrome.

To foil Google/Chrome once and for all, use Lingon to disable the launchd task, and then go to your user's Library/Google folder and delete the contents of GoogleSoftwareUpdate. Not done yet -- now you must use Terminal to prevent the next launch of Chrome from re-establishing the task.

In a Terminal window, cd ~/Library/Google and type chmod 111 GoogleSoftwareUpdate. (I couldn't figure out how to use Finder to remove read/write privilege for myself on my own folder). Now the whole folder is write locked, and Chrome can't reload the software update contents, and it won't recreate the launchd task either.

Please note you now have to update Chrome yourself.

[robg adds: I'm not sure which hint the author is referring to; there aren't any here that mention Chrome and Lingon. The closest I could find was this one, which was about the updater relative to Google Earth. The section in that hint about removing the launchd files would be applicable to this hint as well.]
  Post a comment  •  Comments (9)  
  • Currently 2.39 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (18 votes cast)
 
[16,583 views] Email Article To a Friend View Printable Version
Add iPad to the list of User Agents in Safari's Develop menu Web Browsers
If you're curious about how iPad-specific versions websites of your favorite websites are rendered, but don't actually own an iPad yet, here's a way to view those pages using your Mac's version of Safari.

Caution: This tip requires that you modify a file within Safari.app's Resources folder. I cannot guarantee this will not cause you grief, or break the application's code signing.

This tip also requires you to install the Developer's Tools (for the use of Property List Editor.app), or at least be familiar with editing .plist files.
read more (337 words)   Post a comment  •  Comments (15)  
  • Currently 2.50 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (10 votes cast)
 
[20,941 views] Email Article To a Friend View Printable Version
Use Fluid to Create an NPR player application Web Browsers
In time for the iPad introduction, NPR has introduced a tablet-optimized version of their website, which uses HTML5 instead of Flash. Combined with Fluid, it makes an awesome NPR app on the Mac. The tip itself is rather easy and somewhat obvious, but it is nice to see that the app works even though NPR only advertises it for Chrome, and it makes a really good standalone application.

The process is easy. If you don't have it, download Fluid. Open Fluid, and create a new app for URL http://www.npr.org/tablet/, and name it NPR or something else. If you want to, you may want to Google for a high-resolution copy of the NPR logo, so that you can use that as the icon for the app. For that, in Fluid choose Other in the Icon pop-up menu.

After the app is created, launch it, open the application's preferences, select the Behavior section, and make sure the box next to 'Closing the last browser window' ('only hides the window') is checked. That's it.
  Post a comment  •  Comments (7)  
  • Currently 2.78 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (9 votes cast)
 
[6,353 views] Email Article To a Friend View Printable Version
Always launch Google Chrome beta with integrated Flash Web Browsers
This hint is to allow people to use a command-line argument automatically when they launch an app (a bit like Windows' shortcuts). I use Google Chrome's new integrated Flash mode as an example, since it's been asked often enough on the Chrome blog.

I already wrote this in a comment on the Chrome blog,but I thought it could be a useful hint, so here is a more readable version. Enter these commands in Terminal (the $ is the prompt; don't enter that):
$ cd "/Applications/Google Chrome.app/Contents/MacOS/"
$ sudo mv "Google Chrome" Google.real
$ sudo printf '#!/bin/bash\ncd "/Applications/Google Chrome.app/Contents/MacOS"\n"/Applications/Google Chrome.app/Contents/MacOS/Google.real" --enable-internal-flash "$@"\n' > Google\ Chrome
$ sudo chmod u+x "Google Chrome"
You need to have write access to your /Applications folder for this to work. The only minor inconvenience is that the real executable is now Google.real, so you have to reauthorize it with LSD or your firewall. And, of course, you can do this with others' apps.

[robg adds: I tested this, and it seems to be working as expected.]
  Post a comment  •  Comments (12)  
  • Currently 1.85 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (13 votes cast)
 
[10,577 views] Email Article To a Friend View Printable Version
Run Firefox in a protected sandbox Web Browsers
OS X has a built-in sandbox feature for applications, which can restrict their access to certain parts of the system. There isn't a lot of documentation available on the sandboxing system, but I've successfully been able to sandbox Firefox. It has some limitations, but my plug-ins and add-ons work though yours may not.

If you have issues, you'll have to search for the directories where your plug-ins are housed, and give read or read/write access permissions in the firefox-sandbox file. There is only write permission to the ~/Downloads directory, so if you want to save files in a different location, you will have to change the firefox-sandbox file or move them after the download has finished. First, create the following file and save it somewhere as firefox-sandbox:
;; http://codereview.chromium.org/379019/diff/1/2
(version 1) 
(deny default)

(allow file-write* file-read-data file-read-metadata
  (regex "^/Users/user_name/Downloads")
  (regex "^/Users/user_name/Library/Application Support/Mozilla")
  (regex "^/Users/user_name/Library/Application Support/Firefox")
  (regex "^/Users/user_name/Library/Preferences")
  (regex "^/Users/user_name/Library/PreferencePanes")
  (regex "^/Users/user_name/Library/Caches/Firefox")
  (regex "^/Users/user_name/Library/Caches/TemporaryItems")
  (regex "^/Applications/Firefox.app")
  (regex "^(/private)?/tmp/"))

(allow file-read-data file-read-metadata
  (regex "^/dev/autofs.*")
  (regex "^/Library/Preferences")
  (regex "^/Library/Internet Plug-Ins")
  (regex "^/Library/PreferencePanes")
  (regex "^/usr/share/icu")
  (regex "^/usr/share/locale")
  (regex "^/System/Library")
  (regex "^/Applications/Firefox.app")
  (regex "^/usr/lib")
  (regex "^/var")
  (regex #"Frameworks/SDL.framework")
; Our Module Directory Services cache
  (regex "^/private/var/tmp/mds/")
  (regex "^/private/var/tmp/mds/[0-9]+(/|$)")
  (regex "^/Users/user_name"))
 
(allow mach* sysctl-read)

(import "/usr/share/sandbox/bsd.sb")
(deny file-write-data
   (regex #"^(/private)?/etc/localtime$"
     #"^/usr/share/nls/"
	 #"^/usr/share/zoneinfo/"))

(allow process-exec 
  (regex "^/Applications/Firefox.app"))
  
(allow network*)
Replace the /Applications/Firefox.app.... parts with the path to Firefox on your system. Also replace user_name with your username. Next, open up a Terminal and execute this command:
sandbox-exec -f firefox-sandbox /Applications/Firefox.app/Contents/MacOS/firefox-bin
Make sure the firefox-sandbox file is in the directory where you run the above command, and Firefox should launch in a protected sandbox.

[robg adds: I haven't tested this one.]
  Post a comment  •  Comments (17)  
  • Currently 3.33 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (12 votes cast)
 
[27,414 views] Email Article To a Friend View Printable Version
Use one bookmark to load different versions of a site Web Browsers
I have several sites that I access on both my iPhone and desktop, so I like to have quick access to them via the Bookmarks Bar. However, these sites have different versions for the desktop, for mobiles, and, in some cases, yet another version for the iPhone. Usually, the full version doesn't work so well on the iPhone, and the iPhone version is undesirable on the desktop.

Instead of creating a plain bookmark, a little Javascript can make a bookmark context-sensitive, and allow you to have one bookmark that opens the right version of a page, depending on which platform you're browsing from. The basic idea is to use some client-side Javascript to check the browser's platform (a.k.a. operating system), and then tell the browser to access a URL based on that check. The code looks like this:
javascript:if((navigator.userAgent.match(/iPhone/i))||(navigator.userAgent.match(/iPod/i))){location.href='URL1'}else{location.href='URL2'}
For Google Translate, which has a nice iPhone version if you open the right URL, but a stripped-down mobile version if you just go to translate.google.com on your iPhone or iPod, this looks like
javascript:if((navigator.userAgent.match(/iPhone/i))||(navigator.userAgent.match(/iPod/i))){location.href='http://www.google.com/m/translate?hl=en&source=mobilesearchapp'}else{location.href='http://translate.google.com/#auto|en'}
To create this bookmark, copy the above code, create a new bookmark with the Bookmarks » Add Bookmark command, paste the code into the Address field, and give your bookmark a memorable name. Once you have one bookmarklet, you can make copies that work with the sites of your choice. Note that the URLs have to be enclosed in single quotes ('), and that spaces and line breaks will probably break the bookmarklet.

Using bookmark-syncing software, you should be able to use these bookmarklets in other browsers and on other operating systems.
  Post a comment  •  Comments (3)  
  • Currently 3.53 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (15 votes cast)
 
[5,491 views] Email Article To a Friend View Printable Version