AutoHotkey Community

It is currently May 27th, 2012, 7:12 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 6 posts ] 
Author Message
PostPosted: September 29th, 2004, 3:59 am 
Offline

Joined: September 18th, 2004, 5:32 am
Posts: 133
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
}


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 29th, 2004, 12:48 pm 
Offline

Joined: March 2nd, 2004, 3:36 pm
Posts: 10720
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.
}


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 29th, 2004, 7:32 pm 
Offline

Joined: September 4th, 2004, 8:44 pm
Posts: 74
Location: UK
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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 7th, 2004, 5:39 pm 
Offline

Joined: September 18th, 2004, 5:32 am
Posts: 133
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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 8th, 2004, 12:09 am 
Offline

Joined: September 4th, 2004, 8:44 pm
Posts: 74
Location: UK
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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 8th, 2004, 4:43 pm 
Offline

Joined: September 18th, 2004, 5:32 am
Posts: 133
Thanks Jack - much appreciated!


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: Exabot [Bot], Leef_me, sjc1000 and 77 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group