Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Problems again
#1
Once again, I am having difficulties with consistency. The only way I can get this macro to run 100% of the time is to add a deb and a deb- before one section.

What am I missing?

Thanks

Here is the code:
typelib Excel {00020813-0000-0000-C000-000000000046} 1.2
Excel.Application ex1._getactive

int Exl=win("Microsoft Excel - final fp list (use this one to set up FP).xls")
int IntExp=act(win("PEDS - Microsoft Internet Explorer provided by CS&O"))

Excel.Worksheet ws=ex1.Worksheets.Item("Init")
Excel.Range r1=ex1.Range("a1")

Acc RefreshButton=acc("Refresh" "PUSHBUTTON" IntExp "Internet Explorer_Server" "" 0x1001)
Acc AddButton=acc("Add" "PUSHBUTTON" IntExp "Internet Explorer_Server" "" 0x1001)

str initt
str ccount

act Exl
ws.Select
r1.Select
ccount.getsel
rep
spe
if(val(ccount) = 0) break
'R
initt.getsel
'LD
ccount.getsel
spe 500
act IntExp
RefreshButton.DoDefaultAction
wait 20 I
deb
'S{TTTT}
deb-
initt.setsel
AddButton.DoDefaultAction
act Exl
ccount.getsel
#2
I would at first try to insert delays (I believe you already tried it). The spe setting is applied only to intrinsic (blue) commands, and not for all. And maybe try to split TTTT. The wait I command also is not 100% reliable (QM just listens what the browser reports).

...
,RefreshButton.DoDefaultAction
,0.5
,wait 20 I
,0.5
,'ST
,'ST
,'ST
,'ST
,initt.setsel
,AddButton.DoDefaultAction
,0.5
,act Exl
...

No, I would replace keyboard commands to html element functions. You can programmatically set text of edit fields without even selecting them.
#3
What do you mean when you say

"No, I would replace keyboard commands to html element functions. You can programmatically set text of edit fields without even selecting them."

How do I do this. I have tried the HtmlSetFocus and cannot get that to work.

Thanks!
#4
I am sure you will find the right function in the Html Element Actions dialog.

This example macro opens google advanced search page, waits for it, fills two first text fields, selects 50 from the combo box, and clicks the "Google Search" button. I usually use this method to enter userid and password in web pages, because I don't have to manually set focus to the userid field.

Code:
Copy      Help
web "http://www.google.com/advanced_search" 0x1
MSHTML.IHTMLElement el=htm("INPUT" "as_q" "" " Internet Explorer" 0 0 0x221)
el.innerText="macro"
el=htm("INPUT" "as_epq" "" " Internet Explorer" 0 3 0x221)
el.innerText="quick macros"
el=htm("SELECT" "num" "" " Internet Explorer" 0 0 0x221)
MSHTML.IHTMLSelectElement elsel=+el; elsel.selectedIndex=3
el=htm("INPUT" "Google Search" "" " Internet Explorer" 0 2 0x421)
el.click


Forum Jump:


Users browsing this thread: 1 Guest(s)