Re: frontmost application... :(
Re: frontmost application... :(
- Subject: Re: frontmost application... :(
- From: Yvan KOENIG <email@hidden>
- Date: Mon, 22 Apr 2019 20:00:14 +0200
In such case, I use this kind of code:
tell application "System Events" -- get frontmost process
set frontmostProcess to first process where it is frontmost --
this will be the script process
if name of frontmostProcess is in {"Script Editor",
"AppleScript Editor", "Script Debugger"} then
set visible of frontmostProcess to false -- hide the
script process
repeat while (frontmostProcess is frontmost) -- wait
until the script is hidden
delay 0.1
end repeat
set theApp to name of first process where it is
frontmost -- get name of frontmost process (ignoring the script process)
set frontmost of frontmostProcess to true -- unhide the
script process
else
set theApp to name of frontmostProcess
end if
end tell
Yvan KOENIG running High Sierra 10.13.6 in French (VALLAURIS, France) lundi 22
avril 2019 19:59:59
> Le 22 avr. 2019 à 18:08, Jean-Christophe Helary <email@hidden> a
> écrit :
>
> tell application "System Events"
> tell (process 1 where frontmost is true)
> set myName to its name
> display dialog myName
> end tell
> end tell
>
> Obviously, I get the name of the script, when I want the name of the
> application that's frontmost before I launch the script... :(
>
> Ultimately, I just want to get the path of the frontmost document of the
> frontmost application...
>
> Jean-Christophe Helary
> -----------------------------------------------
_______________________________________________
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