Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

New user and strange phenomenon

edited January 2008 in FastScripts
Hello -

I am new to both Applescript and Fastscript so I may be simply doing something silly.

I wrote a simple script to keystroke my email address and then using fastscripts linked it to the shortcut option-F2 (Note: I also tried apple-F2). The script is

set target_app to (path to frontmost application as Unicode text)
tell application target_app to activate
tell application "System Events"
tell process target_app to keystroke ""
end tell

(I changed the actual string it's sending for privacy :)

When I tried to invoke the script while in Firefox (at with the cursor placed in the search box waiting for input for example, it proceeded to do a very strange series of commands first putting the firefox window in the dock, then bringing up windows of page source for the web page, etc. etc. (that is what option-F2 did, apple-F2 filled in the text box with some alternate character set). It also did strange things when the cursor was waiting on a "stickies" note, etc. so I don't think it had anything to do with Firefox or google. I thought that the sequence option-F2 and apple-F2 must already mean something; so I then changed it to activate when I pressed F3 instead. This is the weird bit - now it works wonderfully on F3, BUT if I press option-F2 or apple-F2 in the exact way I did before - NOTHING happens! I would have expected that if those codes meant something already, it would have had some effect.

Also, my script is called "Fam address" and despite having it linked to F3 and it working properly now, it does not show the shortcut (F3) on fastscript's drop down menu on the menu bar at the top of the screen. All of my other scripts show their shortcuts on this menu. I have a screen scrape showing this if you would like it. I don't know if it makes any difference but I am on an 800MHz powerPC G4 iMac running Tiger.


  • Unfortunately when a script synthesizes fake keystrokes, it can cause some pretty funny behavior when you invoke it by a keyboard shortcut. The reason is the script runs so fast that you're still holding down the original keys when it tries to do the fake keystrokes.

    Often these problems can be solved by putting a short delay at the beginning of the script. If you put a

    delay 1.0

    At the beginning, does it help the problem?

    Also can you confirm if you run the script by selecting it from the menu, no keyboard shortcut, does it behave as expected?

  • Thanks for the speedy response. When executing directly from the menu, it works correctly even without the delay. The delay did solve the problem using both apple-F2 and option-F2. It also works correctly without the delay using F3. Any idea why the shortcut F3 doesn't show up on the menu? When it is set to apple-F2 or option-F2 it shows up, but set it to F3 and the shortcut shows blank even though it is set and works!

    Thanks again!
Sign In or Register to comment.