AnsweredAssumed Answered

applescript script step causing issues when "delay" is used

Question asked by rlinsurf on Oct 22, 2009
Latest reply on Apr 20, 2010 by FentonJones

Title

applescript script step causing issues when "delay" is used

Post

I'm using FMP Advanced 10, and am on 10.6.1. I'm an intermediate FM user.

 

I now have an applescript which is part of a larger script which is meant to do the following. I need to insert an .mp3 file into a container. So I created a field which has the POSIX path to the file. The script copies the contents of that field. Then it goes to the container field on the layout. Then it executes an applescirpt which is meant to insert the .mp3. The script is:

 

 

tell application "System Events"

tell process "FileMaker Pro Advanced"

click menu item "QuickTime…" of menu 1 of menu bar item "Insert" of menu bar 1

tell window 1

keystroke "g" using {command down, shift down} //this should open Go To Folder

keystroke "v" using {command down} //this pastes the path, which has been checked and is POSIX correct. We're getting here OK.

end tell

tell window 1

key code 36 //this clicks Enter. By the time it gets here, it just beeps twice and does nothing further, indicating it can't click Enter, Enter

end tell

tell window 1

key code 36 //this clicks Enter

end tell

end tell

end tell

 

This works in applescript itself perfectly, but when run in FMP, it keeps beeping and not performing.

I diagnosed this to one error: delay. Anytime I put a delay of any kind in the script, it never opens the Insert QuickTime... window, and so balks at everything after. But if there are no delays, it runs smoothly to the point after it has pasted the path into the Go To Folder sheet, unfortunately, so fast, that by the time it gets there, all it can do is beep twice (I can't click Enter!).

Can someone tell me what's going on here?

 



Outcomes