Jump to content
Macro Express Forums
Derfel

Time-out On A Webform Containing Dll's

Recommended Posts

Hi all,

 

I've got a problem with posting info through a webform to a database. I've been looking in the earlier postings, but didn't find a solution, so here it goes:

 

In our company we use a webform to store some information about members into a database. To add this info, we use a we use a webform and a server-side-script. I have a macro that does this for me: it opens the webpage (wait to load) "https://www.oursite.com/some-cgi/blabla.dll?dosomething". This webpage contains some form-elements like textboxes, -areas, checkboxes an one pull-down-list.

The macro I wrote manouvres through the form by searching for a text on the page and tabbing to the next form-field. It puts the necessary info in the right fields. For the pulldown-menu I found the trick to:

(1) tab to the list,

(2) enter the first character of the option I want to select and then

(3) keyboard-arrowdown "x"-times untill the wanted option is selected and then tab to the next field.

In one of there textareas we enter the source-code for a webpage, containing the actual info we want to add for the user.

 

And after all fields are filled out, I tab to the "submit"-button and click it.

 

This far all works fine!

 

 

After the submit-button has been clicked, the form is submitted and then a confirmation-page is shown ("https://www.oursite.com/some-cgi/blabla.dll"): here I have the last opportunity to check the info. On this page I let the macro search again for a text and tab to the "Submit"-button and click it.

Then the info gets submitted and a page is shown "Note has been added". My macro closes the window then and goes on to the next case.

 

 

I'm experiencing 2 problems:

 

(1) after the first click it sometimes takes extremely long (>>30 sec) before the confirmation-page is shown. Since it's a dll-link, I cannot use "wait to load", because the page is already loaded (we just submitted the info through it). My idea was to let the macro loop after the first "submit"-button was clicked: search for some text that is only on the second page (and not on the first one) - if this text is not found then wait a bit longer - else find the second "Submit"-button and click it.

But I didn't succeed in writing such a loop, I'm running in circles.

 

(2) our IT-Dept regularly surprises me by adding , deleteing and changing options in the options-list. And then I have to recount the number of times the ARROW-DOWN must be clicked.

 

My wish is to get a macro that submits the info directly to the third page:

something like "https://www.oursite.com/some-cgi/blabla.dll?storeitnow&var1=username&var2=optionvalue361&note=here_comes_the_html_sourcecode....". I hope you're still with me here ;-)

 

But the value for the note is HTML-source-code and thus it contains special characters like "<", "/", etcetera. I know php has a possibility to change HTML-specialcharacters into characters, that I could submit like above....

 

Does anybody have an idea how I could solve these two problems??

Any idea would be welcome!!

Share this post


Link to post
Share on other sites

EDIT - I wrote a suggestion that won't work - sorry -deleted

 

This one might!

If you are happy to download the "exe" or "zip";

Send me (email below in signature?)[OR just examine the text yourself] the two text files generated with "1" or "0" options; if they are empty, no help?[if they give more info on the submit link, you are running...]

(Will only work if you can enter a "url")

 

LinkFrames2_1.zip

Best, Randall

(Ps See source etc below on this thread.)

LinkFrames2_1.exe

Edited by randallc

Share this post


Link to post
Share on other sites

I'm not sure how to go directly to the third page but here are a couple of ideas that may make your existing macro work better.

(2) our IT-Dept regularly surprises me by adding , deleteing and changing options in the options-list. And then I have to recount the number of times the ARROW-DOWN must be clicked.
In my macros I do an Arrow Down and then Copy to Clipboard. Then I look in the clipboard to see if what I wanted is there. If not, I have the macro do another Arrow Down. This works no matter how often the list changes. I did have to add a 'fail-safe' to determine if the last item was the same as it is this time. This allows me to stop the macro if the item I'm looking for is never found.

 

(1) after the first click it sometimes takes extremely long (>>30 sec) before the confirmation-page is shown.

Does the title of the window change? If so you could use the Wait For Window Title macro command.

 

Another approach would be to put the macro commands that come after the Submit into a separate macro. Make this macro a Window Activated macro and make it disabled upon startup. Then have your original macro Activate it.

 

However, both of these techniques requre a change in the Window title. If the Window title does not change then perhaps you can use the Get Pixel Color command to see if a specific area of the screen changes.

Share this post


Link to post
Share on other sites
If you are happy to download the "exe" or "zip";

Send me (email below in signature?)[OR just examine the text yourself] the two text files generated with "1" or "0" options; if they are empty, no help?[if they give more info on the submit link, you are running...]

Hi randallc,

 

I don't want to sound too suspicious, but could you pls tell me what that .exe does (before I download it)? Just wanna make sure my boss isn't going to fire me because I've sent out some company-info's ;)

Share this post


Link to post
Share on other sites
In my macros I do an Arrow Down and then Copy to Clipboard. Then I look in the clipboard to see if what I wanted is there. If not, I have the macro do another Arrow Down. This works no matter how often the list changes. I did have to add a 'fail-safe' to determine if the last item was the same as it is this time. This allows me to stop the macro if the item I'm looking for is never found.

Thanks for this great idea! But I see a small problem ahead (knowing our IT-guys): if they change not only the list but also the actual text. E.g. if what I was looking for is the option "User did not pay" into "User didn't pay", then I wouldn't find it, would I? A sollution could be to search in th source-code, since the "value" for this option would stay the same (probably).

But your idea made me think the following: instead of putting a fixed number into the macro and having to change it everytime (and then all my collegues have to re-import the macro), it would be better if I just put the number into a separate textfile on the server. Then I only need to change the textfile and I don't need to touch the original macro anymore. Do you think that would work?

Share this post


Link to post
Share on other sites
Does the title of the window change? If so you could use the Wait For Window Title macro command.

 

