Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

thriftinkid

macrumors regular
Original poster
Mar 24, 2008
119
0
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?

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

Sayer

macrumors 6502a
Jan 4, 2002
981
0
Austin, TX
You have to escape the quotes in the script part.

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

Code:
tell application "Safari"
	activate
	do JavaScript "this.Response.Redirect(\"WebForm1.aspx?__EVENTTARGE T=Working Time\")"
end tell
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.