| View previous topic :: View next topic |
| Author |
Message |
SAbboushi
Joined: 18 Sep 2004 Posts: 60
|
Posted: Wed Sep 29, 2004 2:59 am Post subject: Need to wait for a window in Quicken? |
|
|
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 |
|
 |
Chris Site Admin
Joined: 02 Mar 2004 Posts: 10480
|
Posted: Wed Sep 29, 2004 11:48 am Post subject: |
|
|
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 |
|
 |
jack
Joined: 04 Sep 2004 Posts: 77 Location: UK
|
Posted: Wed Sep 29, 2004 6:32 pm Post subject: |
|
|
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 |
|
 |
SAbboushi
Joined: 18 Sep 2004 Posts: 60
|
Posted: Sun Nov 07, 2004 4:39 pm Post subject: |
|
|
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 |
|
 |
jack
Joined: 04 Sep 2004 Posts: 77 Location: UK
|
Posted: Sun Nov 07, 2004 11:09 pm Post subject: |
|
|
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 |
|
 |
SAbboushi
Joined: 18 Sep 2004 Posts: 60
|
Posted: Mon Nov 08, 2004 3:43 pm Post subject: |
|
|
| Thanks Jack - much appreciated! |
|
| Back to top |
|
 |
|