Posts: 31
Threads: 4
Joined: Nov 2013
Hi, I am new to Quick Macros programming.
Could someone post a little piece of code to do the following:
I go to a web page that has a button with the word "Continue"
and I want to click on it.
I tried this, but it does not work:
Htm el=htm("P" "Continue" "" "Internet Explorer" 0 0 0x221)
el.click
This is the source code:
<p class="ch-actions"> <input type="submit" name="_eventId_Cs" value="Continue" class="ch-btn"/>
o <a href="/sell/sell?execution=e3s1&_eventId_newList" id="newListing">New item</a></p>
Thank you very much
Posts: 12,072
Threads: 140
Joined: Dec 2002
The element must be INPUT, not P.
In the "Find htm element" dialog select the button so that tag would be INPUT. If not possible or it is not good for searching, select the P and navigate to it with the arrow buttons. Or just enter 1 in the Navigate field. Then Test. If finds wrong element, play more wit the arrows and Navigate.
Posts: 31
Threads: 4
Joined: Nov 2013
Posts: 12,072
Threads: 140
Joined: Dec 2002
updated:
In the "Find htm element" dialog select the button so that tag would be INPUT. If not possible or it is not good for searching, select the P and navigate to it with the arrow buttons. Or just enter 1 in the Navigate field. Then Test. If finds wrong element, play more wit the arrows and Navigate.
Posts: 31
Threads: 4
Joined: Nov 2013
Is there a function that retrieves the whole web page source code?
Posts: 12,072
Threads: 140
Joined: Dec 2002
Html element dialog, Get page properties.
Posts: 31
Threads: 4
Joined: Nov 2013
Thank you again
Posts: 31
Threads: 4
Joined: Nov 2013
Hi, is there a programming command to close a message box, without entering key strokes or mouse strokes?
For example, if I create a MsgBoxAsync box, how can I close it?
Can I close its handle or something like that?
If so, how do I get the handle in the first place?
Thank you.
Posts: 12,072
Threads: 140
Joined: Dec 2002
Macro Macro2161
MsgBoxAsync "text" "Find Me"
1
int w=win("Find Me" "#32770")
if(w) clo w
Posts: 31
Threads: 4
Joined: Nov 2013
Thank you
Posts: 31
Threads: 4
Joined: Nov 2013
Hi, how could I make a progress box,
something like this but without creating a new window every time:
int i
for(i 0 5)
MsgBoxAsync i "Progress meter"
The code above would create five different boxes.
Is there a way to send text to just one box, as the loop goes by?
It does not have to be by using MsgBoxAsync,
it could be any other message box.
Thank you.
Posts: 12,072
Threads: 140
Joined: Dec 2002
With MsgBoxAsync:
Macro Macro2162
MsgBoxAsync "[9][9][9][9][9][9]" "Progress meter"
int w=wait(30 WA win("Progress meter" "#32770"))
int c=child("" "Static" w)
int i
for(i 0 5)
,str s=i
,s.setwintext(c)
,0.5
clo w
Posts: 31
Threads: 4
Joined: Nov 2013
PS: I tab-indented the last line of my code above, but it did not take.
Posts: 31
Threads: 4
Joined: Nov 2013
Thank you
Posts: 31
Threads: 4
Joined: Nov 2013
Is there a way to set the size of the MsgBoxAsync you coded above?
Posts: 31
Threads: 4
Joined: Nov 2013
Posts: 12,072
Threads: 140
Joined: Dec 2002
Maybe better use OnScreenDisplay.
Macro Macro2153
int i
for(i 0 5)
,str s=i
,OnScreenDisplay s 0 0 0 "" 0 0 1|4|8 "Progress meter"
,0.5
Posts: 31
Threads: 4
Joined: Nov 2013
I like both examples, thank you.
Posts: 31
Threads: 4
Joined: Nov 2013
I am running a macro that visits web pages, checking for their content.
After visiting about 500 pages, the computer starts clogging, I get a wait error message, and the macro stops.
- If I run the macro again, it may visit just under 10 pages more.
- If I restart the computer, it may visit about 100 pages.
- if I shut down the computer, and start afresh, I get back to the 500.
The macro is set up for Internet Explorer,
however, Firefox works much faster in my computer.
I did disable everything I could in Quick Macros.
Any suggestions to improve performance,
other than using multiple computers at a time?
Thank you.
Posts: 12,072
Threads: 140
Joined: Dec 2002
Look in Task Manager, does memory usage of qm or iexplore grow when running the macro many times?
Does the function run in multiple threads simultaneously? Look in the Running Items list.
Create the macro for Firefox, if possible.
Posts: 31
Threads: 4
Joined: Nov 2013
I will check the CPU usage.
Thank you.
Posts: 31
Threads: 4
Joined: Nov 2013
> Does the function run in multiple threads simultaneously?
No, the only thing that runs is QM and IE, one instance of each.
Posts: 31
Threads: 4
Joined: Nov 2013
The HTML element Drag utility does not work with Firefox, correct?
Posts: 12,072
Threads: 140
Joined: Dec 2002
Correct. Use accessible objects.
Posts: 31
Threads: 4
Joined: Nov 2013
Posts: 31
Threads: 4
Joined: Nov 2013
Hi, is there a function that returns the characters 0 through 255,
something like:
str s
s = chr(34) ;; s should be a quote now
s = chr(9) ;; s should be a tab now
without resorting to:
s = " "
s[0] = 34
Thank you
Posts: 12,072
Threads: 140
Joined: Dec 2002
s.format("%C" 34)
It is slower, but supports Unicode characters.
Posts: 31
Threads: 4
Joined: Nov 2013
Hi, I am running a QM macro that calls a standard "Choose a file" window.
I want to paste a file name in it, but nothing works.
I tried:
Key (file name)
Paste (file name from the clipboard)
Ao (ALT O to open a file)
An (ALT N to focus on the file name box)
lef (on the file name box before pasting)
Activating that window (int w="Choose file to upload" "#32770")
The drag utility only sees the window, not the file name text box.
If I stop the macro, I can paste manually.
Any advice so the window takes the QM commands?
Thank you
Posts: 12,072
Threads: 140
Joined: Dec 2002
Quote:If I stop the macro, I can paste manually.
Pasting manually also does not work while the macro is running? Maybe the macro presses and does not release Alt or Shift key? Can you post the macro here?
Posts: 31
Threads: 4
Joined: Nov 2013
Hi, the macro stops by itself because my QM code does not see the "Open file window",
even if I click right on top of it with a lef command.
This is a piece of code that I inserted in a larger program that was running fine.
Even after pasting the file name manually, the rest of the code gets disrupted.
As a curiosity, the "Open file window" always opens up in a different temporary folder.
int w=wait(3 WV win("Describe tu producto - Windows Internet Explorer" "IEFrame"))
;; begins new code
Htm e=htm("INPUT" "picturesNative" "" w "0" 27 0x121 3)
out sImageUrl ;; test file name, which is a public variable
wait 3
e.Click
wait 3
int w1=win("Choose File to Upload" "#32770")
act w1
wait 5
key sImageUrl
key Ao ;; open file
wait 10
act w
;; ends new code
e=htm("INPUT" "title" "" w "0" 37 0x121 3)
e.SetText(sMercadoTitle)
|