Results 1 to 1 of 1
-
03-09-2009, 01:41 AM #1
- Member Since
- Aug 28, 2008
- Posts
- 42
- Specs:
- Black MB - 2.4 GHz Intel Core 2 Duo - 4 GB DDR2 SDRAM - OSX 10.5.8
save container variable to file in applescript?
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?
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Similar Threads
-
Set variable to output of text field- xcode 4.5, applescript
By dhmmjoph in forum macOS - Development and DarwinReplies: 15Last Post: 02-03-2013, 04:13 PM -
Applescript Curl and Variable Help
By FallenAsh in forum macOS - Development and DarwinReplies: 3Last Post: 01-06-2013, 01:59 PM -
edit XML file using variable in shell script.
By jc6 in forum macOS - Development and DarwinReplies: 1Last Post: 10-23-2010, 06:36 PM -
Can't save photos because of applescript error
By Noels in forum macOS - Operating SystemReplies: 1Last Post: 03-25-2008, 04:29 PM -
How to save an icon I am designing in Photoshop, What file extension do I save as?
By GT5.0 in forum Images, Graphic Design, and Digital PhotographyReplies: 8Last Post: 07-01-2006, 07:24 PM