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

Auto-fill FedEx forms in Safari via AppleScript Web Browsers
If you do a lot of shipping with FedEx, you know how annoying it is to cut and paste all the address information into Safari. There are expensive programs that will extract information, but most don't work with OS X or require Filemaker. Here's a quick hint I use quite often to autofill the FedEx forms.
tell application "Safari"
  tell (make new document) to set URL to ""
  delay 2
  set doc to document "FedEx | Ship Manager | Shipping"
  log (doc's name)
  do JavaScript "document.forms['domesticShipmentActionForm']['recipient.companyName'].value = 'add'" in doc
  do JavaScript "submitForm('doSelectRecipientCompanyName')" in doc
  delay 2
  do JavaScript "document.forms['domesticShipmentActionForm']['recipient.companyName'].value = 'New Company'" in doc
  do JavaScript "document.forms['domesticShipmentActionForm']['recipient.firstName'].value = 'First'" in doc
  do JavaScript "document.forms['domesticShipmentActionForm']['recipient.lastName'].value = 'Last'" in doc
  do JavaScript "document.forms['domesticShipmentActionForm']['recipient.addressLine1'].value = 'Address1'" in doc
  do JavaScript "document.forms['domesticShipmentActionForm']['recipient.addressLine2'].value = 'Address2'" in doc
  do JavaScript "document.forms['domesticShipmentActionForm'][''].value = 'City Name'" in doc
  do JavaScript "document.forms['domesticShipmentActionForm']['recipient.stateProvinceCode'].value = 'UT'" in doc
  do JavaScript "document.forms['domesticShipmentActionForm']['recipient.zipPostalCode'].value = '84111'" in doc
  do JavaScript "document.forms['domesticShipmentActionForm']['recipient.phoneNumber'].value = '801-655-1996'" in doc
  do JavaScript "document.forms['domesticShipmentActionForm']['recipientGroundCommercialFlag'].checked = true" in doc
  do JavaScript "recipientGroundCommercialFlag = false" in doc
  do JavaScript "document.forms['domesticShipmentActionForm']['shipmentServiceType'].value = 'FedEx Home Delivery'" in doc
  do JavaScript "document.forms['domesticShipmentActionForm']['shipmentPackagingType'].value = 'Your Packaging'" in doc
  do JavaScript "document.forms['domesticShipmentActionForm']['packageWeightForPieceZero'].value = '1.5'" in doc
  do JavaScript "document.forms['domesticShipmentActionForm']['packageWeightForPieceZero'].value = '1.5'" in doc
  do JavaScript "document.forms['domesticShipmentActionForm']['shipmentDimension'].value = '1006956'" in doc
  do JavaScript "document.forms['domesticShipmentActionForm']['packageDeclaredValueForPieceZero'].value = '70'" in doc
  do JavaScript "document.forms['domesticShipmentActionForm']['shipmentAlert.senderExceptionNotificationFlag'].checked = true" in doc
end tell
You can easily modify this to do more programmically. For instance, I use Python and appscript to parse the emails my e-commerce solution sends, and then fill in the FedEx page with Safari. I'll leave that up to you. Even if you don't need to do that, simply autofilling most of the common fields may be a huge timesaver for you. This also demonstrates an easy way to handle forms in general.

The only bit that needs explanation is the filling in of the field shipmentDimension, which seems a tad confusing. FedEx adds a unique number for each custom box you've created. Go to Safari's View » View Source menu, search for shipmentDimension, and you'll see your custom box sizes and the numbers for each.

Also note the two delay statements which wait two seconds each. That is necessary so that FedEx's custom Javascript code runs. If you have a slow connection, you may need to increase that delay time.
  Post a comment  •  Comments (6)  
  • Currently 2.33 / 5
  You rated: 5 / 5 (9 votes cast)
[25,349 views]  View Printable Version
Clean up site tracks left behind after private surfing Web Browsers
Apple describes Safari's "Private Browsing" feature as follows:
When you browse the web, Safari stores information about the websites you visit including the content and any user names, passwords, and credit card numbers you enter. Other people who use your computer can view that information. If you don't want this information stored, use Private Browsing.... If you neglected to turn on Private Browsing before you browsed, choose Safari > Reset Safari.
This seems to imply that using Private Browsing, as well as Reset Safari, will not leave any record on your computer of the sites you have visited. This is not true, however. In Terminal, type this command:
dscacheutil -cachedump -entries Host
This will list all entries cached by Leopard (including the date and time of last access), even when Private Browsing is enabled. Even using Reset Safari will not clear these entries. To manually clear these entries, use the following command in Terminal:
dscacheutil -flushcache
The cache is also cleared once you log out of your Leopard account. While logged in, however, any other account on the system (even Guest users) can execute the above command to view sites you have visited.

[robg adds: We covered flushing the cache in 10.5 in this hint, but the fact that Safari leaves trails even in Private Browsing mode made me feel this was worth sharing. Other browsers may have similar issues in their private browsing modes, but I haven't tested them.]
  Post a comment  •  Comments (7)  
  • Currently 3.22 / 5
  You rated: 5 / 5 (18 votes cast)
[108,901 views]  View Printable Version
An AppleScript to send an email about a page in Safari Web Browsers
When I find a web page that might be of interest to someone I know, I send an email suggesting they have a look. I want this email to be short and enable the recipient to decide quickly if the page is, in fact, of interest. The email usually includes some text from the page, a link, and a comment from me.

But, if you do it often, this recipient-friendly approach becomes labor intensive for the sender. There's too much copying, pasting, and application switching. Hence this Applescript. It puts text you select in Safari into a new Mail message within quotation marks, appends the page link, and puts the page name into the email's subject field. Add a comment, if you wish, and press send.
tell application "Safari"
    set the clipboard to ""
    tell application "System Events" to keystroke "c" using command down
    set myCount to count (the clipboard)
    if myCount = 0 then
        display dialog "Oops, you forgot to select some text in Safari." & return & return & "Please select the text you want to include in your email and try again." buttons {"OK"} default button "OK"
    end if
    set SelectedText to the clipboard
    set PageURL to URL of front document
    set PageName to name of front document
end tell

tell application "Mail"
    set MyEmail to make new outgoing message
    set MessageFont to message font
    set MessageFontSize to message font size
    tell MyEmail
        set content to ("\"" & SelectedText & "\"" & return & return & "More at " & PageURL)
        set subject to PageName
        set font of content to MessageFont
        set size of content to MessageFontSize
    end tell
    tell window named PageName
        set index to 1
    end tell
end tell
To install:
  1. Copy the script.
  2. Open the application Script Editor and paste the script into the window.
  3. Name and save the script in your user's Library/Scripts/Safari folder (create the folders as necessary).
  4. If you have not already done so, use Applescript Utility to show the Scripts menu in the menu bar.
To use: In Safari, select the text for your email, then run the script by selecting it in the scripts menu in the menu bar.

[robg adds: I tested this and it worked as described. For the save location, however, I would recommend your user's Library » Scripts » Applications » Safari folder. By placing it here, you'll see it listed directly in a 'Safari Scripts' section of the Scripts menu when you're in Safari. If you store it just in the Scripts/Safari folder, then it will appear in a Safari sub-menu of the Scripts menu.

Note that you can do most of this without the script, simply by selecting the text on the page, copying it, then pressing Shift-Command-I (File » Mail Link to This Page). Mail will open with the page title filled in as the subject, along with the link to the page in the body of the message. Enter a recipient in the To line, click into the body, and press Command-V to paste the copied text. If you do this a lot, though, this script will save some time and key presses.]
  Post a comment  •  Comments (17)  
  • Currently 1.75 / 5
  You rated: 3 / 5 (8 votes cast)
[12,932 views]  View Printable Version
Float the BBC iPlayer widget on the Desktop Web Browsers
This hint is for UK users that want to watch BBC iPlayer shows on their desktop while 'working' on other stuff. It uses Safari's Web Clip feature to view the iPlayer content in a Dashboard Widget, as seen in this screenshot.

First, enable 'devmode' in Dashboard, as explained in this hint (you can just killall Dock to activate devmode, no logout/login required), so you can float the Web Clip on your desktop. Next, grab the iPlayer content:
  1. Open Safari and find the iPlayer page with the show you want to watch.
  2. Click File » Open in Dashboard... (a purple toolbar will appear).
  3. Move the mouse over and click the iPlayer Play button to select the iPlayer area, then click the 'Add' button. Dashboard will open and load the iPlayer Web Clip.
  4. Begin dragging the iPlayer Web Clip (click and drag the top edge of the Web Clip), then press F12 while dragging. This will exit Dashboard mode and leave the Web Clip under your mouse.
  5. Move the iPlayer Web Clip wherever you want it, and let go of the mouse.
Now you can get on with your work while 'unmissing' your favorite show. Read on for a few notes about this solution...
read more (121 words)   Post a comment  •  Comments (1)  
  • Currently 1.57 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (7 votes cast)
[12,263 views]  View Printable Version
Preview Quartz Composer (.qtz) files in Safari Web Browsers
I was hunting for a very specific screensaver the other day online, and was thrilled to find a direct link to the Quartz Composer (.qtz) file in question. So I clicked on the URL in Safari, expecting it to start downloading, and was pleasantly surprised when Safari began rendering the screensaver from directly within the active Safari window. Nice one!

Additional investigation revealed that any .qtz file on your computer will render in Safari via the drag and drop method. Right-clicking on the active window in Safari brings up an option to "Save Composition," which allows you to download the .qtz file to a location of your choice.

Some additional notes:
  1. I have Developer Tools installed, and haven't tested this without Developer Tools installed.
  2. Not tested in 10.4.x (Tiger)
  3. Quartz Composer files are pretty darn small and they load and render very quickly. They are easily created with Developer Tools and can access all kinds of system information and can link to, fetch, and deliver all kinds of information (eg. RSS feeds) online.
  4. So one REALLY big question that this now poses, is what kind of wonderful potential uses, if any, do these have in the realm of web design and development?
  5. Quicktime can also render and play .qtz files. So is Safari using the QuickTime Plug-in to render these files? Or is Safari accessing the Quartz graphics engine directly?
  6. If Safari is using the QuickTime Plug-in, then Windows users might be able to benefit from any potential web applications that these files have to offer. If this is not the case, then any potential applications would be limited to Mac OS X platforms only. Either way it is still a tantalizing thought for Mac users.
[robg adds: I tried this in Safari on Windows XP, and wasn't able to open the .qtz file.]
  Post a comment  •  Comments (6)  
  • Currently 2.20 / 5
  You rated: 5 / 5 (10 votes cast)
[32,766 views]  View Printable Version
Remove the Google search box in Safari 3 Web Browsers
I love URL keywords in Firefox, but I use Safari. Thankfully there are a handful of Safari plug-ins that bring keyword functionality to Safari (Sogudi, Keywurl, Saft, etc). These make the search box somewhat redundant. Previous to Safari 3, we were able to remove the search bar by just deleting it from the toolbar's NIB file. This doesn't work with Safari 3, however. I did a little poking around, and figured out a way to get it to disappear.
read more (210 words)   Post a comment  •  Comments (12)  
  • Currently 2.33 / 5
  You rated: 5 / 5 (9 votes cast)
[20,200 views]  View Printable Version
10.5: Set per-feed update/expire intervals in Safari RSS Web Browsers
Compared to dedicated feed readers, one of the major disadvantages of Safari RSS has always been the lack of an ability to set update intervals or article expiry intervals/times on a per-feed basis. Setting your global update interval in Safari to 30 minutes might be appropriate for high-volume feeds, but it places an undue burden on sites like Mac OS X Hints which are only updated once a day.

In Leopard, RSS reading functionality is no longer built into the Safari application itself. There is a system-wide RSS framework called PubSub (Publication Subscription) to which various applications (Safari, Mail, even Xcode) are subscribed as clients. This has a number of advantages. An application called PubSubAgent runs in the background and updates feeds even when client reader applications are not running and (of course) feeds to which multiple applications are subscribed are updated only once. Crucially, the PubSub framework does allow per-feed configuration settings which override the more generic per-client settings.

There is an API to PubSub which is extensively documented in the ADC Reference Library. However, PubSub stores per-user settings in a SQLite database located at ~/Library/PubSub/Database/Database.sqlite3. Since SQLite is ACID-compliant, one should be able to edit this database while PubSubAgent is running without too much fear of corrupting data. (Still, it's probably wide to back up the database before starting!) To access the database, one can use the command-line sqlite3 tool which ships with OS X, or any of the available graphical SQLite interfaces. You will of course also need some basic SQL skills, which are well beyond the scope of this hint.

The configuration database contains, amongst others, the tables Feeds (a list of RSS feeds), Clients (the "client" reader applications) and Subscriptions. An entry (row) in Subscriptions represents a specific subscription of a specific reader application to a specific RSS feed. The columns in Subscriptions containing the values we'd like to change are refreshInterval, as well as expirationInterval and/or expirationDate.

read more (114 words)   Post a comment  •  Comments (4)  
  • Currently 1.67 / 5
  You rated: 4 / 5 (9 votes cast)
[11,032 views]  View Printable Version
Use new keyboard's function keys to open Safari's Find Web Browsers
On my 2007 iMac with the new thin keyboard, the F17, F18 and F19 function keys all open the Find Bar in Safari 3. Using these function keys is an alternative to using Command-F. Safari's new Find behavior is quite nice, if you haven't played with it much. You can use the Enter and Shift-Enter keys to move forward and backwards between the found items; press Escape or Command-perido to exit when done. (In previous versions of Safari, I used SafariStand to automatically open the Find box when ever I start typing but that function doesn't work yet with Safari 3.)
  Post a comment  •  Comments (8)  
  • Currently 1.56 / 5
  You rated: 2 / 5 (9 votes cast)
[9,712 views]  View Printable Version
Select individual columns from tables in Firefox Web Browsers
In Firefox (I'm using v2.0.0.11), if you hold down the Command key and click-drag inside a table, you can select the data just in one column (or any contiguous, regular shaped block) of cells.
  Post a comment  •  Comments (5)  
  • Currently 2.60 / 5
  You rated: 1 / 5 (10 votes cast)
[13,717 views]  View Printable Version
Solve the Safari HotMail login loop problem Web Browsers
For quite a few months, many Mac Safari users have been having problems with HotMail. The problem is that when they try to log in to HotMail, Microsoft's redirect commands wind up in an unending loop. This only happens when users did not manually click the link to "sign out" on their last session.

I've had to help many people solve this problem, so I thought it might be useful information for The way to solve the problem is to delete related cookies:
  1. In Safari, go to Preferences » Security » Show Cookies.
  2. Type in
  3. Click the Remove All button.
Now you can login to HotMail again. In the future, manually sign out each time to avoid doing these steps again. The only real disadvantage is that you'll have to retype your username and password the next time you log in after clearing the cookies.

[robg adds: A comment on the queue site notes that this should also help fix looping issues with Yahoo's websites. I'm not a user of either HotMail or Yahoo (and Safari isn't my main browser), so I can't say I've experienced any of these issues. If you have, and this hint helps, please note it in the comments.]
  Post a comment  •  Comments (9)  
  • Currently 1.88 / 5
  You rated: 4 / 5 (51 votes cast)
[123,115 views]  View Printable Version