I am working on two functions, GetToolbar() and SetToolbar() to control Adobe Illustrator's toolbar panel in a much more efficient way and to implement features such as spring loaded tools, which illustrator still does not have.
I figured out everything I am just stuck on this error I that AutoHotkey is throwing at me:
The way both functions work, is that they associate a x and y (coordinates) value with each tool on the toolbar. Illustrator has about 90 tools, and I would like to declare all of them:
Attempting to run the above fails with Error:
I can run it if I shorten it to something like this:
It gets even worse in the case of getToolbar(), as I need to check what the active tools is and return a tool name, x, and y value back to the caller. But the expression runs over 50 lines long:
I solved it breaking the expression into parts using an if block but this is not desirable at all:
I searched quite a bit and have not turned up with anything. Is there a way forward here?
Thanks for any help.
I figured out everything I am just stuck on this error I that AutoHotkey is throwing at me:
CODE:
: ==> Expression too long
AutoHotkey closed for the following exit code: 2
The way both functions work, is that they associate a x and y (coordinates) value with each tool on the toolbar. Illustrator has about 90 tools, and I would like to declare all of them:
CODE:
setToolbar("Lasso")
setToolbar(toolName){
toolIndex:={"Selection":{x:17, y:47}
,"directSelection":{x:47, y:47}
,"groupSelection":{x:17, y:47}
,"MagicWand": {x:47, y:71}
,"Lasso" :{x:17, y:95}
,"Artboard" :{x:47, y:95}
,"FreeTransform": {x:17, y:119}
,"Pen" :{x:47, y:119}
,"AddAnchorPoint": {x:17, y:143}
,"DeleteAnchorPoint":{x:47, y:143}
,"AnchorPoint":{x:17, y:167}
,"Curvature" :{x:47, y:167}
,"LineSegment":{x:17, y:191}
,"Arc" :{x:47, y:191}
,"RectangularGrid":{x:17, y:215}
,"PolarGrid":{x:47, y:215}
,"Spiral" :{x:17, y:239}
,"Flare" :{x:47, y:239}
,"Rectangle":{x:17, y:263}
,"RoundedRectangle":{x:47, y:263}
,"Ellipse" :{x:17, y:287}
,"Star" :{x:47, y:287}
,"Polygon" :{x:17, y:311}
,"Type" :{x:47, y:311}
,"VerticalType": {x:17, y:335}
,"VerticalAreaType":{x:47, y:335}
,"TypeOnPath":{x:17, y:359}
,"TouchType":{x:47, y:359}
,"VerticalTypeOnPath":{x:17, y:383}
,"AreaType" :{x:47, y:383}
,"Pencil" :{x:17, y:407}
,"Paintbrush":{x:47, y:407}
,"PathEraser":{x:17, y:431}
,"BlobBrush":{x:47, y:431}
,"Smooth" :{x:17, y:455}
,"Shaper" :{x:47, y:455}
,"Join" :{x:17, y:479}
,"SymbolSprayer": {x:47, y:479}
,"SymbolShifter": {x:17, y:503}
,"SymbolScruncher":{x:47, y:503}
,"SymbolSizer":{x:17, y:527}
,"SymbolSpinner": {x:47, y:527}
,"SymbolStainer": {x:17, y:527}
,"SymbolScreener": {x:47, y:527}
,"SymbolStyler": {x:17, y:575}
,"ColumnGraph":{x:47, y:575}
,"StackedColumnGraph":{x:17, y:599}
,"BarGraph" :{x:47, y:599}
,"StackedBarGraph":{x:17, y:623}
,"LineGraph":{x:47, y:623}
,"AreaGraph":{x:17, y:647}
,"ScatterGraph": {x:47, y:647}
,"PieGraph" :{x:17, y:671}
,"RadarGraph":{x:47, y:671}
,"Slice" :{x:17, y:695}
,"SliceSelection": {x:47, y:695}
,"Rotate" :{x:17, y:719}
,"PerspectiveGrid":{x:47, y:719}
,"PerspectiveSelection":{x:17, y:743}
,"LivePaintSelection":{x:47, y:743}
,"Width" :{x:17, y:767}
,"Mesh" :{x:47, y:767}
,"Gradient" :{x:17, y:791}
,"Crystallize":{x:47, y:791}
,"ShapeBuilder": {x:17, y:815}
,"LivePaintBucke": {x:47, y:815}
,"PuppetWarp":{x:17, y:839}
,"Warp" :{x:17, y:839}
,"Reshape" :{x:17, y:863}
,"Twirl" :{x:17, y:863}
,"Reflect" :{x:17, y:887}
,"Scale" :{x:17, y:887}
,"Pucker" :{x:17, y:911}
,"Shear" :{x:17, y:911}
,"Bloat" :{x:17, y:935}
,"Scallop" :{x:17, y:935}
,"Eraser" :{x:17, y:959}
,"Eyedropper":{x:17, y:959}
,"Blend" :{x:17, y:983}
,"Scissors" :{x:17, y:983}
,"Knife" :{x:17, y:191}
,"Measure" :{x:17, y:191}
,"Wrinkle" :{x:17, y:1031}
,"RotateView":{x:17, y:1031}
,"PrintTiling" :{x:17, y:935}
,"Hand" :{x:17, y:935}
,"Zoom" :{x:17, y:1079}}
print(toolIndex[toolName].x, toolIndex[toolName].y) ; --> 17, 95
}
Attempting to run the above fails with Error:
CODE:
: ==> Expression too long
AutoHotkey closed for the following exit code: 2
I can run it if I shorten it to something like this:
CODE:
setToolbar("Lasso")
setToolbar(toolName){
toolIndex:={"Selection":{x:17, y:47}
,"directSelection":{x:47, y:47}
,"groupSelection":{x:17, y:47}
,"MagicWand": {x:47, y:71}
,"Lasso" :{x:17, y:95}
,"Artboard" :{x:47, y:95}}
print(toolIndex[toolName].x, toolIndex[toolName].y)
}
It gets even worse in the case of getToolbar(), as I need to check what the active tools is and return a tool name, x, and y value back to the caller. But the expression runs over 50 lines long:
CODE:
getToolbar(){
hwnd:= winExist("Toolbar ahk_class OWL.Dock ahk_exe Illustrator.exe")
pixel_getColor("ahk_id" hwnd, "BDBDBD",x, y)
activeTool:= (x = 17 && y = 47)? {tool : "Selection",x:17, y:47}
:(x = 47 && y = 47)? {tool : "directSelection",x:47, y:47}
:(x = 17 && y =71)? {tool : "groupSelection",x:17, y:47}
:(x = 47 && y =71)? {tool : "MagicWand", x:47, y:71}
:(x = 17 && y =95)? {tool : "Lasso", x:17, y:95}
....
....
:(x = 17 && y =1031)? {tool : "RotateView", x:17, y:1031}
:(x = 17 && y =935)? {tool : "PrintTiling", x:17, y:935}
:(x = 17 && y =935)? {tool : "Hand", x:17, y:935}
:(x = 17 && y =1079)? {tool: "Zoom", x:17, y:1079}
:""
return activeTool
}
I solved it breaking the expression into parts using an if block but this is not desirable at all:
CODE:
getToolbar(){
hwnd:= winExist("Toolbar ahk_class OWL.Dock ahk_exe Illustrator.exe")
pixel_getColor("ahk_id" hwnd, "BDBDBD",x, y)
activeTool:= (x = 17 && y = 47)? {tool : "Selection",x:17, y:47}
:(x = 47 && y = 47)? {tool : "directSelection",x:47, y:47}
:(x = 17 && y =71)? {tool : "groupSelection",x:17, y:47}
...
:(x = 17 && y =239)? {tool : "Spiral", x:17, y:239}
:(x = 47 && y =239)? {tool : "Flare", x:47, y:239}
if (!activeTool){
activeTool:= (x = 17 && y =263)? {tool : "Rectangle", x:17, y:263}
:(x = 47 && y =263)? {tool : "RoundedRectangle", x:47, y:263}
...
:(x = 17 && y =455)? {tool : "Smooth", x:17, y:455}
:(x = 47 && y =455)? {tool : "Shaper", x:47, y:455}
}if (!activeTool){
activeTool:=(x = 17 && y =479)? {tool : "Join", x:17, y:479}
:(x = 47 && y =479)? {tool : "SymbolSprayer", x:47, y:479}
...
:(x = 17 && y =671)? {tool : "PieGraph", x:17, y:671}
:(x = 47 && y =671)? {tool : "RadarGraph", x:47, y:671}
}if (!activeTool){
activeTool:=(x = 17 && y =695)? {tool : "Slice", x:17, y:695}
:(x = 47 && y =695)? {tool : "SliceSelection", x:47, y:695}
...
:(x = 17 && y =887)? {tool : "Reflect", x:17, y:887}
:(x = 17 && y =887)? {tool : "Scale", x:17, y:887}
}if (!activeTool){
activeTool:=(x = 17 && y =911)? {tool : "Pucker", x:17, y:911}
:(x = 17 && y =911)? {tool : "Shear", x:17, y:911}
....
:(x = 17 && y =1031)? {tool : "RotateView", x:17, y:1031}
:(x = 17 && y =1079)? {tool: "Zoom", x:17, y:1079}
:""
}
return activeTool
}
I searched quite a bit and have not turned up with anything. Is there a way forward here?
Thanks for any help.
Statistics: Posted by Ralf_Reddings200244 — Today, 15:33