laidback01 Posted February 27, 2008 Share Posted February 27, 2008 Hi, I've looked thru the forums for this but cannot find it, so logged in to post a question: I have a pretty stock app that I run a few instances of and send a few key sequences to. So I'd like to "embed" commands in an array and then have them run as though they were code. Here's my source for this: Local $handle[$instances][$steps]=[ ["",ControlClick("","","[ID:1034]"),"","",""], _ ; Window Handle, Button to Click - ID, key sequence to choose for database, Affimation, Choose Printer ["",ControlClick("","","[ID:1040]"),"","",""] ]oÝ÷ ٩ݶ¥¢l~ð«HßÙ¢)àjëh×6; ; Fire up the meditech sessions... Move them around so they are pretty ;) ; ;_Meditech_LogAction("Starting 2 instances of Meditech") for $i = 0 to ($instances-1) Run($application) WinWaitActive("Meditech Health Care Information System") $handle[$i][1] = WinGetHandle("Meditech Health Care Information System") writeOut($handle[$i][1],$workArea&$workFile) ; so we can close the files later. if Mod(10+$i,2) = 0 then WinMove($handle[$i][1],"",$i*100,0) Else WinMove($handle[$i][1],"",-100+$i*100,300) EndIf ; using local Meditech_Login... Meditech_Login($handle[$i][1],"user","pass","","Lookup") ; Next for $i = 0 to ($instances-1) for $j = 1 to ($steps-1) WinActivate($handle[$i][1]) $handle[$i][$j] ; Can code be run like this? doesn't seem it, keeps erroring out, but should ask. ; Check for incorrect windows, etc. Next next Hopefully it makes sense. I wish to actually run a ControlClick("","","[iD:1034]") where I'm referenceing $handle[$i][$j], but the error I get is an assignment error. This does make sense, so is there a way to use the variables in AutoIT to actually hold AutoIT commands? Link to comment Share on other sites More sharing options...
SxyfrG Posted March 5, 2008 Share Posted March 5, 2008 As far as i know there is no way to do this. I suggest making your array call a function with the command inside that function My scripts:AppLauncherTRAY - Awesome app launcher that runs from the system tray NEW VERSION! | Run Length Encoding - VERY simple compression in pure autoit | Simple Minesweeper Game - Fun little game :)My website Link to comment Share on other sites More sharing options...
randallc Posted March 5, 2008 Share Posted March 5, 2008 Hi, "Execute" ? Randall ExcelCOM... AccessCom.. Word2... FileListToArrayNew...SearchMiner... Regexps...SQL...Explorer...Array2D.. _GUIListView...array problem...APITailRW Link to comment Share on other sites More sharing options...
laidback01 Posted July 21, 2008 Author Share Posted July 21, 2008 I have this sorted, I thought I should post it - maybe someone else can use this: I've deleted a lot of this - the idea should be useable though. expandcollapse popup#Include <WinAPI.au3> #include <Array.au3> #Include <Date.au3> #include "Meditech.au3"; Include our list of Standard Meditech Functions. This one is modified to take care of Window Handles. Opt("TrayIconDebug", 1); I like to know what line the script is on when it's all locked up or whatnot. Opt('MustDeclareVars', 1); Keeping things clean and simple. Declare vars at top of script. ; Subtract 1 day from today - this is for correct naming of the reports. Local $sNewDate, $sYear, $sMon, $sDay, $sDateStamp $sNewDate = _DateAdd( 'd',-1, _NowCalcDate()) $sYear=StringLeft($sNewDate,4) $sNewDate=StringTrimLeft($sNewDate,5); remove year and slash $sMon=StringLeft($sNewDate,2); 2 digit month $sNewDate=StringTrimLeft($sNewDate,3); remove month and slash $sDay=StringLeft($sNewDate,2) $sDateStamp = $sYear & $sMon & $sDay ; Variables ; Local $basePath="\\file_srv\CIS-Interface\SP_Com~1\", $Button="[ID:1036]", $menuClass="[CLASS:#32768]", $handlesFile="C:\scratch\winHandles.txt" Local $handle[8][4]=[ ["","{DOWN}{DOWN}{ENTER}","{DOWN}{ENTER}",$basePath&"SP_C_Kal_Open_"&$sDateStamp&".txt"], _ ; Window Handle, Open Accounts, K Database, Output File ["","{DOWN}{DOWN}{ENTER}","{ENTER}",$basePath&"Open_"&$sDateStamp&".txt"], _ ; Window Handle, Open Accounts, H Database ["","{DOWN}{DOWN}{DOWN}{ENTER}","{DOWN}{ENTER}{ENTER}{F12}",$basePath&"_BD_"&$sDateStamp&".txt"], _ ; Window Handle, BD Accounts, K Database ["","{DOWN}{DOWN}{DOWN}{ENTER}","{ENTER}{ENTER}{F12}",$basePath&"BD_"&$sDateStamp&".txt"], _ ; Window Handle, BD Accounts, H Database ["","{DOWN}{DOWN}{DOWN}{DOWN}{ENTER}","{DOWN}{ENTER}{ENTER}{F12}",$basePath&"_Resolved_"&$sDateStamp&".txt"], _ ; Window Handle, Resolved Accounts, K Database ["","{DOWN}{DOWN}{DOWN}{DOWN}{ENTER}","{ENTER}{ENTER}{F12}",$basePath&"SP_C_Resolved_"&$sDateStamp&".txt"], _ ; Window Handle, Resolved Accounts, H Database ["","{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{ENTER}","{DOWN}{ENTER}{ENTER}{F12}",$basePath&"SP_C_Transaction_"&$sDateStamp&".txt"], _ ; Window Handle, SP Transactions, K Database ["","{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{ENTER}","{ENTER}{ENTER}{F12}",$basePath&"SP_C_Transaction_"&$sDateStamp&".txt"] ]; Window Handle, Transactions, H Database Local $application="C:\Program Files\Meditech\MagicCS\Client\VMAGIC.EXE"; full path of Meditech - abstract this out if possible. If Not($filesCreated) Then ; ; Fire up the meditech sessions... Move them around so they are pretty;) ; _Meditech_LogAction("Starting 8 instances of Meditech") for $i = 0 to 7 Run($application) WinWaitActive("Meditech Health Care Information System") $handle[$i][0] = WinGetHandle("Meditech Health Care Information System") writeOut($handle[$i][0],$handlesFile); so we can close the files later. if Mod(10+$i,2) = 0 then WinMove($handle[$i][0],"",$i*100,0) Else WinMove($handle[$i][0],"",-100+$i*100,300) EndIf ; using our local Meditech_Login, not the one from the au3... it's kinda crappy. Meditech_Login($handle[$i][0],"username","pa$$word","","Lookup"); Next Link to comment Share on other sites More sharing options...
Paulie Posted July 21, 2008 Share Posted July 21, 2008 Isn't there an "AutoitExecuteLine" or something? Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now