The following code works as far as reading the .csv file, parsing, and sending the data to the data entry screen. What I need is for the loop to pause when the cursor reaches the Save button, send mouseclick on the Save button, reopen the screen, and then resume the loop. How can I insert a pause so I can send keystokes and then resume the loop?
WinWait, Individual Service Entry (Version Q),
IfWinNotActive, Individual Service Entry (Version Q), , WinActivate, Individual Service Entry (Version Q),
WinWaitActive, Individual Service Entry (Version Q),
MouseClick, left, 96, 55
Sleep, 100
Loop, Read, R:\AutoHotKey\Import\Test.csv
{
Loop, parse, A_LoopReadLine, CSV
{
WinActivate, Individual Service Entry (Version Q),
SetKeyDelay -1, 0
Send, {CAPSLOCK}%A_LoopField%{TAB}
Sleep, 500
}
}
read .csv file, parse, send, pause
Started by
surfbum3000
, Nov 09 2005 06:25 PM
10 replies to this topic
#1
-
Posted 09 November 2005 - 06:25 PM
How is the cursor getting to the save button? Do you move your mouse over that button?
#2
-
Posted 09 November 2005 - 06:32 PM
Ciao
toralf
I use the latest AHK version (1.1.15+)
Please ask questions in forum on ahkscript.org. Why?
For online reference please use these Docs.
toralf
I use the latest AHK version (1.1.15+)
Please ask questions in forum on ahkscript.org. Why?
For online reference please use these Docs.
Since the code is sending a Tab between fields, the cursor will eventually come to the Save button. When it gets there, I need the code to send a keystoke {ENTER} or a MouseClick.
#3
-
Posted 11 November 2005 - 02:59 PM
web or app?the data entry screen
I'd prefer to "kick the butt'on" using one of AHK's Control commands if possible!
Once that's done, try to trigger the refreshed/reloaded data entry screen and if caught successfully ... play it again Sam :wink:
#4
-
Posted 11 November 2005 - 03:05 PM
It's an application installed on my workstation.
#5
-
Posted 11 November 2005 - 06:35 PM
This code is close to what I need it to do but I'm not quite there yet. The code reads the text file, parses it, sends the variable to the correct field on the screen named Individual Service Entry (Version Q). After the first line of text, I need the code to pause, then click the Save button, and then reopen the window Individual Service Entry (Version Q) for the next line of data entry. The code below does this, but after the MouseClick on the Save button, the cursor jumps down the page for about 10 lines, then reopens the data entry window. I would like for it to stop clicking in each successive line on the screen before it reopens the Individual Service Entry (Version Q). Any idea as to why the cursor moves down the screen 10 times before the MouseClick works?
*********************************************
*********************************************
WinWait, Scheduler Live [Single Day View], IfWinNotActive, Scheduler Live [Single Day View], , WinActivate, Scheduler Live [Single Day View], WinWaitActive, Scheduler Live [Single Day View], MouseClick, right, 275, 481 Sleep, 100 WinActivate ; Uses the last found window. MouseClick, left, 363, 526 Sleep, 100 WinWait, Individual Service Entry (Version Q), IfWinNotActive, Individual Service Entry (Version Q), , WinActivate, Individual Service Entry (Version Q), WinWaitActive, Individual Service Entry (Version Q), MouseClick, left, 96, 55 Sleep, 100 Loop, Read, R:\AutoHotKey\Import\Test.csv { Loop, parse, A_LoopReadLine, CSV { WinActivate, Individual Service Entry (Version Q), SetKeyDelay -1, 0 Send, {CAPSLOCK}%A_LoopField%{TAB} Sleep, 500 } ControlFocus, DFButton1, Individual Service Entry (Version Q); Set focus to the Save button MouseClick, left, 313, 534 Sleep, 100 MouseClick, right, 303, 482 Sleep, 100 }
#6
-
Posted 16 November 2005 - 05:21 PM
Ok, fiddled around with it a bit, restructured it and removed all that I thought unnecessary... untested ofcourse ...
One note: you are depending on the amount of fields in the csv-file for the filling of the fields in the entry window now, if the file contains too many fields, the script will malfunction...
One note: you are depending on the amount of fields in the csv-file for the filling of the fields in the entry window now, if the file contains too many fields, the script will malfunction...
MainWindowTitle = Scheduler Live [Single Day View] EntryWindowTitle = Individual Service Entry (Version Q) WinActivate, %MainWindowTitle% ; Activate your 'main' window WinWaitActive,,,10 IfEqual, ERRORLEVEL, 1, MsgBox, Timeout... ; Wait until it's active, show a message box if timed out. ;MouseClick, right, 275, 481 ; ??? ??? Scriptrecorder thingy? ; now the action Loop, Read, R:\AutoHotKey\Import\Test.csv { WinActivate, %MainWindowTitle% MouseClick, left, 363, 526 ; Opens the entry window I guess, can probably be done differently. ; Avoid using the mouse if possible. WinWaitActive, %EntryWindowTitle%,,10 IfEqual, ERRORLEVEL, 1, MsgBox, Timeout... ; Wait until the entry window is active, show a message box if timed out. MouseClick, left, 96, 55 ; first entry field? you can probably use Send, {Tab} SetKeyDelay -1, 0 Loop, parse, A_LoopReadLine, CSV { Send, %A_LoopField%{TAB} ; {CAPSLOCK} ? Scriptrecorder ? Sleep, 500 ; try tweaking this for speed } ControlFocus, DFButton1, Individual Service Entry (Version Q); Set focus to the Save button Send, {Enter} }
#7
-
Posted 16 November 2005 - 07:05 PM
Thank you not-logged-in-daonlyfreez. Your suggestions were very good. I had to modify the code a bit to get it to work, but it now does what I need it to do. I could never get the ControlFocus to work, so I just used MouseClick. I used AutoScriptWriter to discover what code AHK is using to perform some of the tasks I needed it to do since I am new to this.
MainWindowTitle = Scheduler Live [Single Day View] EntryWindowTitle = Individual Service Entry (Version Q) WinActivate, %EntryWindowTitle% ; Activate your 'main' window Loop, Read, R:\AutoHotKey\Import\Test.csv { WinActivate, %EntryWindowTitle% MouseClick, left, 363, 526 ; Opens the entry window I guess, can probably be done differently. ; Avoid using the mouse if possible. WinWaitActive, %EntryWindowTitle%,,10 IfEqual, ERRORLEVEL, 1, MsgBox, Timeout... ; Wait until the entry window is active, show a message box if timed out. MouseClick, left, 96, 55 ; first entry field? you can probably use Send, {Tab} SetKeyDelay -1, 0 Loop, parse, A_LoopReadLine, CSV { Send, %A_LoopField%{TAB} ; {CAPSLOCK} ? Scriptrecorder ? Sleep, 500 ; try tweaking this for speed } MouseClick, left, 303, 535; this opens a menu window Sleep, 1000 MouseClick, right, 239, 354; this selects the menu option Individual Service Entry (Version Q) Sleep, 1000 WinWait, Scheduler Live [Single Day View], IfWinNotActive, Scheduler Live [Single Day View], , WinActivate, Scheduler Live [Single Day View], WinWaitActive, Scheduler Live [Single Day View], MouseClick, left, 362, 395; Click on the Save button Sleep, 1000 }
#8
-
Posted 17 November 2005 - 05:56 PM
Does your app support keyboard shortcuts (e.g. Alt+s for save)?
#9
-
Posted 17 November 2005 - 07:35 PM
Ciao
toralf
I use the latest AHK version (1.1.15+)
Please ask questions in forum on ahkscript.org. Why?
For online reference please use these Docs.
toralf
I use the latest AHK version (1.1.15+)
Please ask questions in forum on ahkscript.org. Why?
For online reference please use these Docs.
ControlFocus, DFButton1, Individual Service Entry (Version Q) ControlClick, DFButton1, Individual Service Entry (Version Q) ; or ; ControlSend, DFButton1, {ENTER}, Individual Service Entry (Version Q) ; or ; Control, Check,, DFButton1, {ENTER}, Individual Service Entry (Version Q) ; I've no idea why - but it works as a click regardless that its not a radio button or checkbox as mentioned at the helpHave a try with one of AHK's Control commands instead of using mouse clicks. Thx for listening. 8)
#10
-
Posted 17 November 2005 - 08:34 PM
Wrong:
Corrected:
Control, Check,, DFButton1, {ENTER}, Individual Service Entry (Version Q):oops:
Corrected:
Control, Check,, DFButton1, Individual Service Entry (Version Q)
#11
-
Posted 17 November 2005 - 08:37 PM