Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > AppleScript: Wait for action?

AppleScript: Wait for action?
Thread Tools
bojangles
Senior User
Join Date: May 2000
Location: Lafayette, IN, USA
Status: Offline
Reply With Quote
Oct 10, 2003, 05:31 PM
 
I�m using AppleScript to open photos in Photoshop, resize them, and paste the resulting thumbnails into FileMaker Pro. Unfortunately, since some files are larger than others, some take a lot longer than others and the AppleScript continues on without waiting for Photoshop to finish. This is what I�m trying to do:

Code:
--Get the name of the file and copy the path for FileMaker Pro.
set filename to the name of (file i of folder named dayf of folder named monthf �
of folder named yearf of folder "STORAGE: Digital Pictures")
if (character ((length of filename) - 2) of filename is "m") then
exit repeat
end if
set filepath to ("==STORAGE: Digital Pictures:" & yearf & ":" & �
monthf & ":" & dayf & ":" & filename) as string
set the clipboard to filepath as string

--Have FileMaker Pro find the appropriate record.
tell application "FileMaker Pro"
activate
repeat
try
do script "Find from AppleScript"
if filepath is not "" then
exit repeat
end if
end try
end repeat
do script "Find from AppleScript"
end tell

--Tell Photoshop to open the appropriate file and create a thumbnail version for FileMaker,
--then wait for FileMaker process it.
using terms from application "Finder"
tell application "Adobe Photoshop 7.0"
activate
open (("STORAGE: Digital Pictures:" & yearf & ":" & �
monthf & ":" & dayf & ":" & filename) as alias)
end tell
end using terms from

tell application "Adobe Photoshop 7.0"
do script "Resize for FileMaker Pro"
end tell

--Tell FileMaker Pro to paste the thumbnail that Photoshop just created.
tell application "FileMaker Pro"
activate
do script "Paste from AppleScript"
end tell
End code

So� any ideas?
“The trouble with quotes on the Internet is that you can never tell if they’re attributed to the right person.”
—Abraham Lincoln
     
suthercd
Senior User
Join Date: Oct 2000
Location: Midwest
Status: Offline
Reply With Quote
Oct 11, 2003, 02:11 AM
 
1. Use an idle handler. See applescriptsourecebook.com
2.
Code:
set now to current date repeat while (current date) is less than now + 5 end repeat
3. delay x -- (seconds)

Craig
     
   
Thread Tools
 
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Top
Privacy Policy
All times are GMT -4. The time now is 10:36 PM.
All contents of these forums © 1995-2017 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.8 © 2000-2017, Jelsoft Enterprises Ltd.,