Hmm, moving the Safari code to a "on removing" block (the UNIX server
issues FTP delete commands to clear the XML once it sees a response
XML file indicating everything's been processed) seems to have done
the trick:
on removing folder items from this_folder after losing these_items
tell application "Safari" to activate
tell application "System Events"
tell process "Safari"
click menu item "Shipping Workstation" of menu "Window" of menu bar
1
end tell
end tell
end removing folder items from
On Apr 24, 8:48=A0pm, "harsh...@[EMAIL PROTECTED]
" <harsh...@[EMAIL PROTECTED]
> wrote:
> We have a semi-convoluted setup where we have a web interface into a
> UNIX server that we access via Safari, feeding it with a handheld
> barcode scanner. =A0That UNIX server, in response to barcode input, FTPs
> an XML file to our Mac workstations, which have a FolderAction
> AppleScript setup that, when an XML file appears, feeds that file to a
> proprietary application running on the Mac (Endicia, for postage),
> which does its thing (spits out a label). =A0After that, I need control
> to pass back to Safari, and =A0the UNIX server's data input form (in the
> Safari window) to have focus. =A0The FolderAction script attached does
> this (kind of clumsily, but it does work), but ... =A0A second or two
> after the Safari window snaps to the foreground, the Finder is
> switched to, necessitating a mouse click back to the Safari window,
> which slows things way down.
>
> What's causing the Finder to shuffle itself to the foreground, and how
> can I prevent it?
>
> Thanks!
>
> on adding folder items to this_folder after receiving added_items
> =A0 =A0 =A0 =A0 try
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 repeat with EachItem in added_items
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 set ItemInfo to info for
E=
achItem
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 if not folder of
ItemInfo =
then
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 set
FileEx=
tensionOfItem to name extension of ItemInfo
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 if
FileExt=
ensionOfItem is "xml" then
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0
=
=A0 =A0 tell application "Endicia"
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0
=
=A0 =A0 =A0 =A0 =A0 =A0 process XML file at (POSIX path of EachItem)
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0
=
=A0 =A0 end tell
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 end if
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 end if
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 end repeat
> =A0 =A0 =A0 =A0 end try
>
> =A0 =A0 =A0 =A0 tell application "Safari" to activate
> =A0 =A0 =A0 =A0 tell application "System Events"
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 tell process "Safari"
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 click menu item
"Shipping =
Workstation" of menu "Window" of menu bar
> 1
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 end tell
> =A0 =A0 =A0 =A0 end tell
> end adding folder items to


|