Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Apple Script Editor, "Expected end of line but found identifier" Error

Hello, I'm trying to automate an Application I have, called Self Control, since I have ADD and easily get distracted, and what I want to do is for my computer to automatically set the application up, but to do this, I need a script, which I have already done, but get this error, can someone help me fix this script?


(the error happens once I click on "run", it tells me as follows: "Syntax Error", followed by, "Expected end of line but found identifier".


on run argv

set defaultTime to 1440


try

set myTime to item 1 of argv as number

on error

set myTime to defaultTime

end try


tell application "Usable Keychain Scripting"

tell current keychain

set myPass to (password of first generic item ¬

whose name contains "SelfControl")


-- eliminate invisible characters, or "gremlins," from password

set x to quoted form of myPass

set myPass to do shell script "echo " & x & " | perl -pe 's/[^[:print:]]//g'"

end tell

end tell


tell application "SelfControl" to activate


tell application "System Events"

tell process "SelfControl"

tell slider of window "SelfControl" to set value to myTime

click button "Start" of window "SelfControl"

end tell

tell window 1 of process "SecurityAgent"

with timeout of 15 seconds

repeat

set tryAgain to false

try

set value of text field 2 of scroll area 1 of group 1 to myPass

on error

delay 1

set tryAgain to true

end try

if not tryAgain then exit repeat

end repeat

click button 2 of group 2

end timeout

end tell

end tell

end run


I'm no coding expert, but your help would be greatly appreciated. I know that once the script is done I can automate it with Calendar, or even Quicksilver, I just need help with the script.


Thanks in advance!

MacBook Pro, OS X Mavericks (10.9.2)

Posted on Apr 20, 2014 12:41 AM

Reply
1 reply

Apple Script Editor, "Expected end of line but found identifier" Error

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.