Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to capture data from message box
#1
Hello,

We have one application in which after processing some records it displays message box with number of records processed successfully. (PFA...)

Query: Can we capture integer part (number of records) in quick macro.

Thanks in advance....

Regards,
Manoj


Attached Files Image(s)
   
#2
Macro Macro2256
Code:
Copy      Help
int w=win("POS Settlement File" "#32770")
Acc a.Find(w "STATICTEXT" "" "" 0x1000)
str s sn
s=a.Name
if(findrx(s "\d+" 0 0 sn)<0) end "no numbers"
int n=val(sn)
out n

or

Macro Macro2252
Code:
Copy      Help
act "POS Settlement File"
str s sn
s.getsel
;out s
if(findrx(s "\d+" 0 0 sn)<0) end "no numbers"
int n=val(sn)
out n
#3
Hello Gintras,

Thanks for your reply.

I tried to execute below code but I am getting error message at line

Acc a.Find(w "STATICTEXT" "" "" 0x1000)

Error Message:

Error (RT) in Mozilla: object not found. ?

Regards,
Manoj
#4
That code was for a standard Windows message box. If does not work, use dialog 'Find accessible object' to capture the object (message text) and create code. Replace the first 2 lines with the new code created by the dialog.
#5
Hello Gintaras,

Thanks for your reply...

It would be very great if you share us sample code for the same.

Regards,
Manoj
#6
Hi Gintaras,

I too have the same issue.Message shown in our message box is dynamic..for eg:-
Day1:- 500 data uploaded..
Day2:- 1245 data uploaded..
day3:- 10 data uploaded...

Cay you suggest a solution to capture dynamic values with respect to a static values...i.e keyword "data uploaded" is common in all the messages and I am concerned of dynamic values before that keyword.

Regards,
Sanish S
#7
Cannot give sample code because message boxes of various applications often are different. To create QM code to get text from a message box or other window that does not support Ctrl+C to copy to the clipboard, use one of dialogs from the floating toolbar menu 'Windows, controls'.

When you already have text, the best way to extract numbers etc is regular expressions. QM uses similar regular expressions like most other languages. Google...

Macro Macro2328
Code:
Copy      Help
str s=
;Day1:- 500 data uploaded..
;Day2:- 1245 data uploaded..
;day3:- 10 data uploaded...

ARRAY(str) a
findrx(s "(\d+) data uploaded" 0 4 a)
int i
for i 0 a.len
,out a[1 i]
#8
Thanks Gintras for your support.. Smile..like to highlight few things so that you can understand my requirement..

Day1:- "500 data uploaded.." ---------> This message actually appears in my message box (After I upload a file to my application) and this message changes on daily basis (As per the data in file). I am looking for a solution where in I can capture this message from message box and then split the contents of message as per my requirement.

Thanks In Advance,
Sanish S
#9
Need an example how to get text from message box into a variable?


Forum Jump:


Users browsing this thread: 1 Guest(s)