Monday, April 22, 2019

#1 2018-10-24 12:51:55 pm

mretondo
Member
From:: Retondo
Registered: 2016-08-27
Posts: 4

reference to current application is NOT foreground application

I have a property:
property NSApplication : a reference to current application's NSApplication
If my applescriptobjc script is run NSApplication is set to the application that ran the script and not the frontmost application. I want the script to be run from a background application while Xcode is the frontmost application but still have NSApplication set to Xcode. How can I change the property to point to Xcode? Remember this is an Applescriptobjc script.

Last edited by mretondo (2018-10-24 12:53:40 pm)

Offline

 

#2 2018-10-24 04:11:09 pm

Shane Stanley
Member
From:: Australia
Registered: 2002-12-07
Posts: 5626

Re: reference to current application is NOT foreground application

NSApplication is the name of a Cocoa class, and you use it by prepending it with current application. Don't try setting it to anything else.


Shane Stanley <sstanley@myriad-com.com.au>
www.macosxautomation.com/applescript/apps/
latenightsw.com

Offline

 

#3 2018-10-25 12:12:08 pm

mretondo
Member
From:: Retondo
Registered: 2016-08-27
Posts: 4

Re: reference to current application is NOT foreground application

So there's no way to have an ApplescriptObjC script run via Keyboard Maestro macro on a specific application? It sounds like your saying that current application will be Keyboard Maestro which really sucks. I need to get the class of the first responder of Xcode.

Thanks for your help

Offline

 

#4 2018-10-25 01:30:26 pm

alldritt
Site Admin
From:: Victoria, B.C. Canada
Registered: 2002-12-12
Posts: 37
Website

Re: reference to current application is NOT foreground application

Correct.  ASObjC can only target objects within the application hosting the script.  To interact with another application, you'll need to use AppleEvents.


Mark Alldritt - Late Night Software Ltd.
support@latenightsw.com | mark@macscripter.net

Offline

 

#5 2018-10-26 04:42:01 pm

mretondo
Member
From:: Retondo
Registered: 2016-08-27
Posts: 4

Re: reference to current application is NOT foreground application

Thanks for the bad news:(

Offline

 

Board footer

Powered by FluxBB

RSS (new topics) RSS (active topics)