Hello
This is just a little practical method of storing values for your script I have put in two paths there, which both serves different purposes, given the nature of your script, if the values are to be sustained, but can be reproduced, then library caches, is the obvious place to save your scripts properties. If it is a one off example, like it really is for the given example. Then the temporary items folder is the obvious place.
I fiddled with this, really not having a standardized place to store script values, and finally saw Daniel Jalkut use this, and I found this to be a great idea!
The reason for storing script values, is for those scripts not being run by a script runner that saves values, like quick silver for instance.
The script I show you, is not made by me, it is made by jon8 but I have added the code, to make it persistent when running Quicksilver, and as such must surely be edited, as the values within for the screen resolution are mine, and hardcoded!
The point here is the pattern for retrieving and storing values, and not the script
global scriptpath
global cachespath
-- the script as such is copyright jonn8
-- I have used used it to illustrate the way to store and retrieve values painlessly
-- having no better example to whip up at the moment
set scriptpath to (path to temporary items folder from user domain as text) & "net.mcusr.coverflowvals"
set cachespath to (path to library folder from user domain as text) & "caches:" & "net.mcusr.coverflowvals"
try
set flow_window to load script alias scriptpath
on error
script coverflowVals
property original_bounds : missing value
property original_view : missing value
end script
set flow_window to coverflowVals
end try
if my flow_window's original_bounds = missing value then
my expand_window()
else
my revert_window()
end if
store script flow_window in scriptpath replacing yes
on expand_window()
tell application "Finder"
activate
try
if class of window 1 is not Finder window then return
tell Finder window 1
set my flow_window's original_bounds to (get bounds)
set my flow_window's original_view to (get current view)
set bounds to {0, 44, 1680, 1050}
set current view to flow view
end tell
end try
end tell
end expand_window
on revert_window()
tell application "Finder"
activate
try
if class of window 1 is Finder window then
tell Finder window 1
set bounds to my flow_window's original_bounds
set current view to my flow_window's original_view
end tell
end if
end try
end tell
set my flow_window's original_bounds to missing value
set my flow_window's original_view to missing value
end revert_window