- Joined
- Aug 28, 2008
- Messages
- 42
- Reaction score
- 0
- Points
- 6
- Your Mac's Specs
- Black MB - 2.4 GHz Intel Core 2 Duo - 4 GB DDR2 SDRAM - OSX 10.5.8
I'm a noob trying to write my second script, and I'm having trouble with this one, seemingly simple bit. I need to save a list, so it can be accessed when the script runs again, but I can't get it to work.
The script checks for a certain file. If the file doesn't exist, it gets the bounds of the active window, creates the file and saves the bounds to it. If the file does exist it's supposed to use the bounds I saved to set the bounds of the active window, and then it deletes the file so it can do the same thing again.
This is how I'm writing to the file:
set sizefile to open for access file sizefilepath with write permission
write orig to sizefile
close access sizefile
When I save it to a text file, instead of something like {94, 24, 815, 785} I get "list long^long long /long." If I tell it to write as a list, I get the same. If I tell it to write as a string, I get an error. I tried using "quoted form of" but that gives me an error too. Then I tried writing each item individually as an integer, but instead of numbers I get letters and special characters...I tried about a thousand more things, but I have no idea what I'm doing.
This is how I'm reading the file:
set orig to (read file sizefilepath)
do shell script "rm " & quoted form of sizefileposix
tell application frontapp
set bounds of window 1 to orig
end tell
It's getting frustrating....help please?
The script checks for a certain file. If the file doesn't exist, it gets the bounds of the active window, creates the file and saves the bounds to it. If the file does exist it's supposed to use the bounds I saved to set the bounds of the active window, and then it deletes the file so it can do the same thing again.
This is how I'm writing to the file:
set sizefile to open for access file sizefilepath with write permission
write orig to sizefile
close access sizefile
When I save it to a text file, instead of something like {94, 24, 815, 785} I get "list long^long long /long." If I tell it to write as a list, I get the same. If I tell it to write as a string, I get an error. I tried using "quoted form of" but that gives me an error too. Then I tried writing each item individually as an integer, but instead of numbers I get letters and special characters...I tried about a thousand more things, but I have no idea what I'm doing.
This is how I'm reading the file:
set orig to (read file sizefilepath)
do shell script "rm " & quoted form of sizefileposix
tell application frontapp
set bounds of window 1 to orig
end tell
It's getting frustrating....help please?