Copy link to clipboard
Copied
Hi all
I call a function by onClick function in a palette Window.
In this function i try to check "app.documents.length" and the result is 1
But, if I check "app.activeDocument" the result is "there is no document"
If I set a "MyDoc = app.documents[0]" and I check MyDoc.path, again the result is "there is no document" even if MyDoc is a document.
it's a nonsense
Someone can help me?
Copy link to clipboard
Copied
it doesn't work with palettes, only dialogs can do that. You only have one shot to do what you need to do...before you display the palette. Once it displays, it breaks the connection with the app.
Copy link to clipboard
Copied
In InDesign it works differently.
I need a non-modal window for my Tool.
No workaround I suppose.
The only way is to run the script every time, can I apply a shortcut to let the user start my script?
Copy link to clipboard
Copied
... also the customization of shortcuts to call my script is impossible.
Now I would like to customize the menu adding my own submenu that can call my script.
Someone knows if it is possible just lik in InDesign?
thanks
Copy link to clipboard
Copied
Adding a shortcut to scripts can be done by calling them from an action… Its a major let down in scripting this app and this too is plagued by a long time bug of the action forgetting the script path at quit… So it only lasts for the session… I was hoping that harb's scripbay was going to get shortcuts added as numerous people request it… I have been thinking of making a palette that shortcuts to the loaded scripts and add keyboard listener events to trigger them. The app should also have 'events' added to it. There is much that I wish was more like ID…
Copy link to clipboard
Copied
With Illustrator, you should use BridgeTalk in a palette Window, you function will be like this:
function onClick(){ var btMsg = new BridgeTalk(); btMsg.target = "illustrator"; btMsg.body = "app.activeDocument.save();";//or do something else. btMsg.onResult = function( resultMsg ) { $.writeln("Result = " + resultMsg.body); } btMsg.onError = function( errorMsg ) { $.writeln("Error = " + errorMsg.body); } btMsg.send(); }
Find more inspiration, events, and resources on the new Adobe Community
Explore Now