I decided to rewrite a frequently-used script. This turned out to be a bad idea and I’ve gone back to the original version. However, it raised a question about the use of a reserved word in a record, and I wondered if there’s a way to use Numbers as a label in the following script:
tell application "System Events" to set activeApp to name of first process whose frontmost is true
set windowData to "{Finder:{375, 33, 1170, 700}, FSNotes:{560, 33, 800, 680}, Mail:{480, 33, 960, 855}, Numbers:{1092,23,828,1057}, Preview:{460, 33, 1000, 1037}, Safari:{160, 23, 1600, 1057}, Soulver:{1410, 33, 500, 450}}"
try
set {x, y, w, h} to (run script activeApp & " of " & windowData)
on error
set {x, y, w, h} to {510, 33, 900, 750}
end try
tell application "System Events" to tell process activeApp to tell window 1
set position to {x, y}
set size to {w, h}
end tell
I thought enclosing Numbers in pipes in the record would do the job but it didn’t. The easy workaround was rewrite the script to use Numbers_App instead of Numbers in the script, but I’m still curious. I also wanted to use Script Editor as a label but that didn’t work because of the space.