Re: Is same not the same?
Re: Is same not the same?
- Subject: Re: Is same not the same?
- From: Nigel Garvey <email@hidden>
- Date: Sun, 20 Mar 2016 10:38:15 +0000
Iurista GmbH wrote on Fri, 18 Mar 2016 14:01:17 +0100:
>set SD to (path to "boot") as text
>set FMPfad to SD & "Applications:Programme (Users):Software for this
>MacOS:PPC Software for SL only:6 Büro:app| FileMaker Pro 6:Filemaker
>Pro.app"
>
>tell application "System Events"
> if exists application process "Filemaker Pro" of application "System
>Events" then
> tell application "Filemaker Pro" to quit
> else
> open item FMPfad
> tell (application process "Filemaker Pro" of application "System
Events")
>to set its frontmost to true
> repeat until exists window of (application process "Filemaker Pro" of
>application "System Events")
> delay 1
> end repeat
> tell (application process "Filemaker Pro" of application "System
Events")
>to keystroke return
> end if
>end tell
>
>This script fails twice!!
>If FMP is not running, the log shows that script "test2" does not
recognize
>the AXwindow. FMP herefore hangs in the loop and never gets further than
>its first AXWindow.
The window reference is incomplete. It should contain something
specifying _which_ window.
repeat until exists window 1 of application process "Filemaker Pro"
The phrase 'of application "System Events"' isn't necessary anywhere in
the script.
>If FMP is running, Line 2 & Line 6 produce error.
Presumably you're counting from 'tell application "System Events"'.
>Line 2 does not recognize FMP as running, therefore activating the ELSE
>statement.
This may be related to the superfluous 'of application "System Events"'
in the reference, but I'm not really sure.
>Line 6 then produces this error (translated from german): „System
Events“
>has received an error: „application process "Filemaker Pro"“ can not be
set
>to „true“.
Filemaker Pro's being launched by having System Events open its
application file. The script goes on to the next instruction when the
file's been opened, not necessarily when Filemaker Pro's gone through
its full launch procedure, so the application process may not actually
exist when the script tells it to set its frontmost to true. You need
another delay to wait for the process to appear.
-- 'path to' has its own 'as text' parameter and can return the Applications folder path directly.
set AF to (path to applications folder as text)
set FMPfad to AF & "Programme (Users):Software for this MacOS:PPC Software for SL only:6 Büro:app| FileMaker Pro 6:Filemaker Pro.app"
-- It's best to avoid nesting 'tell' statements to different applications.
tell application "System Events" to set FMPrunning to (application process "Filemaker Pro" exists)
if (FMPrunning) then
tell application "Filemaker Pro" to quit
else
tell application "System Events"
open item FMPfad
repeat until (application process "Filemaker Pro" exists)
delay 0.5
end repeat
tell application process "Filemaker Pro"
set frontmost to true
repeat until (window 1 exists)
delay 0.5
end repeat
end tell
keystroke return
end tell
end if
NG
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden