AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

How to extract a Subtotal from Window and send it?

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
artbasement



Joined: 01 Sep 2008
Posts: 47

PostPosted: Sat Sep 06, 2008 1:01 am    Post subject: How to extract a Subtotal from Window and send it? Reply with quote

I am able to read the whole text from a window and send it to an entry field (or text field for testing), but how can I only send the money amount shown (i.e. 29.95)? Also, is it possible once it is sent to the entry field to make the number dissappear, if I start to type a different number (like 30.00 tendered). (I tried to copy and paste into the field without success) The code is like this so far....

Code:
Enter::
{
WinWait, ShopAssist
WinGetText, sub  ; The window found above will be used.
FileAppend, %sub%, subtotal.txt
}
Return


And the text file it produces is...

Quote:
&3 - Cheque
&2 - Credit Card
&1 - Cash
Panel22
Panel23
Panel2
29.95
Any
Ne&w Hire
Price Loo&kup
Item &Discount
&Sale Discount
P&rint
Ca&ncel
C.&O.D.
&Cash
&Amt Tendered
&Unlisted Item
Card
Char&ge Account
Back to top
View user's profile Send private message MSN Messenger
Slanter



Joined: 28 May 2008
Posts: 397
Location: Minnesota, USA

PostPosted: Sat Sep 06, 2008 1:21 am    Post subject: Reply with quote

maybe something like this?
Code:
Enter::
{
WinWait, ShopAssist
WinGetText, sub  ; The window found above will be used.
RegExMatch(var,"\d+\.\d{2}",sub)
FileAppend, %sub%, subtotal.txt
}
Return

_________________
Unless otherwise stated, all code is untested

(\__/) This is Bunny.
(='.'=) Cut, copy, and paste bunny onto your sig.
(")_(") Help Bunny gain World Domination.
Back to top
View user's profile Send private message Visit poster's website
artbasement



Joined: 01 Sep 2008
Posts: 47

PostPosted: Sat Sep 06, 2008 8:16 am    Post subject: Reply with quote

Unfortunetly the script returns nothing, but returns everything with line below removed...any ideas?

Code:
RegExMatch(var,"\d+\.\d{2}",sub)
Back to top
View user's profile Send private message MSN Messenger
Serenity



Joined: 07 Nov 2004
Posts: 1276

PostPosted: Sat Sep 06, 2008 11:19 am    Post subject: Reply with quote

Try changing var to sub:

Code:
RegExMatch( sub,"\d+\.\d{2}", sub )

_________________
"Anything worth doing is worth doing slowly." - Mae West
Back to top
View user's profile Send private message Visit poster's website
artbasement



Joined: 01 Sep 2008
Posts: 47

PostPosted: Sat Sep 06, 2008 12:02 pm    Post subject: Reply with quote

Cool, thanks it worked! Smile
Back to top
View user's profile Send private message MSN Messenger
Slanter



Joined: 28 May 2008
Posts: 397
Location: Minnesota, USA

PostPosted: Sat Sep 06, 2008 8:33 pm    Post subject: Reply with quote

oops, forgot to change that back after testing it Embarassed
_________________
Unless otherwise stated, all code is untested

(\__/) This is Bunny.
(='.'=) Cut, copy, and paste bunny onto your sig.
(")_(") Help Bunny gain World Domination.
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group