It does work nicely from the IDE but as Trevor noted, the downside to using 
AppleScript in this case is that under newer version of OSX your compiled app 
will trigger a (one time) dialog asking to grant access to control “System 
Events.app”
—
Scott Morrow

> On Nov 25, 2019, at 8:46 AM, Bob Sneidar via use-livecode 
> <use-livecode@lists.runrev.com> wrote:
> 
> on mouseUp
>   put "tell application " & quote & "System Events" & quote & cr after 
> tApplescript
>   put "set activeApp to name of first application process whose frontmost is 
> true" & cr after tApplescript
>   put "return activeApp" & cr after tApplescript
>   put "end tell" & cr after tApplescript
>   do tAppleScript as appleScript
>   put the result
> end mouseUp
> 
> works for me
> 
> Bob S
> 
> 
>> On Nov 23, 2019, at 06:11 , Klaus major-k via use-livecode 
>> <use-livecode@lists.runrev.com> wrote:
>> 
>> Hi Trevor,
>> 
>>> Am 23.11.2019 um 15:06 schrieb Trevor DeVore via use-livecode 
>>> <use-livecode@lists.runrev.com>:
>>> 
>>> On Sat, Nov 23, 2019 at 6:24 AM Klaus major-k via use-livecode <
>>> use-livecode@lists.runrev.com> wrote:
>>> 
>>>> Hi friends,
>>>> 
>>>> can we check if our standalone is currently active, means in
>>>> the "foreground" or if it is not active? Know what I mean?
>>>> If yes, how can we do that? LC? AppleScript?
>>>> 
>>>> I want to alert the user if the app is active, but not if the app
>>>> is not active.
>>> Apple provides API calls to do this and wrapping Objective-C APIs is pretty
>>> straightforward. The APIs you are interested in:
>>> ...
>>> Regarding step 6 - If you don't want to store your extension externally to
>>> your application you can also use the "+" button in the EB to install the
>>> extension in your LC environment. Now the extension will load whenever you
>>> launch LC and you can select "NSWorkspace" in the Standalone Builder
>>> Inclusions tab so that the extension is bundled with your executable.
>>> 
>>> -- 
>>> Trevor DeVore
>> 
>> wow, lots of infos, thank you very much, but maybe a little overkill for me.
>> 
>> It would suffice for me to get this little snippet to work:
>> -----------------------------------------------------------------
>> tell application "System Events"
>>      set activeApp to name of first application process whose frontmost is 
>> true
>>      return activeApp
>> end tell
>> ----------------------------------------------------------------
>> Works fine in the AppleScript Editor, but I get "execution error" when DOing 
>> this in LC!?
>> Any hints appreciated!
>> 
>> Thanks a lot!
>> 
>> 
>> Best
>> 
>> Klaus
>> --
>> Klaus Major
>> https://www.major-k.de
>> kl...@major-k.de
>> 
>> 
>> _______________________________________________
>> use-livecode mailing list
>> use-livecode@lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your subscription 
>> preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
> 
> 
> _______________________________________________
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription 
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode


_______________________________________________
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Reply via email to