open v : Opens the specified item(s)
open specifier : the item(s) to open
[with properties record] : properties to be applied to the document when opening
‘bounds’ is a property of a window, not a document. You have to open the document first, and then set the bounds of its window
The project is opening up in another separate display. Not working, no error codes. It’s not a permissions issue. The project is opening just fine, just not in the proper location.
I’ve not tried it with another application. So I just tried it with TextEdit.
tell application "TextEdit" to open alpha with properties {bounds:{5282, -454, 7158, 495}}
It threw an error, so it couldn’t even open the file:
Expected end of line, etc. but found “{”.
I expanded that block and then got this:
TextEdit got an error: Can’t set bounds of document "alpha.rtf" to {5282, -454, 7158, 495}.
Not much of an error code. Permissions 777.
Yout script seems to work. However since I’m opening multiple files, Window 1 sticks with the first window. Can I not use the variable name theObject as a reference to its own window? I can change the name of second, third objects.
Anyway, you’ve just parked files into an array, then iterated through a method. That is just a refactoring. The issue here is apparently the project/window issue. How can I refer to the window of an object? I’ve accomplished it below, but I feel as if it’s a hack, relying on window 1 of what I have just recently opened.
Here’s what is working:
property monitor : "/Users/rich/Documents/BBEdit Projects/Dev_Monitor.bbprojectd"
property dev : "/Users/rich/Documents/BBEdit Projects/Dev.bbprojectd"
property issues : "/Users/rich/Documents/BBEdit Projects/issues_______d.bbprojectd"
tell application "BBEdit"
activate
open monitor
set bounds of window 1 to {5282, -454, 7158, 495}
open dev
set bounds of window 1 to {3840, 92, 5280, 2003}
open issues
set bounds of window 1 to {1502, 339, 3494, 1827}
end tell
My point is that I’d rather refer to the specific object instead of procedural remnants. Ultimately I’d iterate through windows, coupled with their default positions {x,y,dx,dy}, with a single open command with properties {i.position}.
Actually, I think it is the only the window as a property of a document that is read-only — i.e. you cannot arbitrarily mix and match documents and windows.
The window’s own properties can be set, including its bounds:
tell application "BBEdit"
set lizard to open monitor
--> text document 1 of application "BBEdit"
set dname to name of lizard
delay 4
set existing to bounds of window of lizard
--> {44, 88, 1053, 900}
set bounds of window dname to {100, 200, 500, 500}
end tell
Now you can sleep peacefully knowing specifically which window you are relocating. This allows you to bring a different window to the fore and still process the specified window.
Update: I had it wrong how it managed the state of the documents and windows. This should work though.