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

traisjames

macrumors newbie
Original poster
Jul 19, 2012
3
1
I am running an applescript which uses "Delay" for certain pauses between clicking links on a website. The script works fine, however with each time in a repeat loop, "delay 5" takes longer and longer...becoming 10 seconds then 20 seconds (estimations). Anyone experiencing this? One unique thing is I am using 10.9.
 
If you are scripting a web page then there is a better tool than automator. Look into imacros for firefox. Automater has a tendancy to slow down when you loop.
 
If you are scripting a web page then there is a better tool than automator. Look into imacros for firefox. Automater has a tendancy to slow down when you loop.

Will iMacros allow for tabbing thru to find a link, click on it, then paste text, and finally click a button you can't tab to?

Below is my code. Any suggestions would help.

Code:
set strokecount to 10
set namecount to 0
tell application "TextEdit" to activate
tell application "System Events"
	keystroke "a" using command down
	delay 0.2
	keystroke "c" using command down
	delay 0.2
end tell

tell application "Safari" to activate
delay 0.2
tell application "System Events"
	(*setup*)
	repeat 10 times
		beep
		tell application "Safari" to activate
		repeat strokecount times
			keystroke tab
			delay 0.1
		end repeat
		
		tell application "Safari" to activate
		log namecount
		repeat (namecount * 2 + 1) times
			keystroke tab using option down
			delay 0.1
		end repeat
		
		delay 1
		tell application "Safari" to activate
		keystroke return
		delay 5
		keystroke "v" using command down
		delay 1
		keystroke tab
		delay 1
		key code 125 (*down key*)
		delay 2
		do shell script "/usr/local/bin/cliclick c:483,760"
		delay 6
		key code 53
		delay 3
		set namecount to namecount + 1
		
	end repeat
	display dialog "Done" buttons {"OK"} default button 1
end tell
 
its ****ing up for me too!

I am running an applescript which uses "Delay" for certain pauses between clicking links on a website. The script works fine, however with each time in a repeat loop, "delay 5" takes longer and longer...becoming 10 seconds then 20 seconds (estimations). Anyone experiencing this? One unique thing is I am using 10.9.

so im trying to code an auto typer for an mmorpg i play, and i put a delay of 3 after each entering of the text i am saying. well after about a dozen or so messages being said, it (dramatically) increases the delay, to around 9 seconds or so. my question is simply: why in ****ing hell does it take 9 seconds to do something that has a delay of only 3??? it works fine for the first while, but then it acts as though i had changed the delay to around 9 or so... any help would be appreciated. post here or email me at alex.marciniak70@gmail.com
 
For making bots an applescript aint so good.
If you really want to stay on the applescript, you should consider using your task scheduler to perform your script every amount of time instead.

Because your applescript will be in an endless repeat? With all the delays its making an huge memory dump after a while because applescript leaks memory in delays. Thats why your delays are taking longer and longer. At first sight you wont notice (depending on your ram) but as you notice after a longer time it will :)
 
Interim Solution

Have had the same issue since I updated to Mavericks. It occurred after only a few loops and on menial tasks, so it does not seem memory related.

For the time being I'm using the following workaround (just copy and paste the into your AppleScript and adjust the time as you would within Applescript Editor):

do shell script "sleep 0.1s"

See the following page for other options (e.g., instead of "s" for seconds you can use "h" for hours, "d" for days):
http://en.wikipedia.org/wiki/Sleep_(Unix)
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.