How i can write and read script preferences?

Hi all!

I need a script whose can read and write own preferences to the file.

For example

  1. If start as applet user can enter a values for some variables, and save its to the file.
  2. If start as droplet read values from the file, then run.

For examples:

property currentTIFFResolution : missing value

on run
set tempResolution to display dialog “Choose resolution DPI:” default answer “”
set currentTIFFResolution to text returned of tempResolution as text
– here i need to save new value to the file
end run

on open droppeditems

– here i need to read value for TIFFResolution from the file

set outputFolder to (choose folder with prompt "Choose path to final files:") as alias

try
	tell application "Finder"
		if (not (exists folder ((outputFolder as string) & "Temp"))) then
			-- set tempFolder to make new folder at outputFolder with properties {name:"Temp"}
			set tempFolder to make folder at outputFolder with properties {name:"Temp"}
			
		else
			set tempFolder to folder ((outputFolder as string) & "Temp")
		end if
		
		-- display dialog tempFolder as string
	end tell
on error the error_message number the error_number
	display dialog "Error in Dropped Items: " & the error_number & ". " & the error_message ¬
		buttons {"OK"} default button 1 with icon stop with title myTitle
end try
exportTempFiles(droppeditems)

end open

Regards, Alex

Hello.

You have posted in the wrong forums, we ask for help in the MacOsX/AppleScript Forum.

However, maybe this is useful to you. :slight_smile:

Thank you, i think its to simple :wink:

Making it as simple as possible was the whole idea. You have read in a script object, which you make if it didn’t exist, and sets initial properties in it. When you update the script object, you set properties in it and saves the script to disk . Can’t be simpler than that. :slight_smile: