Copy link to clipboard
Copied
Script Slot, It makes custom menu in Illustrators window menu and make some slot that you can set Javascript(Extendscript) and Applescript(application) file and add shortcut key combination like below.
This beta test version supports Illustrator CC 2014/2015, OSX10.9 and later.
You can download it: https://goo.gl/HZ05VE
Copy link to clipboard
Copied
Looks like a very useful & robust script panel indeed! However, on my Win7 CC2015, it does not appear in the Window > Extensions menu item even after restarts.
Copy link to clipboard
Copied
Apology to late Windows version.
Extension supports both OS X and Win, But ScriptSlot plugin do not support Windows yet.
I'll make it next few weeks. Please wait to release Windows version.
Copy link to clipboard
Copied
Post back once you have the Win version up and running.
I will happily beta test in a production environment.
PS. are you using HTML and CEP or C++?
I have been trying to get my head around Extensions,
each time I dig in to the SDK I come out a little more confused.
had better luck with HTML panels, but am finding callbacks are not working as I would expect.
probably an issue with the programmer (me).
Copy link to clipboard
Copied
My Extension is hybrid.
There no way to access Apps menu from Extendscript and HTML Extensions, Only way to do it using Illustrator SDK. However, Illustrator SDK dosen't have a way to access Scripting DOM.
The Extension contains plugin that manipurate Illustrator's menu and dispatch event to Extension.
Once select Slot menu, The plugin dispatch event. The Extension can catch the event and call Scripting engine.
Probably, It is rare case and generally speaking, most extensions don't need Illustrator SDK and C++.
Below code suggests how to call and get messages between HTML and Extendscript functions, You can read as reference:
Copy link to clipboard
Copied
I have not been using the JSX CSXSEvents to trigger the JS. I was just using CSInterface from JS to access Illustrator directly.
And as I was being lazy( I have not had a chance to study up on JSON, I have not used it before) i can only pass a string and not an object.
i was trying to do something like this: (not sure that nested callbacks is a good idea, and I guess I should just read up on JSON as I am sure its not that hard)
var CSI = new CSInterface();
var br = window.document.getElementById("br");
br.onclick = function(){
CSI.evalScript("app.activeDocument.brushes.length", function(qty){
var Box = window.document.getElementById("brushgroup");
for(var i=0; i<qty; i++){
var newButton = window.document.createElement("input");
newButton.setAttribute('type', 'submit');
newButton.setAttribute('class', 'button');
newButton.setAttribute('id', 'br' + i);
Box.appendChild(newButton);
//now we need to get the brush name
var js = "app.activeDocument.brushes["+i+"].name";
CSI.evalScript(js, function(name){
var butt = window.document.getElementById("br" + i);
butt.setAttribute('value', name);
});
}
});
}
when testing it seems not to run the second evalScript more than once. and will not update the HTML Attribute.
Like I said, it's prob a silly syntax issue I have not seen or understood.
Copy link to clipboard
Copied
Here is an working sample code:
index.html
<?xml version="1.0"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script src="../js/libs/CSInterface.js"></script>
<link rel="stylesheet" type="text/css" href="../css/test.css"/>
</head>
<body>
<div id="btn"><button id="bt" onclick="getbt();">Get Info</button></div><br />
<div id="message" class="messe_bdy"></div>
</body>
<script src="../js/main.js"></script>
</html>
main.js
var CSI = new CSInterface();
function getbt(){
CSI.evalScript("app.activeDocument.brushes.length", function(qty){
var str = "";
for(var i=0; i<qty; i++){
var js = "app.activeDocument.brushes["+i+"].name";
CSI.evalScript(js, set);
}
});
}
function set (nm) {
var st
st = "<button type='submit' class='button' id='" + nm + "'>" + nm + "</button><br />";
var str = document.getElementById("message").innerHTML;
document.getElementById("message").innerHTML = str +st;
}
CEP HTML Engine contain V8 Javascript Engine and codes work asynchronously.
When 2nd evalScript returns string, for loop aleady finished and get incorrect counter value.
Copy link to clipboard
Copied
you rock,
Thank you so much for the insight.
I'll be having a play with this today so I can really get my head around it.
the asynchronous running of the separate calls explains a lot.
I can't thank you enough.
looking forward to your windows compatible version.
and maybe picking your brain again at a later date.
Copy link to clipboard
Copied
Just want to say thanks again,
I got this adapted to my needs and understand how your approach differed from my attempt.
you have helped me a lot.
Copy link to clipboard
Copied
i downloaded and installed. I can set the sripts just fine, but how do i set the shortcut???
Copy link to clipboard
Copied
Thank you for testing ScriptSlot.
You can set shortcut key navigate Edit->Keyboard Shortcut.
Script Slot in Window menu like below:
Copy link to clipboard
Copied
If it will work under windows, it would be very-very-very usefull.
I have my own dumbish workaround, using AutoHotKey and intence sorting-renaming scripts.
Each script I use is renamed like this:
0 Do Cool Stuff.jsx
2 Apply Magic.jsx
...
9 Almost Colossal
A Turn to Alphabet
and so on.
All scripts divede by groups and folders' names have hotletters in them like this:
Cl&ean
Co&ntrol
Colors
This allows me to summon scripts using only keyboard:
Alt+F, R, E (for going into 'Cl&ean'), 2 (the number of sript needed)
Then I have permanent AHK-script running, which folds these long chords into small Win+Z, for example.
The piece of the script looks like this:
#NoEnv
#Persistent
#SingleInstance force
SetKeyDelay, -1
#IfWinActive, ahk_class illustrator
#vk5A:: ;z zoom to selection
SendMessage, 0x50, , 0x4090409, , ahk_class illustrator
send {alt down}{f}{alt up}
send {r}{v}{3}
return
...
#IfWinActive
It flickers for a second, but it works.
Copy link to clipboard
Copied
I love AHK...
It saves me hours a day.
I always have around 5 or 6 running
Copy link to clipboard
Copied
I have one fat script that includes everything I need.
Copy link to clipboard
Copied
I have a few only because I don't run them all all the time.
also a few are run on a number of machines, so simpler to maintain from separate files
Copy link to clipboard
Copied
I'm getting this error message upon opening illustrator, and I don't have the option in Edit>Keyboard Shortcuts to manipulate Script Slot.
Mac OSX 10.11.1
Illustrator CC 2014 18.0.0
error message:
Copy link to clipboard
Copied
Please update your Illustrator 18.0 to 18.1.
Copy link to clipboard
Copied
Thanks, Ten. I'll definitely take care of that Monday morning. As long as I don't have to go up to CC 2015, i'll be a happy camper. Some of my team did that update when it came out and it broke a TON of stuff in our process. But everyone has been begging me for some sort of hotkey access to the scripts i'm providing for them, so you may have really saved the day here. I know i speak for everyone here when i say thank you for your time and effort in building this extension. We really do appreciate it. 😃
Copy link to clipboard
Copied
Hi, all.
Now, ScriptSlot beta 2 available both Windows and Mac.
You can download below link:
Copy link to clipboard
Copied
great, thanks for sharing Ten A
Copy link to clipboard
Copied
ooooh, a christmas present from Ten A,
I'll unwrap it today and give it a try.
Thanks again.
Copy link to clipboard
Copied
Hi, Qwertyfly, CarlosCanto.
Thank you for testing and apology to late. It was difficult to setup Visulal Studio works correctly in my environment. But, Finally I got it work!
Try it and have fun!
Copy link to clipboard
Copied
you're welcome,
for those that haven't been here long enough, I posted (seemingly ages ago) these other ways to access scripts on windows, no programming required
[TUTORIAL] ADD YOUR OWN KEYBOARD SHORTCUTS TO YOUR JSX SCRIPTS
Copy link to clipboard
Copied
Script Slot beta f2(probably, it's a final test version) available below:
ScriptSlot_betaFinal_2.zip - Google Drive
Add to support VB Script and fix some encoding issues in panel and menu.
We can save and restore script set using below code:
function saveSlots() {
var f = File.saveDialog("Save Quick Loader File...");
if (f.open('w')) {
var slots = ["slot0","slot1","slot2","slot3","slot4","slot5"];
for (var i=0;i<6;i++) {
f.writeln(app.preferences.getStringPreference("scriptSlot/" + slots));
}
f.close();
}
else alert("Save Error...");
}
function loadSlots() {
var f = File.openDialog("Select Quick Loader File.");
if (f.open("r")) {
var os = ($.os.indexOf("Macintosh")>-1);
var dlm = "/";
if (!os) dlm = "\\";
var pth = "";
var slots = ["slot0","slot1","slot2","slot3","slot4","slot5"];
for (var i=0;i<6;i++) {
pth = f.readln();
app.preferences.setStringPreference("scriptSlot/" + slots, pth);
app.sendScriptMessage("ScriptSlot", slots, pth.split(dlm).pop());
}
}
else alert("Quick Loader READ ERROR.");
}
var w = new Window("dialog",undefined);
var bt1 = w.add("button",undefined,"Save");
var bt2 = w.add("button",undefined,"Load");
bt1.onClick = function(){saveSlots();w.close();}
bt2.onClick = function(){loadSlots();w.close();}
w.show();
issue : We can't access ScriptSlot panels interface from Extendscript, so we can't update panels value. However, slots script names are updated correctly and works fine and will reload correct list when you restart Illustrator.