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

Save Flash video files from local cache Web Browsers
The Flash plug-in stores its temporary files in /private » var » tmp » folders.501 » TemporaryItems, in files named FlashTmp0, FlashTmp1, and so on.

So if you want to do a quick save without looking at Safari's Activity window, press Command-Shift-G in the Finder (or use the Go » Go to Folder menu item), enter /tmp, and dive down the specified folder hierarchy. You can then move the FlashTmp0 file to the Desktop, add the .flv extension, and watch it with VideoLanClient, MPlayer OSX, or QuickTime with the Perian.component installed. I tested this with Safari and Firefox 3 beta.
  Post a comment  •  Comments (14)  
  • Currently 2.47 / 5
  You rated: 2 / 5 (17 votes cast)
 
[131,195 views] Email Article To a Friend View Printable Version
Fix an issue with the Firefox download folder location Web Browsers
If you migrate from a previous machine to a new machine using Apple's Migration Assistant, and in the process you create a new user -- this can happen if you create your old user account on the new machine prior to migrating -- you may have issues with Firefox and the Downloads folder. Because of a shortcoming in the migration tool, the OS X Downloads folder for the new account will have the path for the old account, and Firefox will then be unable to save because it does not have the correct permissions. I encountered this issue with 10.5 Leopard (both machines), migrating from an old Mac mini to new Mac pro.

The solution is to open ~/Library » Preferences » com.apple.internetconfig.plist with the Property List Editor (Xcode required), navigate to the Download Folder item, and delete the value (not the key; just the value under it), then save the property list file.

The next time you save a downloaded file in Firefox, OS X will ask you where you want it. Answer the question, and the problem goes away permanently.

[robg adds: A commenter on the queue review site notes: "This is a bug with Firefox that I see with our users all the time. In prefs, the download folder looks like it's set correctly, but Firefox wants to download to some read-only folder on the hard drive (it's always arbitrary). We have had to delete ~/Library » Preferences » com.apple.internetconfig.plist -- but we ALSO have had to delete ~/Library » Preferences » com.apple.LaunchServices.plist to resolve it."]
  Post a comment  •  Comments (13)  
  • Currently 2.14 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (7 votes cast)
 
[33,525 views] Email Article To a Friend View Printable Version
Use Safari 3 textareas to help with form printing Web Browsers
Safari 3 has resizable textareas -- multi-line text input boxes -- on its forms. This can be a big help when completing a form (for example, submitting a long hint!), but can also help with printing those forms.

By default, when Safari prints a form, it appears just as it does on screen. This means that any textareas that have more text than will fit in the visible space will show a vertical scrollbar and some of your content will be hidden -- not much help for record keeping. However, printing (including Save as PDF) honors resized textareas, so the trick is to make sure you have resized (using the handle at the bottom right corner) to show all your content before printing. You'll also get better looking output with no scrollbars!

I use this technique when submitting information to sites that don't offer a printable version after submission.
  Post a comment  •  Comments (0)  
  • Currently 1.40 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (5 votes cast)
 
[5,243 views] Email Article To a Friend View Printable Version
Fully automated, one-step sending of a URL from Safari Web Browsers
I often send a link off to one single person, many times a day. You can use the Mail Link to this Page feature in Safari, but that still means you have to compose the email with the To address, and also tell the email to send. Since I do this several times a day, I decided to AppleScript it. Drop the following script into ~/Library » Scripts » Safari; name it what you like. If that folder structure is not already made, just make new folders with the correct names.

The script will get the current URL of the frontmost document in Safari. It will not copy it to the clipboard, leaving your clipboard in the same state. The script them brings Mail.app forward, addresses an email, sets a subject, some body copy, and drops the URL into the email. Finally, a signature is added to the message, and it is sent out. After that has happened, Mail.app is set to hidden, and Safari is brought back to the foreground where you last left it.

Here's the script:
-- Script made by Scott Haneda
-- http://osxhelp.com
-- 02/13/2008

-- Get the current URL
tell application "Safari"
  set thisPage to do JavaScript "document.URL" in document 1
end tell

-- Create a new email message in mail.app
tell application "Mail"
  activate
  set this_message to make new outgoing message at beginning of every outgoing message
  tell this_message
    make new to recipient at beginning of to recipients ¬
      with properties {address:"firend@example.com", «class rdsn»:"FirstName LastName"}
    set the subject to "The email subject"
    set the content to "Hey, I thought you would be interested in this link: 
" & thisPage & "

--
Signature Name"
  end tell
  send this_message -- Send the email message
end tell

-- Restore Safari to the foreground, hide mail.app
tell application "System Events" to set visible of first process whose name is "Mail" to false
tell application "Safari"
  activate
end tell
In /Applications » AppleScript is a program called AppleScript Utility. This will enable the script menu item in the Finder. Personally, I have attached this script to a keyboard command with Keyboard Maestro. You can also use FastScripts Lite, which is free.
    •  Comments (14)  
  • Currently 1.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (5 votes cast)
 
[9,787 views] Email Article To a Friend View Printable Version
Save selected browser text via AppleScript Web Browsers
I occasionally find myself wanting to save some text from a browser window. Usually I want to know where the text came from as well, so just dragging out a text clipping to the desktop is not a good solution.

I wrote two AppleScripts (one for Safari and one for Firefox) to make saving a selected text, URL, and page title from browser windows easier. The scripts write the browser's selected text and other info to a text file that it creates on the user's desktop. (I don't like clutter on the desktop, so on my Mac, this file gets created in another folder. However, I wanted to provide example scripts that worked, so I chose the desktop).

Below is an example of the script's output with the date, the URL, the page title and some text from a selection:

Wednesday, February 6, 2008 8:40:11 PM
http://some-url.com
Photo of the Day
-------------------
A deep-blue sky sets off a mass of yellow wildflower blooms along ... [snip] ... magazine
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


Further use of the script will append data to the same file, and keep the text neatly formatted and properly separated.
read more (324 words)     •  Comments (5)  
  • Currently 1.50 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (6 votes cast)
 
[27,307 views] Email Article To a Friend View Printable Version
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"
  activate
  tell (make new document) to set URL to "https://www.fedex.com/ship/shipEntryAction.do?method=doInitialEntry&origincountry=us&locallang=en&urlparams=us&sType=&programIndicator=0"
  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']['recipient.city'].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 1.67 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (6 votes cast)
 
[22,542 views] Email Article To a Friend 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 (6)  
  • Currently 3.07 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (15 votes cast)
 
[94,790 views] Email Article To a Friend 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"
    activate
    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"
        return
    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"
    activate
    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.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (5 votes cast)
 
[11,919 views] Email Article To a Friend 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.50 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (6 votes cast)
 
[11,752 views] Email Article To a Friend 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 1.71 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (7 votes cast)
 
[31,128 views] Email Article To a Friend View Printable Version