Arg! I've had a frustrating day trying to do something that would have been so simple prior to cross-site scripting. I'm trying to take a web form, enter one value into it, grab the results, go back to the form, enter a value increment by one, grabbing the results, etc. So I need to be able to enter the form value, copy the result text, loop, and increment.
I first decided to try this with Automator. It doesn't support looping or incrementing, let alone variables. I can get it to do it in one pass, but I can't get it to loop (I could try the automator loop applescript utility), but even if that worked, I'd have no way to increment my counter or to put the incremented counter into the form since the form setting utility I found doesn't take result values from previous actions. Is there a way to do this with Automator?
I then tried RealBasic. The form won't work with httpsocket so I used htmlviewer. Nice, but there's no way to navigate to fields on a form and no way to execute javascript to submit the form, or is there?
I finally tried AppleScript and had bad flashbacks to the nineties. While AppleScript looped and incremented to my heart's content, I couldn't get it to grab the document source. I think I'm forgetting someting about applescript and scope.
tell application "BBEdit"
set scratchPad to make new document
end tell
and later on in safari
set contents of scratchPad to the source of document 1 as text
When this line runs, I get a scratchPad is not defined error. I tried defining it at the start of the script but went nowhere.
This would have been so much easier with javascript in another frame, but cross-site scripting ended that. I should just dig up an old machine with IE 4 on it. Sigh.
Can somebody tell me which is the best tool for doing this, or what I'm doing wrong in AppleScript?
Thanks