PDA

View Full Version : Java Script Command or Applescript error?




thriftinkid
Feb 4, 2009, 01:57 PM
Hey Guys.

I am trying to simulate a mouse click on a button called "Working Time". I wrote the following applescript, but it is not working properly. I am getting the following error.

Syntax Error

Expected end of line, etc. but found identifier.

Any ideas what is wrong? Is it my applescript or the javascript itself that is the problem?

tell application "Safari"
activate
do JavaScript "this.Response.Redirect("WebForm1.aspx?__EVENTTARGE T=Working Time")"
end tell



Sayer
Feb 4, 2009, 03:14 PM
You have to escape the quotes in the script part.

That just means put a \ before the " inside the do JavaScript command like this:

tell application "Safari"
activate
do JavaScript "this.Response.Redirect(\"WebForm1.aspx?__EVENTTARGE T=Working Time\")"
end tell