trying to create a simple plist file but when i pass the userName to the file_path it tells me it does not expect identifier. please help. thks
tell application “System Events”
set userName to name of current user as string
end tell
set startup_path to path to startup disk as string
set file_path to startup_path & “Users:” userName":Library:Preferences:" & “myapp.plist”
set the_file to (open for access file file_path with write permission)
however, I have attached the script to a button which writes a value to “the_value”, but i would like to read “the_value” on a subsequent button press, and pass it to an “if” statement.
does that make sense??
please help.
i solved it, using this script:
set theOutputFolder to path to preferences folder as Unicode text
set thePListPath to POSIX path of (theOutputFolder & "SafariSafe.plist")
tell application "System Events"
tell property list file thePListPath
tell contents
set u to the value of property list item "safe"
end tell
end tell
end tell
if u is "0" then
set v to display dialog "you have already made safari safe" buttons {"OK"} default button 1
if the button returned of v is "OK" then error number -128
end if