LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 
Reply

Apple event to open a URL?

This is a bit of a newbie question - sorry!

 

I'm familiar with LabView, but new to Apple Events.  I want to use Apple Events in LabView to open a given webpage using (say) Safari.  So far, all I can do is to "Get ID" to get the ID of Safari; how do I pass Safari a URL (for instance, "www.google.com") so that it will open that webpage?

 

More generally, how do I find out which Apple Events are recognised by a given application?

(I'm running LabView 2010 under OS X 10.9.5).

 

Thanks!

Paul

0 Kudos
Message 1 of 2
(1,015 Views)

Hello,


From what I can tell, in order to access applications on OSX in this way you’ll need to input AppleScript in the Apple Event API in LabVIEW. From here the Apple Events are handled through the Apple Event Manager, see here for more information: https://developer.apple.com/library/content/documentation/AppleScript/Conceptual/AppleScriptX/Concep....


There is this Stack Overflow forum post that provides some options for the AppleScript you’ll need to use to open Safari with a specific url: http://stackoverflow.com/questions/2892622/open-url-in-new-safari-tab-with-applescript.
Once you have the AppleScript written you can use the functions from the Apple Events VI API found here: http://zone.ni.com/reference/en-XX/help/371361K-01/lvcomm/appleevents_vis/ to interact with applications on OSX.
Not all applications can receive AppleScript and so you’ll need to use Script Editor on OSX to check which applications have this functionality (File -> Open Dictionary).


For example, you can use the AESend Open function to send your event to the Apple Event Manager to carry out your desired function.


I hope this helps with your query.


Best Regards,

0 Kudos
Message 2 of 2
(949 Views)