Reply to topic  [ 6 posts ] 
Accessing Applescript Script Libraries? 
Author Message

Joined: 2013-05-03 07:06:31
Posts: 103
Is there a way to access Applescript Script Libraries from Nisus? I have a Script Library that installed in ~/Library/Script Libraries/ and an applescript file that uses it.

One neat thing about Nisus is that it runs Applescript sctp files directly. But while my script runs fine outside of Nisus, inside of nisus it's not working; and I can only assume it's because Nisus running applescript does not open script libraries?

I hope that's not true, I really do. I'd love to have a large applescript library to use with short and sweet Applescript commands in Nisus code. Particularly since Yosemite you can use applescript-objC code from Applescript running in Nisus.


2017-03-27 13:58:08
Profile

Joined: 2013-05-03 07:06:31
Posts: 103
Also, how can you pass information to your applescript? Like, say, an array or dictionary?


2017-03-27 15:45:44
Profile
User avatar

Joined: 2007-02-07 00:58:12
Posts: 876
Location: Japan
There are no simple answers here, especially since sandboxing has interrupted a lot of the back and forth that used to be possible between Nisus and AppleScript. In particular Nisus cannot use AppleScript to access other applications.

If your AppleScript is self-contained you can just make it a service, and then it will be available in the Service menu. For more on this see the previous discussion viewtopic.php?f=17&t=5948

Passing values to AppleScript from Nisus is usually done by constructing a string of the form "set myValue to x" and then running it as an AppleScript.
Another method is to pass values via the clipboard.

If you wanted to pass an array to AppleScript, you could probably use the ".join" command in Nisus, pass it as a single value, and then split it in AppleScript. I've never tried this though.

Going the other way, from AppleScript to Nisus, you usually make heavy use of the "Do Menu Macro with macro" command in AppleScript. My general preference is to write as much of the macro as possible in Nisus, but it really depends on the problem.

_________________
philip


2017-03-27 19:39:13
Profile

Joined: 2013-05-03 07:06:31
Posts: 103
Thanks phspaelti. I kind of thought that was the case. Transferring information back and forth between Applescript and Nisus seems harder than it should be. Also, the "Send Selector" command is very limited, correct? We cannot send any arguments with our selector or use multiple argument selectors?

Among other things, I'm contemplating building a series of custom dialogs. Nisus's macro language cannot do that, so I have to resort to Applescript (and ApplescriptObjC) and pass values back and forth.

Is each call to "Run Applescript" self contained, or does each call stand alone, and I'd have to repeat all setup code?


2017-03-28 05:19:53
Profile
Official Nisus Person
User avatar

Joined: 2002-07-11 17:14:10
Posts: 4251
Location: San Diego, CA
Vanceone wrote:
Also, the "Send Selector" command is very limited, correct? We cannot send any arguments with our selector or use multiple argument selectors?

That's correct, the "Send Selector" command in the Nisus Macro Language cannot pass arguments, or use multiple argument selectors. It was really only intended to allow macros to trigger AppKit action methods like -deleteToEndOfLine:

Quote:
Is each call to "Run Applescript" self contained, or does each call stand alone, and I'd have to repeat all setup code?

Each call to "Run Applescript" is compiled and run independently via separate NSAppleScript instances, so you'll have to repeat any setup/teardown code.


2017-05-11 16:22:11
Profile WWW

Joined: 2006-03-12 12:32:47
Posts: 138
This module loader OSAX might be able to circumvent sandboxing:

http://www.script-factory.net/software/ ... index.html


2017-09-07 17:12:06
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 6 posts ] 

Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group
Designed by ST Software