Another approach would be to put the macro commands that come after the Submit into a separate macro. Make this macro a Window Activated macro and make it disabled upon startup. Then have your original macro Activate it.

 

However, both of these techniques requre a change in the Window title. If the Window title does not change then perhaps you can use the Get Pixel Color command to see if a specific area of the screen changes.

I thought of those window-titles too, but they don't change :(

 

I've read about the pixel-color-trick many times, but I'm a bit suspicious whether it really is bug-free: we use the macro's in the whole team. And with different monitor-sizes, personal settings, etc. I'm afraid there might be a lot of troubles in this...

 

My guts tell me the solution lies in the second option: splitting up the macro in seperate macro's, calling each other if they've done something succesfully. But I'm not sure yet how to work it out and depending on WHAT they continue or halt. I'll have to think it over....

 

Thanks for your help so far!

Share this post


Link to post
Share on other sites

I take your point in a work situation!

You would need to get the source and compile it yourself, probably; not worth it.

 

It lists all "clickable links" and "form fields" whether in frames or not, and puts them into a text file to examine - using free programme; "AutoIT".

 

You'd have to

1. Install AutoIT

AutoIT download Page

2. Install easy scripting and compiling program for it;

SCite Install Page

3. Install latest "beta" for AutoIT

Beta3.1.1.55 AutoIT WebSite

4. Use my ".au3" script, and read it and compile it (Alt-F7" in Scite Editor)

LinkFrames2_1.au3 Source Script to read

 

Never mind!

Best Randall

[PS zip file below now has source for Wizard as well; for same reasons]

MEBasicWizard.zip

Share this post


Link to post
Share on other sites

I don't want to *bump* my posting, but it's a question concerning the problem mentioned in my first posting:

 

Can Macro-Express get the text in the STATUS-bar of a browser-window??

 

If that is possible, my problem is solved: I'd let the macro wait untill the status-bar sais: "Done" and then I know the page is loaded completely!

 

I would even be happy with a sollution, where my macro first detectes the size of the browser-window and then check waht is written 5 mm above the bottom of the window (if that's possible at all)...

Share this post


Link to post
Share on other sites
Can Macro-Express get the text in the STATUS-bar of a browser-window??

Try the Window Controls. This works for me in a test environment:

Get Control %C1% (Insight Software Solutions - All Products - Microsoft Internet Explorer: msctls_statusbar32)
Variable Get Control Text: %C1% to %T1%
Text Box Display: T1

Because the window control may change for each web page, you may need to use the Capture Control command instead of the Get Control. The Get Control command requires that you know the position of the control.

 

I would even be happy with a sollution, where my macro first detectes the size of the browser-window and then check waht is written 5 mm above the bottom of the window (if that's possible at all)...

You can get the size of a Window using the Variable Set Integer %N1% from Top of Window, Variable Set Integer %N2% from Left of Window, Variable Set Integer %N3% from Width of Window, and Variable Set Integer %N4% from Top of Window commands.

Share this post


Link to post
Share on other sites
Try the Window Controls. This works for me in a test environment

I've just tried it out and it appears to work! That's great, finally I think I can solve my problem! Thanks a lot!!

Share this post


Link to post
Share on other sites

Just my two cents but what I do when running drop downs I just start typing. In all normal Windows drop downs if you type multiple characters it will keep advancing to the next matching suspect. So if you're selecting the state typing M yields several names but typing MO will only return Montana.

 

But I like that idea of looping in a drop down and checking each one until your satisfied. Very cool. But if it’s a long list it may take a while.

Share this post


Link to post
Share on other sites
But I like that idea of looping in a drop down and checking each one until your satisfied. Very cool. But if it’s a long list it may take a while.

I use this technique in one application to select a name from a long list. The name never changes and appears somewhere near the middle of the 1500+ list of names. The macro always finishes in about one second or less.

 

EDIT: After thinking about this I realized that each copy to and from the clipboard has a built in delay of 1/4 second. This means that a long list would definitely be slow. That got me thinking about my macro. It turns out that it uses a Window Control to determine the content of the field, not the clipboard. This technique is much faster!

 

Here is an edited version of my macro:

// If the desired name is already selected, then exit quickly
Variable Get Control Text: %C1% to %T1%
If Variable %T1% = variable %T10%
 Macro Return
End If

//   Get the name

// Give focus to the combo box specified by the control
Mouse Single Left Click on Control %C1%
Text Type: <ESC>
Delay 0.5 Seconds

// Send first letter to the control to speed up the search
Variable Modify String: Copy Part of %T10% to %T1%
Text Type:a%T1%

// Loop through list of names until match found or end of list
Variable Set String %T1% ""
Variable Set String %T2% ""

Repeat Until %T9% = "DONE"
 Variable Get Control Text: %C1% to %T1%
 
 // We are done if we have found the name we're looking for or
 //   if we have reached the end of the list
 If Variable %T1% = variable %T10%
   OR
 If Variable %T1% = variable %T2%
   Variable Set String %T9% "DONE"
 Else
   // Name last time through
   Variable Modify String: Copy %T1% to %T2%
   
   // Arrow down
   Text Type: <ARROW DOWN>
 End If
 
Repeat End

The technique that uses the clipboard would work fine for a shorter list.

Edited by kevin

Share this post


Link to post
Share on other sites
It turns out that it uses a Window Control to determine the content of the field, not the clipboard. This technique is much faster!

Hmm, the idea is clear to me but somehow it doesn't work for me. I don't get the contenttext, but the title of the combobox...

Share this post


Link to post
Share on other sites

The combo box must be defined as a Window Control and you must capture it as such. Make sure when you capture that you do not include more than the content of the combo box itself. If the Window Control contains more than just the combo box then it may not work.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...