I always found myself readjusting the windows in InDesign to fit perfectly between all of my palettes. Below is a simple script that you can apply to a keyboard shortcut (in my case: Apple + Option + 0) that will position the window exactly where you want it. I like using this script so much that I want to use it in Illustrator as well. However, I can’t seem to find a window bounds property in the Illustrator dictionary. Any ideas?
This will give you the bounds of the front window to input in the second script:
tell application "Adobe InDesign CS2"
set old_bounds to bounds of front window
set bounds_string to ""
repeat with this_item in old_bounds
set bounds_string to bounds_string & this_item & " "
end repeat
display dialog "Your Window Bounds:" default answer bounds_string buttons {"OK"} default button 1
end tell
This script will position the front window. Edit the bounds values to your liking and assign it to a keyboard shortcut.
tell application "Adobe InDesign CS2"
set old_bounds to bounds of front window
set bounds of front window to {23, 209, 935, 1263}
end tell
The farthest i’ve gotten with Illustrator is:
tell application "Adobe Illustrator"
tell current document
set my_bounds to {23, 209, 935, 1263}
set my_props to properties of current view
set properties of current view to {bounds:my_bounds}
get properties of current view
end tell
end tell
so far as I can tell the only way to set a view is to set up per doc by way of making a new view but you would have to position the document and make the view every time.
pidge1,
Thanks for your help! Yes and no. The size is a 2 item list, but I found position as well that takes 2 values.
tell application "System Events"
tell process "Adobe Illustrator"
set size of windows to {400, 200}
set position of windows to {200, 20}
end tell
end tell
The result is a successfully resized and repositioned window, however the scroll bars don’t follow with the new size of the window. I get the following which doesn’t fix itself unless I resize the window with the mouse. Is there some sort of refresh for that window?
tell application "Adobe Illustrator"
activate
tell application "System Events"
tell process "Adobe Illustrator"
set size of windows to {400, 200}
set position to {200, 20}
keystroke "fff"
end tell
end tell
end tell
Here’s an update to handle both Illustrator and InDesign, I’m very happy now
tell application "System Events"
set active_app to processes whose frontmost is true
set app_name to name of first item of active_app
end tell
-- Illustrator
set illustrator to "Adobe Illustrator"
if app_name is illustrator then
tell application "System Events"
tell process illustrator
set size of windows to {1050, 912}
set position of windows to {212, 23}
delay 0.25 --time to release shortcut keys or the keystroke wont work
keystroke "fff"
end tell
end tell
end if
-- InDesign
set indesign to "Adobe InDesign CS2"
if app_name is indesign then
tell application indesign
set old_bounds to bounds of front window
set bounds of front window to {23, 209, 935, 1263}
end tell
end if