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 

Need to wait for a window in Quicken?

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



Joined: 18 Sep 2004
Posts: 60

PostPosted: Wed Sep 29, 2004 2:59 am    Post subject: Need to wait for a window in Quicken? Reply with quote

Hi-

In a Quicken register (window), I issue a keystroke to indicate I want to create a new transaction (this tells Quicken to go to the end of the listed transactions in the current register window and place the cursor in the date field of a new, empty transaction).

If there is a transaction in the register that has not been saved (e.g. a previously saved transaction that has been modified but not saved), Quicken pops up a window asking me whether the modified transaction should be saved. (Quicken can only work with one transaction at a time in the register)

My Question: What logic do I use to determine if Window pops up a "transaction not saved" Window?

Options I can think of:
1) Be able to figure out whether, after I press Ctrl/N, the cursor is within the date field. This would confirm that there is no modified (unsaved) transaction because if there were, the current window would become the "transaction not saved" window. (When creating a new transaction, Quicken highlights the month portion of the date. e.g. 9/28/04 - Quicken would highlight the 9)
2) Do IfWinExists

I don't know if AutoHotkeys can do option 1.

With option 2, I've inserted a Sleep command. It seems that without the sleep command, AutoHotkeys executes the IfWinExists command before Quicken has been able to pop the "transaction not saved" window. But how long do I sleep for? Is there another way? It seems to me that the sleep command will not give me reliable results (e.g. if another process has turned my response into molasses, I can foresee that it will take much longer before the "transaction not saved" pops up - resulting in AutoHotkeys blasting past the sleep command. It seems the same timing problem may apply to option 1 too...

Here's the basic test code I'm using for my option 2 above (I don't know if coding option 1 is possible). Can anyone please help:

Send, {CTRLDOWN}n{CTRLUP} ; Tell Quicken I want to create a new transaction
sleep, 2000 ; coffee break...
IfWinExist, Quicken 2005 for Windows
{
msgbox, problem
return
}
else
{
msgbox, proceed
return
}
Back to top
View user's profile Send private message
Chris
Site Admin


Joined: 02 Mar 2004
Posts: 10480

PostPosted: Wed Sep 29, 2004 11:48 am    Post subject: Reply with quote

This is a common task in GUI automation. I think this is the best way:
Code:
Send ^n
WinWait, PopupWindowTitle,, 3   ; Wait up to 3 seconds for the window to appear.
if ErrorLevel = 0  ; The window appeared
{
     MsgBox Popup detected.
}
else
{
     MsgBox No popup appeared within the timeout period.
}
Back to top
View user's profile Send private message Send e-mail
jack



Joined: 04 Sep 2004
Posts: 77
Location: UK

PostPosted: Wed Sep 29, 2004 6:32 pm    Post subject: Reply with quote

you could do something slightly different...

i have Quicken 2000. the code below works for me if i press ^N to start a new entry and then press ^1 to run this code. your date format may be different and you may have a different Quicken, but you can probably get it to work.


Code:

^1::
ControlGetText, fieldcontents,QREdit1, A
msgbox %fieldcontents%

; my date format is 29/09/04.
; split it into the number chunks and check that each is a number
loop parse, fieldcontents, /

if A_LoopField is digit
{
   msgbox %A_LoopField%
   continue ; skip to next field
   msgbox "This is not a date"

}

return



jack
Back to top
View user's profile Send private message
SAbboushi



Joined: 18 Sep 2004
Posts: 60

PostPosted: Sun Nov 07, 2004 4:39 pm    Post subject: Reply with quote

Thanks Jack -
I just today found your reply - your code sure adds to my knowledge about how I can use AHK with Quicken.

Do you have any other scripts that you use with Quicken you may be willing to share?

With Regards-
Sam
Back to top
View user's profile Send private message
jack



Joined: 04 Sep 2004
Posts: 77
Location: UK

PostPosted: Sun Nov 07, 2004 11:09 pm    Post subject: Reply with quote

i'm glad it helped.

no, sorry... i don't use any scripts in quicken. i wrote that one just for you :)


jack
the giraffe is too tall to go through the tunnel
Back to top
View user's profile Send private message
SAbboushi



Joined: 18 Sep 2004
Posts: 60

PostPosted: Mon Nov 08, 2004 3:43 pm    Post subject: Reply with quote

Thanks Jack - much appreciated!
Back to top
View user's profile Send private message
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