4 posts in this topic
I want creat GUI, have button 1 to 10, but only use loop for ... to ... step ... next.
I've made a library, based on AutoItObject UDF with the goal of implementing getter and setter functionality and make it possible to define new object properties in as few steps as possible.
Thank you to @trancexx for getting me on the right track, and all users in Hooking into the IDispatch interface for the code to get me going.
If I've forgotten to add credit, please let me know
Things to be added
Garbage collection Method support Support for more/all AutoIt variable-types Accessors Inheritance equivalent of @error and @extended Example:
#include <AutoItObject_Internal.au3> $oIDispatch = IDispatch() $__getter = DllCallbackRegister(CustomGetter, "long", "IDispatch;IDispatch") $__setter = DllCallbackRegister(CustomSetter, "long", "IDispatch;IDispatch") $oIDispatch.__defineGetter("a", $__getter) $oIDispatch.__defineSetter("a", $__setter) $oIDispatch.a = "start" MsgBox(0, "", $oIDispatch.a) $oIDispatch.a = "end" MsgBox(0, "", $oIDispatch.a) $oIDispatch.b = 3.14 $oIDispatch.b += $oIDispatch.b MsgBox(0, "", $oIDispatch.b) $oIDispatch.__defineMethod("c", FuncName(MsgBox)) $oIDispatch.c(0, "title", "text") Func CustomGetter($oIDispatch, $oIDispatch2);(return.value, this.value) $oIDispatch.a = "_" & $oIDispatch2.a & "_" EndFunc Func CustomSetter($oIDispatch, $oIDispatch2);(this.value, caller.value) $oIDispatch.a &= $oIDispatch2.a EndFunc
Edit2 (19th March 2017):
First of all, sorry about the lack of updates on this project. I always start too many projects and end up ignoring old projects, if I run into problems ^^'.
So I've started moving my AutoIt scripts to GitHub. I will still post the most recent script version here.
I keep losing the count of my $r varable when I go into the dropdown () function and call the same function.
#include <Excel.au3> #include <AutoItConstants.au3> #include<GUIConstantsEx.au3> #include<EditConstants.au3> #include<GUIConstants.au3> Global $iBox, $oExcel, $oWorkbook, $r = 1, $x = 3 HowMany() Excel () Dropdown () Sleep (500) Func Dropdown () $list = GUICreate("Chart", 225, 80) $combobox = GUICtrlCreateCombo("Clinic 1", 10, 10, 120, 20) GUICtrlSetData(-1, "Clinic 2|Clinic 3|Clinic 4") $button = GUICtrlCreateButton("Select", 10, 40, 60, 20) GUISetState(@SW_SHOW) While 1 $guibox = GUIGetMsg() Select Case $guibox = $button Select Case GUICtrlRead($combobox) = "Clinic 1" GUIDelete($list) Auto () EndSelect Case $guibox = $GUI_EVENT_CLOSE EndSelect WEnd EndFunc Func HowMany() Local $iMsg While 1 ;~ Turn input into a number $iBox = Number(InputBox ("Regestration", "How Many Patients are there total?")) ;~ If user enters a string or cancels then get them to try again If $iBox = 0 Then $iMsg = MsgBox(1,'Regestration', 'Please enter a valid number') If $iMsg = 2 Then Exit Else ExitLoop EndIf WEnd EndFunc Func Excel() While ProcessExists("EXCEL.EXE") $ms = MsgBox(5,"","Process error. You have an Excel sheet open. You must close it in order to let this program work. Please close it now.") If $ms=2 Then Exit ;~ Doesn't require sleep since the script is paused by the MsgBox above ;~ Sleep(250) WEnd ;~ Shouldn't use Global Scope inside functions moved to top of script Local $sExcelFile = FileOpenDialog("Choose/Create Excel File", @ScriptDir, "(*.xlsx)") If FileExists($sExcelFile) Then ;~ Shouldn't use Global Scope inside functions moved to top of script $oExcel = _Excel_Open () $oWorkbook = _Excel_BookOpen($oExcel,$sExcelFile) ;this will open the chosen xls file. Else $oExcel = _Excel_Open() $oWorkbook = _Excel_BookNew($oExcel, 2);this is here to create the xls file if it does not exist. EndIf EndFunc Func Auto() Local $aArray1 = _Excel_RangeRead($oWorkbook) ;~ If $iBox is greater than no. of rows in $aArray then $iBox equals the number of rows in $aArray If $iBox > (UBound($aArray1) - 1) Then $iBox = UBound($aArray1) - 1 For $i = 2 To UBound($aArray1) - 1 ;$i =0 Start from row A If $aArray1[$i] = "" Then Continueloop $sR0 = $aArray1[$i] ;status $sR1 = $aArray1[$i] ;Last Name $sR2 = $aArray1[$i] ;First Name $sR3 = $aArray1[$i] ;DOB $sR4 = $aArray1[$i] ;Sex $sR5 = $aArray1[$i] ;Mailling Address $sR6 = $aArray1[$i] ;Zip $sR7 = $aArray1[$i] ;Phone # $sR8 = $aArray1[$i] ;Visit Reason $sR9 = $aArray1[$i] ;Insurance $sR10 = $aArray1[$i] ;Clinic $sR11 = $aArray1[$i] ;Provider $sR12 = $aArray1[$i] ;Appt Time $sR13 = $aArray1[$i] ;Appt Date WinWaitActive ("Untitled - Notepad") ControlSend("Untitled - Notepad", "", "", $sR1 & ',' & $sR2 & @CR) $r += 1 If $r > $iBox Then Exit Dropdown () Next EndFunc so the second time I choose clinic 1 I want it to go to the next row which would be Champ brett in my example excel.
I am new to AutoIt and programming in general so any help would be greatly appreciated!
I am trying to create a script mainly using MouseClick and WinWait in order to automate some web processes. However, due to the lag time of the web pages and fields, sometimes my script does not run properly and I need to rerun it. I am trying to create a script that will check to see if the final line of the script was properly executed and if not, rerun the program and increase a count. Ultimately I would like some sort of report that tells me how many times it took to run to completion and total time.
Does anyone have any suggestions as to which functions I can use to accomplish this? I am also open to any suggestions on a better process to ensure that my program runs to completion.
Thanks in advance!