Copy link to clipboard
Copied
Hello,
From what I understand, you can't call complex functions from a scripted UI palette, only from "dialog" windows (which are usless in my case) because I need the persistance of a palette.
I have a series of scripts in use now that are accessed from the usual "file-scripts folder" within Illustrator itself (about 27 of them). I want to script a palette window so users can acces them without the usual mouse clicks down the menu system.
I'm able to call a simple "Hello World" type function using the "onClick()" method from a button of a scripted palette window, but I cannot use my regular working scripts inside a function that's called from the button. In X-Code, I was able to write my scripts individually, then just add them to a main floating window via a separate function when they were completed. But, I'm finding Javascript a little more tricky.
If I copy my other's script code into the function in the palette window script, it runs, but it runs before I click the button! -- After in runs, then the palette window is displayed(?). If I try to use the execute() method with "onClick", the script just opens in the SDK, it will not and does run in Illustrator.
I take both of these as clear indications that I have no clue what I'm doing (or that I'm trying to do the impossible).
I did find someone with a similar problem, but they were scripting After Effects and were offered this solution:
system.callSystem ('afterfx -r "/C/Program Files/Adobe/Adobe After Effects CS3/Support Files/Scripts/GlobalVars.jsx"');
Is there anything I can do in Illustrator that will allow me to call (or execute) my other scripts/functions and have them execute within Illustrator?
Thanks for any and all help!
Well, here it is!!
I found this link:
http://www.davidebarranca.com/2012/11/scriptui-bridgetalk-persistent-window-examples/
(If you stumble on this by chance, thank you davide barranca!)
Now, I can make changes to the scripts in just one location and everyone will get the updates once they restart their window.
Works like a charm and is just what I was needing! Thank you all again for your help!
#target illustrator
var scriptToLoad = new File("S:/NEW SCRIPTS/JAVASCRIPTS IN USE NOW/02) Make/01b) Shap
...Copy link to clipboard
Copied
Also, how can I get the input from this text field and launch a script containing that value? I have a working script now that searches an incoming art depository folder based on the first 7 digits of the filename and opens it in Illustrator for the artist to work on. **ex. 1234567-Bob's Car Wash.ai.
if your working script has something like this
var searchString = '1234567';
to get the input from the edittext,
var editSearchString = w.add('edittext', undefined, ........
var searchString = editSearchString.text;
Copy link to clipboard
Copied
Cool, thanks.... I'll put it into practice today.
Copy link to clipboard
Copied
I need to somehow trigger the script with the information entered into the "eddittext" field, after they are finished entering the data. I know a dialog window returns this value when it's closed. How do I grab the input in and run another script while the palette window is open?
Copy link to clipboard
Copied
how does the script know you have finished entering data? either you run your script pushing a button, or when something happen. If you need the latter, then you need to at least Tab your way out of the edittext, use the onChange or onDeactivate events.
Copy link to clipboard
Copied
Decided to use just buttons to call the already written search scripts as well. It's coming along.. 27 scripts added so far for different functions of artwork production
Copy link to clipboard
Copied
wow, look at you, nice job. how is it working so far? are all existing scripts working fine via BridgeTalk without modifications? if so, they're all one way, right? they don't return values from illustrator.
oh, how does it compare to script bay?
Copy link to clipboard
Copied
It works great. In fact, the BT code examples you supplied combined with Davide's load and unload commands have worked wonders. All my existing scripts have run right out of the gate with just a few exceptions, mainly in the "for/while" loops. Mostly, this has dealt with the original scripts being written to perform a certain function only. They were developed with each one standing on it's own without interaction with the others. Now, the panel has become the focal point for them. With minor adjustments, all buttons on the panel now call their respestive scripts, but will also need more error-checking in each to insure a smooth transaction into the next script in line. I can now just blow through customer's art like a lightning bolt, but the next phase will focus on combining certain related scripts into 1 flow from start to finish. My only concern now is learning how to lay out the panel to except the many more scripts to come using the manual layout instead of automatic. My fear is if I continue to add buttons on a routine basis, just the upkeep on the panel itself might be a pain. But, I can always have more than one panel running, can't I? I could then separate the scripts into their own panels based on function, kinda like the panels/groups are laid out now (I hope). I can see this panel thing not only being a launchpad for scripts now, but also a main work window that links to everything on the computer that deals with workflow, based on what is needed at the time. Nice job security, no?
Script Bay is nice b/c it locks into your other palettes and stays put. And, you can create folders that perform just the scripts in that folder in order. So, you can mix/match your scripts based on need. It's an action palette for scripts, basically. I can't believe someone hasn't picked up on it commercially and released a high-end extension.
Thanks again, man! You're a lifesaver!
Klemango
Copy link to clipboard
Copied
excellent, yes you can have more than one panel open, or you can have a radio buttons that hide/show portions of your panel
Nice job security, no?
right
Copy link to clipboard
Copied
Nice..... Now this is getting fun!
Copy link to clipboard
Copied
klemango wrote:
Nice job security, no?
Oh... so thats why Script Bay was not desired.
You could also maybe consider coding a list (scrollable), or tree (collapsable/expandable) as the interface, along with a single button under the list that calls the execution after you select something. This would save room and allow it to grow as the content continues to expand as you add more scripts, while keeping this main script palette window always the same size. You would also be able to label, sort, divide/arrange the scripts into categories much like you have presently for organization.
Copy link to clipboard
Copied
good idea
Copy link to clipboard
Copied
Yeah, to me either of those (list/tree) would offer the easiest extensibility and allow for rapidly expanding/editing this type of custom script launching window with variable content/scripts. I think either would offer rapid extensibility as well as maintenance, without all the hassle of laying out a bunch of normal buttons, etc., you could always spruce up the window and or list/tree look otherwise I guess if the appearance is important to you.