Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
help on taking actions after matching a string in a file
The scenary is:

I will go to a web page, and view the source (from IE, it launch notepad to view the source of the web page), find character strings in the source and do things depends on what the character string says.

How could I do something like this by using QM 2.1.7?

Any help is appreciated!
Better use html element functions instead of notepad.

Copy      Help
;Test this macro with this page.

str s; int i
Htm el=htm("BODY" "" "" "View topic" 0 0 0x20)
;out s ;;uncomment this to print the html in the qm output
i=find(s "jjc51")
if i>=0
,out "found"
,out "not found"
Hey, that is great! but what if the string I search for is am image, '****.gif', which I can only get from source?

Thanks a lot!
this is the same source html, not just text.
I got you, s actually contains everything in "source"

can you please explain this statement for me?

Htm el=htm("BODY" "" "" "View topic" 0 0 0x20)

especially what does "0 0 0x20" mean?

To know more, read QM Help. But it is not necessary, because it is easier to insert this line using the Find Html Element dialog.
Sorry for my stupid question, coz I am new to this tool :-)

what is "Find Html Element dialog" and where in QM I can find it?
4-th button in the floating toolbar.
That is very helpful! Thanks.

My web page is in Chinese, so when I drag it and get the handle, it shows up a bunch of ??????

hehe, is there a way for this tool to grep Chinese from a web page?
Probably not.
Hey, thank you very much!
Somehow, if the web page contains Chinese, I could not get the text...


str s; int i; int j
Htm el1=htm("BODY" "" "" " Internet Explorer" 0 0 0x20)
str s1=el1.HTML
out s1
j=find(s1 "boss7.gif")
if j>=0
,out "Boss found"
,out "Boss not found"

I used the tool to get the html link and it can be tested in the tool. However, when I run it, I got nothing in string s1...when I print it, it has nothing :-(

is there a way to do it?

the web page I tested was:
The page cannot be found.

Maybe it is frameset page, and therefore does not contain BODY tag. Try to capture BODY tag in some frame. Or, capture the picture element directly.

Forum Jump:

Users browsing this thread: 1 Guest(s)