and..Change Properties Values

Is there any way I can change property values in a script that when run again the properties are set to the new properties.

ie

When theScript first run property one :1
When theScript second run property one :2

Thanks. Not sure whether this is possible

Hello.

If you return from your script, then the property would be saved, it is was run through a script runner, like the applescript runner, that executes your script from the commandline.

Some applications, (like quicksilver) use their own scriptrunner that doesn’t save new property values back to the script.

So, I’d rather save a script with the precious properties to disk, and reload them afterwards, if that is the case.

Here is a little snippet you may modify:

global scriptpath
global cachespath

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

Here is the piece that saves the values back to disk:

store script flow_window in scriptpath replacing yes

If you’re using load script command you need to store the script back to the file. Because load script command is loading an instance of the script object stored in the file.

McUSRLL

How long does the system hold the files in the temp folder? Until a reboot and how long in the cache folder

Thanks

Hello.

The will be deleted in the temporary folder, at least after the wolf has howled 20 times at the moon. It did happen to me, But nothing has ever been deleted from the caches folder, but you may actually want to delete the contents of a caches folder, if you are experiencing hardware/ software trouble, so to be absolutely sure that you keep the script values at all times, I’d save the script values within the Document’s folder.

Folder from temporary items are removed when you aren’t using the user domain

path to temporary items --will be removed after reboot
path to temporary items from system domain --same folder as above
path to temporary items from local domain --same folder as above
path to temporary items from user domain --this is an cache folder, not temporary as the name suggest,  data will not be removed from here but don't is it as an support folder. 

Note:
¢ An temporary folder is an folder with data that is needed in a singe run of the applications
¢ An cache folder is an folder that contains data that is needed between runs of applications but can be removed at any given time on the fly without messing up the software that is using this data. Temporary folder can’t be removed on the fly
¢ for persistent and required data there is an third folder named “Application Support”, here you should store data that shouldn’t be removed and will be stored there by the application or an installer.

Hello

I know for sure that sometimes “path to temporary items from user domain” gets purged, and then you realize that nothing that were in it, ever made it to the Time Machine. Be warned. :slight_smile:

Read my notes about using these folders and what their purpose are, that shouldn’t be a problem at all with good written software.

Hello DJ.

I read your note, I still felt it was in place with a warning about using it for anything but temporary items, that are supposed to last during the run of a program. :slight_smile:

Because occacionally the folder with temporary items from user domain gets wiped out.