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

Ikard

macrumors newbie
Original poster
Oct 20, 2011
2
0
Essentially what I'm trying to do is rather simple. Or at least, it should be...

Code:
set rand1 to random number from 20000 to 40000
set rand4 to random number from 1000 to 10000
set rand5 to random number from 30000 to 50000
set theFile to choose file with prompt "Select an image (in jpeg format dood!)"
tell application "TextEdit" to open theFile
tell application "TextEdit" to activate

tell application "System Events" to tell process "TextEdit"
	repeat rand1 times
		key code 125
	end repeat
	shift key down
	repeat 100 times
		key code 125
	end repeat
	shift key up
	key code 7 using command down
	repeat rand4 times
		key code 125
	end repeat
	key code 9 using command down
end tell
end

the intent of this little gem is to open a jpeg in textedit, select a random block of 100 lines, cut it, and paste it to another random location. instead... nothing seems to happen at all. sure, textedit opens, but that's about it.

can anyone help?
 
And, yes, before anyone asks, I do know I have more random numbers than I strictly need.
 
I assume you are trying to build a fuzzer, and my one piece of advice here is that you are very much using the wrong tool. You have esentially reduced this to text manipulation, and a scripting language like Python, Perl, or Ruby will be far faster, and far more reliable.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.