ioa747 Posted July 16, 2023 Share Posted July 16, 2023 (edited) FormCompletion GUI assistant for Form Completion a tool - aid for filling in details in online shopping we can easily add new elements, (by adding new keys to the ini file) e.g. VATnumber=1234567890 expandcollapse popup; https://www.autoitscript.com/forum/topic/210568-formcompletion/ ;---------------------------------------------------------------------------------------- ; Title...........: FormCompletion.au3 ; Description.....: GUI assistant for Form Completion ; AutoIt Version..: 3.3.16.1 Author: ioa747 ;---------------------------------------------------------------------------------------- #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Icon=CodeWiz.ico #AutoIt3Wrapper_Res_ProductName=FormCompletion.au3 #AutoIt3Wrapper_Res_Fileversion=0.0.0.1 #AutoIt3Wrapper_Res_Description=GUI assistant for Form Completion #AutoIt3Wrapper_AU3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7 #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <FileConstants.au3> #include <MsgBoxConstants.au3> #include <Misc.au3> If _Singleton(@ScriptName, 1) = 0 Then Exit ; to avoid running it multiple times! ; Read the INI file for the value of 'Elements' Global $MyIni = @ScriptDir & "\FormCompletion.ini" Global $aElements = Elements_ReadIni() Global $iStep = 25 ConsoleWrite("$aElements[0][0]=" & $aElements[0][0] & @CRLF) #Region === GUI section === Global $MyGui = GUICreate("FormCompletion", $iStep * 8, ($aElements[0][0] * $iStep) + $iStep + 1, -1, -1, -1, BitOR($WS_EX_TOOLWINDOW, $WS_EX_TOPMOST)) Global $id_EditIni = GUICtrlCreateButton(" 📂 ", 1, 1, $iStep + $iStep, 22, $BS_VCENTER) GUICtrlSetTip(-1, "📂 Edit ini") GUICtrlSetFont(-1, 12) Global $id_Reload = GUICtrlCreateButton(" ♻ ", 2 * $iStep, 1, $iStep + $iStep, 22, $BS_VCENTER) GUICtrlSetTip(-1, "♻ Reload GUI") GUICtrlSetFont(-1, 12) Global $id_Previous = GUICtrlCreateButton(" ◀ ", 4 * $iStep, 1, $iStep + $iStep, 22, $BS_VCENTER) GUICtrlSetTip(-1, "◀ Previous") GUICtrlSetFont(-1, 12) Global $id_Next = GUICtrlCreateButton(" ▶ ", 6 * $iStep, 1, $iStep + $iStep, 22, $BS_VCENTER) GUICtrlSetTip(-1, "▶ Next") GUICtrlSetFont(-1, 12) For $i = 1 To $aElements[0][0] $aElements[$i][3] = GUICtrlCreateButton($aElements[$i][1], 1, $i * $iStep, 198, 22, $BS_VCENTER) GUICtrlSetTip(-1, $aElements[$i][1], $aElements[$i][2] & ": ") Next #EndRegion === GUI section === GUISetState(@SW_SHOW) Global $nMsg, $hActiveWin, $sActiveTitle, $ClipBack $ClipBack = ClipGet() ; backup clip data ; Loop until the user exits. ;*********************************************************************** While 1 If WinGetHandle("[ACTIVE]") <> $hActiveWin And WinGetHandle("[ACTIVE]") <> $MyGui Then $hActiveWin = WinGetHandle("[ACTIVE]") ;ConsoleWrite("$hActiveWin=" & $hActiveWin & @CRLF) $sActiveTitle = WinGetTitle($hActiveWin) ConsoleWrite("$sActiveTitle=" & $sActiveTitle & @CRLF) EndIf $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE ExitLoop Case $id_EditIni ShellExecute($MyIni) Case $id_Reload _Restart() Case $id_Previous WinActivate($hActiveWin) Send("+{TAB}") Case $id_Next WinActivate($hActiveWin) Send("{TAB}") Case $aElements[1][3] To $aElements[1][3] + $aElements[0][0] - 1 $ClipBack = ClipGet() ; backup clip data ; Add new data to the clipboard. ClipPut($aElements[$nMsg - 6][1]) Sleep(100) WinActivate($hActiveWin) Send("^v") ; paste ClipPut($ClipBack) ; restore clip data ;ConsoleWrite("$nMsg=" & $nMsg & @CRLF) EndSwitch Sleep(10) WEnd ;*********************************************************************** Exit ;---------------------------------------------------------------------------------------- Func Elements_ReadIni() Local $iniFileExists = FileExists($MyIni) Local $index = 0 Local $aArray[1][4] $aArray[0][0] = $index $aArray[0][1] = "Element" $aArray[0][2] = "label" $aArray[0][3] = "ID" ;Checks if .ini not exists then make one. If Not $iniFileExists Then ;Open the file for writing (append to the end of a file) and store the handle to a variable. Local $hFileOpen = FileOpen($MyIni, $FO_APPEND) If $hFileOpen = -1 Then MsgBox($MB_SYSTEMMODAL, "", "An error occurred while writing the " & $MyIni & ".ini") Exit EndIf ;Write Example data to the ini file FileWrite($hFileOpen, "[Elements]" & @CRLF) FileWrite($hFileOpen, "Email=StephenKing@gmail.com" & @CRLF) FileWrite($hFileOpen, "FirstName=Stephen" & @CRLF) FileWrite($hFileOpen, "LastName=King" & @CRLF) FileWrite($hFileOpen, "Phone=0123456789" & @CRLF) FileWrite($hFileOpen, "Born=21-09-1947" & @CRLF) FileWrite($hFileOpen, "Adress=452 SE 10th Ave, Hillsboro" & @CRLF) FileWrite($hFileOpen, "City=Hillsboro" & @CRLF) FileWrite($hFileOpen, "PostCode=97003" & @CRLF) FileWrite($hFileOpen, "Area=Oregon market" & @CRLF) ;Close the handle returned by FileOpen. FileClose($hFileOpen) Sleep(100) EndIf ; Read the INI section labelled 'Elements'. This will return a 2 dimensional array. Local $aIniArray = IniReadSection($MyIni, "Elements") ; Check if an error occurred. If Not @error Then ; Enumerate through the array displaying the keys and their respective values. For $i = 1 To $aIniArray[0][0] ReDim $aArray[UBound($aArray) + 1][4] $aArray[0][0] = $i $aArray[$i][0] = $i $aArray[$i][1] = $aIniArray[$i][1] $aArray[$i][2] = $aIniArray[$i][0] Next EndIf Return $aArray EndFunc ;==>Elements_ReadIni ;----------------------------------------------------------------------------------- Func _Restart() ; Restart If @Compiled Then Run('"' & FileGetShortName(@ScriptFullPath) & '"') Else Run('"' & FileGetShortName(@AutoItExe) & '" /AutoIt3ExecuteScript "' & FileGetShortName(@ScriptFullPath) & '"') EndIf Exit EndFunc ;==>_Restart ;-------------------------------------------------------------------------------------------- Please, leave your comments and experiences here. thank you very much ! Edited July 17, 2023 by ioa747 UpDate to version=0.0.0.1 Skeletor 1 I know that I know nothing Link to comment Share on other sites More sharing options...
Skeletor Posted July 19, 2023 Share Posted July 19, 2023 Very impressed. I used it on a web form I just could not get the controls on, but this worked. I'm going to automate this feature in my upcoming project. Kind RegardsSkeletor "Coffee: my defense against going postal." Microsoft Office Splash Screen | Basic Notepad Program (Beginner) | Transparent Splash Screen | Full Screen UI Link to comment Share on other sites More sharing options...
ioa747 Posted July 19, 2023 Author Share Posted July 19, 2023 I'm glad you like it. Thanks for the interaction I know that I know nothing 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