Copy link to clipboard
Copied
Hello
I have an appleScript for setting the bounds of an InDesign window and tried to adapt it for Illustrator, but it won't work. Can anyone help with this? I have two scripts which work in InDesign:
Script 1:
tell application "Adobe InDesign CS6"
activate
tell active window
set bounds to {100, 1280, 1412, 2548}
end tell
end tell
Script 2:
tell application "Adobe InDesign CS6"
activate
tell window 1
set bounds of window 1 to {105, 8, 1417, 2548}
end tell
end tell
Thx for any help
@ Qwertyfly, what an obscure document method, nice find.
// --------------
@ James, as i mentioned above, positioning the window is not an issue (at least when using System Events), however setting size, bounds etc., seem to have no effect on AI documents and error.
Quick test, position works, size does not:
tell application "System Events" to tell process "Adobe Illustrator"
set position of front window to {500, 120}
set size of front window to {500, 500}
end tell
However, getting the size wo
...Copy link to clipboard
Copied
I am not saying it can or can't be done, however InDesign, PhotoShop, etc., have far many more scripted capabilities than Illustrator. I can target Illustrator and position the window, however I can not seem to size/resize the window regardless of attempts concerning Illustrator. Does not seem promising.
Copy link to clipboard
Copied
It's been a really long time since i have worked with applescript, but a quick search and some testing leads me to believe you cannot do this. It looks like we simply don't have access to the window object. i was unable to read or write that information.
This is perplexing because the code you have written up there works for just about any other application. this may be another case of adobe simply slacking off when it comes to giving us access to the most basic of features via script...
I hope you find what you're looking for. I'm curious myself.
Copy link to clipboard
Copied
I know nothing about apple script, but in javascript you can do this kinda.
you can set the size of the window, but not its position, as far as I know.
the trick is to do a windowCapture. then just delete the capture.
size is in points and is [Width,Height]
var file = new File("~/capcap.tiff");
var size = [500,500];
app.activeDocument.windowCapture(file,size);
file.remove();
Copy link to clipboard
Copied
Thanks, I have tested out your script and it does resize the window (and I might use that script sometime) but I need to place the document left half screen, centre screen, other screen, etc - just as I can with Safari, InDesign and Acrobat, Excel & Word too.
I have checked out the AppleScript Reference for Illustrator and tried a few variations on "active window" and some commands, but nothing works. And most of the commands (for example for "properties") reveal "read only" results, so i cannot change the geometric bounds of an item, or artboard. I'm afraid I have the most basic of knowledge of JavaScript
Sigh.
Looks like I'll just have to make do with Divvy, though I have noticed that Illustrator remembers window size and position when I next open a document, so that's a bit helpful.
Thank you all for replying - and maybe the Adobe guys can think of adding setting window bounds to AppleScript, JavaScript for Illustrator. And making most of the other results not just "read only" where appropriate.
Copy link to clipboard
Copied
@ Qwertyfly, what an obscure document method, nice find.
// --------------
@ James, as i mentioned above, positioning the window is not an issue (at least when using System Events), however setting size, bounds etc., seem to have no effect on AI documents and error.
Quick test, position works, size does not:
tell application "System Events" to tell process "Adobe Illustrator"
set position of front window to {500, 120}
set size of front window to {500, 500}
end tell
However, getting the size works (but setting does not) ?
tell application "System Events" to tell process "Adobe Illustrator"
get size of front window
end tell
Strange.
Have you tried asking over at macscripter.net forums or the Apple scripting forums? If you find something out keep us posted.
Copy link to clipboard
Copied
Thank you very much. This script works for what I need. I just set the parameters and there is my Illustrator document in the right position.
I found that both size and position worked. I set the position, then the size. The "get size" gives me the size I need after I have set it up. Using Script Debugger.
Copy link to clipboard
Copied
Glad it proved helpful to your efforts.
jamesf14917918 wrote: I found that both size and position worked.
That's good (interesting), curious what OS X version you running with CS6?
Copy link to clipboard
Copied
I am using Yosemite as CS6 InDesign does not work properly with El Capitain and, unless it is a fix Apple must do, then I'll be stuck with Yosemite for my work Mac. I'd rather go back to Quark than use CC.
I have just discovered though that my two old Apple monitors which my work Mac will no longer tolerate, work really well with Mountain Lion, so I may set my old Mac as my work Mac; all my work apps are OK in Mountain Lion too. Then I can instal El C on my latest Mac.
Copy link to clipboard
Copied
new to CC you can set how documents are arranged. if that helps at all?
again in JS.
app.documents.arrange(DocumentLayoutStyle.VERTICALTILE);
Copy link to clipboard
Copied
I'm still with CS6. The JS tile will be handy for something else, but the two AppleScripts provided by W_J_T have solved my problem.
For years I have had two screens but alas I am reduced to one smaller than my 30" screen, so I have had to find quick ways of rearranging the various app windows in a much smaller screen space.
Thx to all who contributed. I have learned much more than what I asked.
Copy link to clipboard
Copied
Qwerty, how does this even work! And how did you find out about it? What a weird find indeed! I gotta try this out for fun soon.
Copy link to clipboard
Copied
Object Model Viewer, and I searched for "window".
did not get what I wanted, not that I thought I would, but saw windowCapture and thought "what the $#*& is that".
i tend to do random searches very often when I am thinking about how to achieve something that does not just come to me.
I think I would actually have use of this if it did not resize the window. LOL
Copy link to clipboard
Copied
Qwertyfly... wrote:
I know nothing about apple script, but in javascript you can do this kinda.
you can set the size of the window, but not its position, as far as I know.
the trick is to do a windowCapture. then just delete the capture.
size is in points and is [Width,Height]
var file = new File("~/capcap.tiff"); var size = [500,500]; app.activeDocument.windowCapture(file,size); file.remove();
?? whatta? cool!!
Copy link to clipboard
Copied
to find something Carlos had not explored.
now that is cool!
Copy link to clipboard
Copied
I am just thrilled to see Carlos, we miss you man, hope you are well.
// ------------
For window resizing purposes only, you can even just pass an empty file reference:
app.activeDocument.windowCapture(new File(null), [500, 500]);
Copy link to clipboard
Copied
I'm well thanks, just been busy lately. I don't post much but I'm watching you all take good care of the visitors ![]()
miss you all.
Copy link to clipboard
Copied
nice add WJT,
i was wondering if that may be possible, but had not tried it.
now we have it all in a nice neat 1 liner.
Copy link to clipboard
Copied
Not knowing anything about JavaScript I tried adding
var position = [150,150]
but I did not know how to add it to the rest of the script.
Probably there is no "position" command? Is there an equivalent?
If so, then I'll be able to set both size and position using JS.
Also, I have discovered to use the AS version I need to add Illustrator to the Assistive Devices list before the script would work.
Copy link to clipboard
Copied
Yeah I enabled Assistive Devices long ago for scripting, never thought about it. In regards to position, that is not exposed/accessible regarding "document windows" to my knowledge.
----
EDIT: "Currently being moderated." <-- Why are my posts being moderated before appearing on the forum?
Copy link to clipboard
Copied
first time you have a post moderated? you've been lucky, all posts go thru a new plugin in an attempt to fight spam. Then humans check and release each one.
Copy link to clipboard
Copied
Interesting that a forum about automation now requires human intervention for every post.
Copy link to clipboard
Copied
the plugin seems to be doing a good job at catching spam, and it also catches some post that are not spam, most of regular post are processed and released by the plugin.
if a post has html links, it will most likely go to moderation
Copy link to clipboard
Copied
I noticed it a lot in the last few days, I thought maybe it came back to my disdain towards CC when it was first released and they were finally trying to get rid of me (kidding?). I did notice a ton of spam posts in the Illustrator forum lately, looks like the plugin and people are still in ongoing beta still like CC?
-----

Edit: Still, I must be blacklisted.
Copy link to clipboard
Copied
Yeah I remember those dark days, but no, Moderation has nothing to do with any one in particular.
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more