Jump to content

This topic is 1446 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

So... after a lot of trial and error, I finally have something working in the Web Viewer. The task I'm doing requires me to go to multiple web pages, tab through some fields, enter data in a field, and then press a button. Some other things happen, but that is the gist of it.

I have to tab 29 times to get to the correct field, and then I have to enter a 4 digit number (or something similar). Each of the tabs and each of the digits seems to take a bit more than a second to happen, which is agonizingly slow. I'm wondering if there is any known way to speed it up.

Here is the AppleScript that I've put into the Perform AppleScript command:

"--this script assumes that we're already ON the web page where we can add an item to our wanted list¶" & 

"set LegoRecordID to " & gracelego::ID & " as string¶" & 
"--this sets a local variable in AppleScript to SetID, unfortunately have to do quantity later, had trouble in AppleScript¶" & 

"tell application \"System Events\"¶" & 
"   repeat 28 times¶" & 
"      keystroke tab¶" & 
"      --this gets us to the right input field so we can input the ID¶" & 
"   end repeat¶" & 
"   repeat with n from 1 to length of MyRecordID¶" & 
"      keystroke character n of MyRecordID¶" & 
"      delay .01¶" & 
"      --doing it this way because it seems like it sometimes drops a number all at once, add delays if nec¶" & 
"   end repeat¶" & 
"end tell¶" & 

""

This definitely used to execute faster in older versions of FM, but in 17 (and 16 and 18?), it crawls. :(

Is there a better way to write this code?

Also, it seems like certain urls won't load into the Web Viewer unless I am already on the correct domain. I.e., when I'm loading a new page into the Web Viewer, if I am already on a page in the same domain, then the new one will load. If I'm not, then it won't. Obviously this is a different problem, but I'm mentioning it here in case it is somehow related.

Thanks in advance for any help!

Posted

That would be awesome, but I don't know of one. I think there is something from Monkey_Somebody softward, but it's not free and I'm not sure how it works. Still, sending tabs to AppleScript should be dead simple; not sure why it slows to a crawl. :(

Posted

No, we're not talking about the same thing.  MonkeyBreadSoftware (MBS) is a plugin and I'm sure it can also automate keystrokes to simulate a user typing in stuff.  What I am talking about is an API provided by the web site / service that you are sending the data to.  It would be strange if the recipient does not have an API to send the data to in either JSON or XML format.

FM is particularly good at this kind of integrations.

Posted

Ah, ok. I think that they do have an XML option, but unfortunately it is for making new lists rather than editing an existing list, and the latter is what I'm trying to do. :(

  • 1 year later...
Posted

Try and look under the hood of this webpage and view it's source html.

See if you can find the ID="???" of the field you want the data to be entered in.

Depending on the complexity of the webpage source code, this could range anywhere between fairly easy to find to absolutely impossible.

If you are lucky and find the ID, I would speculate that a little javascript/jQuery code inserted and triggered in your webViewer might be able to change the input value.

Possible javascript/jQuery off the top of my head (after adding a reference to the jQuery library in your javascript):

$('document').ready(function(){
   $('#theIdOfMyDesiredField').text('the auto-filled value I want to insert');
}

This topic is 1446 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.