
LisHawj
Active Members-
Posts
101 -
Joined
-
Last visited
Everything posted by LisHawj
-
This is script is used with the new Microsoft AutoPilot to provision PCs for our environment, so it is running from the PC that is getting provisioned. Due to the way AutoPilot work the PC naming convention is completely different and vital information is missing in the Active Directory object property fields for AutoPilot provisioned PCs. I have tested this on my own admin PC and the script does work running as a normal domain account with local admin privilege. However, when I run a CMD window under NT Authority\System and run my script to test it. I get the aforementioned error on my admin PC. Your method is definitely an alternative to consider, but I did not want (at least for now) to create a list that needs to be maintained and/or processed separately later. Any additional tips is much appreciated. Thank you very much in advance.
-
Thanks for the tip on using WMI. That did the trick for getting the logged on username. My script is updated and again it works when not using NT Authority credential, but now I have a different error that pops up when running under NT Authority. It gets all the way down to the "AD_ModifyAttribute" line and then it returns an error (see PIC). My updated script is as follow. I cannot seem to find any information on the Return Code in the screenshot. Any additional tips that may help me? Error Code: _WinAPI_Wow64EnableWow64FsRedirection(False) #include <AD.au3> #include <WinAPIFiles.au3> ; Script Start - Add your code below here Global $sDescription, $aEmail, $sEID, $iValue, $sEmail $wbemFlagReturnImmediately = 0x10 $wbemFlagForwardOnly = 0x20 $colItems = "" $strComputer = "localhost" $Output = "" $objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\cimv2") $colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_ComputerSystem", "WQL", _ $wbemFlagReturnImmediately + $wbemFlagForwardOnly) If IsObj($colItems) Then For $objItem In $colItems $Output = $objItem.UserName & @CRLF Next $Output = StringTrimLeft($Output, 6) $sEID = StringStripWS($Output, 8) Else MsgBox(0, "WMI Output", "No WMI Objects Found for class: " & "Win32_ComputerSystem") EndIf _AD_Open() If @error Then Exit MsgBox(16, "Active Directory result", "Script function _AD_Open encountered a problem. @error = " & @error & ", @extended = " & @extended) $aProperties = _AD_GetObjectProperties(@ComputerName & "$") $sComputerName = @ComputerName $aEmail = _AD_GetObjectsInOU("", "(SAMAccountname=" & $sEID & ")", 2, "mail", "") For $i = 1 To UBound($aEmail) - 1 If StringInStr($aEmail[$i], "E") Then $sEmail = $aEmail[$i] ElseIf StringInStr($aEmail[$i], "LC") Then $sEmail = $aEmail[$i] EndIf ExitLoop Next msgbox(0,"",$sEmail) $sDescription = $sEmail & " - " & $sComputerName ; Change attribute Description field. $iValue = _AD_ModifyAttribute($sComputerName & "$", "description", $sDescription, 2) If $iValue = 1 Then MsgBox(64, "Active Directory Functions", "Description for computer '" & $sComputerName & "' successfully changed") ElseIf @error = 1 Then MsgBox(64, "Active Directory Functions", "Computer '" & $sComputerName & "' does not exist") Else MsgBox(64, "Active Directory Functions", "Return code '" & @error & "' from Active Directory") EndIf _AD_Close()
-
Good evening, folks. The following script is used to update thousands of Active Directory computer objects that is missing information in the Description field. The script runs and works when launched by a logged in user. However, the script does not perform as intended when it is run as an AutoPilot application. In AutoPilot the script is running under the NT Authority\System account. Is there a method in AutoIT that allows me to use macro like @Username to grab the currently logged in user while the script is running under NT Authority\System? Maybe I am overlooking something simple here and appreciate the available help/insights. Thank you. Global $sDescription, $aEmail, $sEID, $iValue, $sEmail _AD_Open() If @error Then Exit MsgBox(16, "Active Directory result", "Script function _AD_Open encountered a problem. @error = " & @error & ", @extended = " & @extended) $aProperties = _AD_GetObjectProperties(@ComputerName & "$") $sEID = @Username $sComputerName = @ComputerName $aEmail = _AD_GetObjectsInOU("", "(SAMAccountname=" & $sEID & ")", 2, "mail", "") For $i = 1 To UBound($aEmail) - 1 If StringInStr($aEmail[$i], "E") Then $sEmail = $aEmail[$i] ElseIf StringInStr($aEmail[$i], "LC") Then $sEmail = $aEmail[$i] EndIf ExitLoop Next $sDescription = $sEmail & " - " & $sComputerName ;Insert description information here for production environment. ; Change attribute Description field. $iValue = _AD_ModifyAttribute($sComputerName & "$", "description", $sDescription) If $iValue = 1 Then MsgBox(64, "Active Directory Result", "Description for computer '" & $sComputerName & "' successfully changed") ElseIf @error = 1 Then MsgBox(64, "Active Directory Result", "Computer '" & $sComputerName & "' does not exist") Else MsgBox(64, "Active Directory Result", "Return code '" & @error & "' from Active Directory") EndIf
-
UI Automation, wait for element to be visible.
LisHawj replied to LisHawj's topic in AutoIt General Help and Support
@seadoggie01 - I wished I am as proficient as most of the members of this forum. Your gift above worked beautifully for me. Thank you so very much. -
UI Automation, wait for element to be visible.
LisHawj replied to LisHawj's topic in AutoIt General Help and Support
Hmmm...Just found UIA_Winwinwaitactive(), testing.... -
Is there a function in UI Automation that I can use to pause a script until an element is loaded or becomes visible before proceeding with the rest of the code? We have thousands of computers and some of them are not the latest and greatest so it takes anywhere from an extra 15 seconds to as high as 120 seconds before the next element/control becomes visible on some devices. This is wreaking havoc on my newbie brain. I have included the part of the code that I need help with below. Any insights and advices are much appreciated. ConsoleWrite("--- Find Windows Security Prompt window/control ---" & @CRLF) While 1 If Not WinWaitActive("Windows Security") Then Sleep(500) Else ExitLoop EndIf WEnd Local $pCondition3 $oUIAutomation.CreatePropertyCondition($UIA_NamePropertyId, "Windows Security", $pCondition3) If Not $pCondition3 Then Return ConsoleWrite("$pCondition3 ERR" & @CRLF) ConsoleWrite("$pCondition3 OK" & @CRLF) Sleep(500) Local $pWindow2, $oWindow2 $oWindow1.FindFirst($TreeScope_Descendants, $pCondition3, $pWindow2) $oWindow2 = ObjCreateInterface($pWindow2, $sIID_IUIAutomationElement, $dtag_IUIAutomationElement) If Not IsObj($oWindow2) Then Return ConsoleWrite("$oWindow2 ERR" & @CRLF) ConsoleWrite("$oWindow2 OK" & @CRLF) Sleep(500) ConsoleWrite("--- Find Confirm Certificate OK Button window/control ---" & @CRLF) Local $pCondition4 $oUIAutomation.CreatePropertyCondition($UIA_AutomationIdPropertyId, "OkButton", $pCondition4) If Not $pCondition4 Then Return ConsoleWrite("$pCondition4 ERR" & @CRLF) ConsoleWrite("$pCondition4 OK" & @CRLF) Sleep(500) Local $pButton3, $oButton3 $oWindow2.FindFirst($TreeScope_Descendants, $pCondition4, $pButton3) $oButton3 = ObjCreateInterface($pButton3, $sIID_IUIAutomationElement, $dtag_IUIAutomationElement) If Not IsObj($oButton3) Then Return ConsoleWrite("$oButton3 ERR" & @CRLF) ConsoleWrite("$oButton3 OK" & @CRLF) Sleep(500) ConsoleWrite("--- Invoke Confirm Certificate OK Button Pattern (action) Object ---" & @CRLF) Local $pInvokePattern3, $oInvokePattern3 $oButton3.GetCurrentPattern($UIA_InvokePatternId, $pInvokePattern3) $oInvokePattern3 = ObjCreateInterface($pInvokePattern3, $sIID_IUIAutomationInvokePattern, $dtag_IUIAutomationInvokePattern) If Not IsObj($oInvokePattern3) Then Return ConsoleWrite("$oInvokePattern3 ERR" & @CRLF) ConsoleWrite("$oInvokePattern3 OK" & @CRLF) $oInvokePattern3.Invoke() Sleep(2000) ;========= Need a pause/function here to verify the NEXT button is visible before proceeding ====== Sleep(30000) ;using sleep to test ;================================================================================================== ConsoleWrite( "--- Find Next Button window/control ---" & @CRLF ) Local $pCondition5 $oUIAutomation.CreatePropertyCondition( $UIA_NamePropertyId, "Next", $pCondition5 ) If Not $pCondition5 Then Return ConsoleWrite( "$pCondition5 ERR" & @CRLF ) ConsoleWrite( "$pCondition5 OK" & @CRLF ) Sleep(500) Local $pButton4, $oButton4 $oDesktop.FindFirst( $TreeScope_Descendants, $pCondition5, $pButton4 ) $oButton4 = ObjCreateInterface( $pButton4, $sIID_IUIAutomationElement, $dtag_IUIAutomationElement ) If Not IsObj( $oButton4 ) Then Return ConsoleWrite( "$oButton4 ERR" & @CRLF ) ConsoleWrite( "$oButton4 OK" & @CRLF ) Sleep(500) ConsoleWrite( "--- Invoke Next Button Pattern (action) Object ---" & @CRLF ) Local $pInvokePattern4, $oInvokePattern4 $oButton4.GetCurrentPattern( $UIA_InvokePatternId, $pInvokePattern4 ) $oInvokePattern4 = ObjCreateInterface( $pInvokePattern4, $sIID_IUIAutomationInvokePattern, $dtag_IUIAutomationInvokePattern ) If Not IsObj( $oInvokePattern4 ) Then Return ConsoleWrite( "$oInvokePattern4 ERR" & @CRLF ) ConsoleWrite( "$oInvokePattern4 OK" & @CRLF ) $oInvokePattern4.Invoke() Sleep(2000)
-
Unable to invoke app in UI Automation. Need Help.
LisHawj replied to LisHawj's topic in AutoIt General Help and Support
@LarsJ - Thank you for pointing out the documentation error and linking to the correct one. I'll read up on the links you've provided. This was absolutely driving me nuts. Again, thank you! -
I have 25 applications .exe on some 30,000+ PCs that my company is testing to ensure they're all working due to changes the SCCM team is planning to rolling out. I have started the following UI Automation script to check for a test app, 7Zip, launch it, and capture the console output and write the result to a log. I cannot get it to invoke the application to launch. Everything else works, right up until the launching/invoking of the application. I have very limited understanding of UI Automation (just started learning) and have read and study as much as I can about it from https://docs.microsoft.com/en-us/dotnet/framework/ui-automation/ui-automation-fundamentals. I am using Larsj and Junkew's UIA UDF. Any help is much appreciated. #cs ---------------------------------------------------------------------------- AutoIt Version: 3.3.14.5 Author: myName Script Function: Template AutoIt script. #ce ---------------------------------------------------------------------------- ; Script Start - Add your code below here #AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7 ;#AutoIt3Wrapper_UseX64=n ; If target application is running as 32 bit code ;#AutoIt3Wrapper_UseX64=y ; If target application is running as 64 bit code #include "UIA_Constants.au3" ; Can be copied from UIASpy Includes folder ;#include "UIA_Functions.au3" ; Can be copied from UIASpy Includes folder ;#include "UIA_SafeArray.au3" ; Can be copied from UIASpy Includes folder ;#include "UIA_Variant.au3" ; Can be copied from UIASpy Includes folder #include <file.au3> Opt("MustDeclareVars", 1) Global $fLogfile = "C:\Temp\Logs\AppsCheck.log" If Not FileExists($fLogfile) Then DirCreate("C:\Temp\Logs\") EndIf _Test7zip() Func _Test7zip() ; Create UI Automation object Local $oUIAutomation = ObjCreateInterface($sCLSID_CUIAutomation8, $sIID_IUIAutomation6, $dtag_IUIAutomation6) If Not IsObj($oUIAutomation) Then Return _LogIt("$oUIAutomation ERR" & @CRLF) _LogIt("$oUIAutomation OK" & @CRLF) ; Get Desktop element Local $pDesktop, $oDesktop $oUIAutomation.GetRootElement($pDesktop) $oDesktop = ObjCreateInterface($pDesktop, $sIID_IUIAutomationElement9, $dtag_IUIAutomationElement9) If Not IsObj($oDesktop) Then Return _LogIt("$oDesktop ERR" & @CRLF) _LogIt("$oDesktop OK" & @CRLF) _LogIt("--- Find Start Button window/control ---" & @CRLF) Local $pCondition0 $oUIAutomation.CreatePropertyCondition($UIA_ClassNamePropertyId, "Start", $pCondition0) If Not $pCondition0 Then Return _LogIt("$pCondition0 ERR" & @CRLF) _LogIt("$pCondition0 OK" & @CRLF) Local $pButton1, $oButton1 $oDesktop.FindFirst($TreeScope_Descendants, $pCondition0, $pButton1) $oButton1 = ObjCreateInterface($pButton1, $sIID_IUIAutomationElement9, $dtag_IUIAutomationElement9) If Not IsObj($oButton1) Then Return _LogIt("$oButton1 ERR" & @CRLF) _LogIt("$oButton1 OK" & @CRLF) _LogIt("--- Invoke Start Button Pattern (action) Object ---" & @CRLF) Local $pInvokePattern1, $oInvokePattern1 $oButton1.GetCurrentPattern($UIA_InvokePatternId, $pInvokePattern1) $oInvokePattern1 = ObjCreateInterface($pInvokePattern1, $sIID_IUIAutomationInvokePattern, $dtag_IUIAutomationInvokePattern) If Not IsObj($oInvokePattern1) Then Return _LogIt("$oInvokePattern1 ERR" & @CRLF) _LogIt("$oInvokePattern1 OK" & @CRLF) $oInvokePattern1.invoke() Sleep(1000) _LogIt("--- Find 7-zip Manager window/control ---" & @CRLF) Local $pCondition1 $oUIAutomation.CreatePropertyCondition($UIA_AutomationIdPropertyId, "{493f9f47-e8b3-4f5f-8e13-1bc2c14acee7}", $pCondition1) If Not $pCondition1 Then Return _LogIt("$pCondition1 ERR" & @CRLF) _LogIt("$pCondition1 OK" & @CRLF) Local $pListItem1, $oListItem1 $oDesktop.FindFirst($TreeScope_Descendants, $pCondition1, $pListItem1) $oListItem1 = ObjCreateInterface($pListItem1, $sIID_IUIAutomationElement, $dtag_IUIAutomationElement) If Not IsObj($oListItem1) Then Return _LogIt("$oListItem1 ERR" & @CRLF) _LogIt("$oListItem1 OK" & @CRLF) _LogIt("--- ExpandCollapse 7zip Pattern (action) Object ---" & @CRLF) Local $pExpandCollapsePattern1, $oExpandCollapsePattern1 $oListItem1.GetCurrentPattern($UIA_ExpandCollapsePatternId, $pExpandCollapsePattern1) $oExpandCollapsePattern1 = ObjCreateInterface($pExpandCollapsePattern1, $sIID_IUIAutomationExpandCollapsePattern, $dtag_IUIAutomationExpandCollapsePattern) If Not IsObj($oExpandCollapsePattern1) Then Return _LogIt("$oExpandCollapsePattern1 ERR" & @CRLF) _LogIt("$oExpandCollapsePattern1 OK" & @CRLF) $oExpandCollapsePattern1.Expand() Sleep(1000) _LogIt("--- Invoke 7zip window/control ---" & @CRLF) Local $pCondition2 $oUIAutomation.CreatePropertyCondition($UIA_AutomationIdPropertyId, "W~{6D809377-6AF0-444B-8957-A3773F02200E}\7-Zip\7zFM.exe", $pCondition2) If Not $pCondition2 Then Return _LogIt("$pCondition2 ERR" & @CRLF) _LogIt("$pCondition2 OK" & @CRLF) Local $pCustom1, $oCustom1 $oListItem1.FindFirst($TreeScope_Descendants, $pCondition2, $pCustom1) $oCustom1 = ObjCreateInterface($pCustom1, $sIID_IUIAutomationElement, $dtag_IUIAutomationElement) If Not IsObj($oCustom1) Then Return _LogIt("$oCustom1 ERR" & @CRLF) _LogIt("$oCustom1 OK" & @CRLF) $oCustom1.Invoke() Sleep(1000) EndFunc ;==>_Test7zip Func _LogIt($sText) Local $hFile = FileOpen($fLogfile, 1) _FileWriteLog($hFile, $sText & @CRLF) FileClose($hFile) EndFunc
-
How to disable RED highlight for UIA automation
LisHawj replied to LisHawj's topic in AutoIt General Help and Support
The UDF file you're missing is part of Larsj's UIAspy UDF located at https://www.autoitscript.com/forum/topic/201683-ui-automation-udfs/. Au3info cannot detect the controls I wish to automate, so I am using UIA automation from Junkew and Larsj. -
This is my third week learning to use Lars and Junkew's UIAspy UDF. As many may know there is a red highlight getting drawn around controls and dialog boxes. I have looked at the UIA.CFG file and have changed the Highlight to false, but the red highlights are still being drawn. How do I disable the red highlight from getting drawn during UIA testing? I am running the latest AutoIT version from download section with Windows 10 Enterprise 1909 when testing with Lars and Junkew's UIA UDF. Thank you. P.S. I am aware the misplaced red highlights are due to Windows scaling, but that is not my concern for this post. I just want to disable the red highlight. Edit: I have also set SUT settings for my application(s) in the CFG file (just not shown in this example). ; This is an inifile for UIA wrappers having the configuration defaults ; Debug=true Turn debugging on of off with true/false value ; Highlight=true Turn Highlighting rectangle to true / false ; TODO: AutoStartSUT=true AutoStartSUT is starting all SUT's automatically [Global] Debug=true Debug.file=true Highlight=false AutoStartSUT=false [Multiuser] CFGPerUser=false [Folders] subfolders=false ;System under test settings ; Folder = Location where exe can be found ; Workingdir = Location of the working directory ; exe = Name of the exe to start ; Fullname = Path & name of exe ; Windowstate = minimized, maximized, normal [SUT1] Folder=%Windowsdir%\system32 Workingdir=%Windowsdir%\system32 exe=calc.exe Fullname=%Windowsdir%\system32\calc.exe Parameters= Processname=calc.exe Windowstate=normal [SUT2] Folder=%Windowsdir%\system32 Workingdir=%Windowsdir%\system32 exe=notepad.exe Fullname=%Windowsdir%\system32\notepad.exe Parameters= Processname=notepad.exe Windowstate=normal [SUT3] C:\Program Files (x86) Folder=%programfilesdir%\Microsoft Office\Office14 Workingdir=%programfilesdir%\Microsoft Office\Office14 exe=winword.exe Fullname=%programfilesdir%\Microsoft Office\Office14\winword.exe Parameters= Processname=winword.exe Windowstate=normal
-
ExtMsgBox UDF - how to disable a button(s).
LisHawj replied to LisHawj's topic in AutoIt General Help and Support
@Melba23 - I should had been clearer with my explanation. In my script I have a deferral/snooze function that is called and once the deferral/snooze max count had elapse, then I wanted a certain button to be disabled so the users cannot defer/snooze the task anymore. In my trial and error last evening I did see that there was no way for me to do it without creating a secondary ExtMsgBox when the defferal/snooze count had elapsed. Thank you for the reply. @Skysnake - I am using ExtMsgbox because the standard UDF didn't quite meet my requirements. I am familiar with disabling and enabling GUI using the standard UDF, but wanted to see if there was a similar function within ExtMsgBox. I was not very clear in my explanation, my apology. -
Good afternoon, I downloaded the ExtMsgBox UDF by Melba and wanted to learn how to disable one or more buttons. I could not figure it out and have look through the entire thread about ExtMsgBox Thread by Melba. I may have missed it but I could not find how to disable a button. I used the info tool and identified the button as [CLASS:Button; INSTANCE:3] for the "Hooray!" button but I cannot disable it. How would I use GuiCtrlSetState to disable a button for the sample code below? Any help is appreciated. #include <MsgBoxConstants.au3> #include <GUIConstants.au3> #include <ExtMsgBox.au3> #include <File.au3> #include <IE.au3> _ExtMsgBoxSet(1, 4, -1, -1, 11) $sMsg = "TEST LINE 1" & @CRLF & @CRLF $sMsg &= "TEST LINE 2" & @CRLF & @CRLF $iRetValue = _ExtMsgBox($EMB_ICONSTOP, "Yes|NO|Hooray!", "Buttons Test", $sMsg, 15) ConsoleWrite("Test 4 returned: " & $iRetValue & @CRLF)
-
AutoIT Windows Info Tool & OneDrive
LisHawj replied to LisHawj's topic in AutoIt General Help and Support
@FrancescoDiMuro The product "OneDrive" is installed and updated via SCCM. My script helps the user to set it up after the install by walking them through the OneDrive prompts with helpful directions. The script reads the hidden/visible text to determine where the user is at and pop up a useful message to guide them alone. It's a lot of hand holding but that is what is mandated by senior management. @seadoggie01 We're currently on a hybrid domain with a testing domain on Azure AD and the production on local/on-site. I'm also testing AutoPilot, Intune, and Azure AD. My script is primarily for the on-site domain, so we cannot use features from Azure AD to deploy to the on-site domain yet. One day in the near future I should be able to utilize it. I reviewed Junkew's UI Automation work and it's a definitely over my head. I'm trying to follow the tutorial and am having problem understanding how to automate the calculator. Let me continue to re-read and slowly digest the information again. -
AutoIT Windows Info Tool & OneDrive
LisHawj replied to LisHawj's topic in AutoIt General Help and Support
Thank you, both. I am glad today is Friday and this will give me plenty of time to research both suggestions over the weekend. I WILL more than likely be back with questions after having a chance to read over the contents of both suggestions. :) Thanks!! -
Good afternoon, everyone. I have a script I wrote to automate the setup of OneDrive for Business using the hidden and visible text to provide step by step on-screen instructions for our users. Recently, my company has a need to upgrade to the latest revision of OneDrive version 19.232.1124.10. The script no longer works and I noticed that the AutoIT Windows Info Tool no longer displays control information for OneDrive, specifically hidden/visible text information. Please note my issue may not be a script issue and may be because the script is no longer able to detect the hidden/visible text as the users proceed from one step of the setup process to the next. Does anyone have any suggestions or resolution I may take? I have included a screenshot of the AutoIt Windows Info Tool showing blank/no (for visible and hidden) information for OneDrive below. Thank you.
-
Array / Ubound question, please help.
LisHawj replied to LisHawj's topic in AutoIt General Help and Support
@seadoggie01, Thank you for the advice. In the production script, the departments want "special" spacing between certain sets of buttons. I could use a couple different button arrays in the format Jugador has provided, but it was easier to fix Find and Replace 6 lines. Time permitting, I'll have to revisit the script and write it properly as recommended. Thank you. -
Array / Ubound question, please help.
LisHawj replied to LisHawj's topic in AutoIt General Help and Support
Thank you both for your inputs. I did not know that the first control created used ID 3 by default and I did see that when I ran _WinAPI_GetDlgCtrlID(Guictrlgethandle()). I simply didn't understand it and it all went downhill from there. With your advice I modified my production script as follow and the script is working for me now. Thank you very much. For $i = 3 To 17 GUICtrlSetState($i, $GUI_ENABLE) Next -
I have the following sample script for where I have 16 buttons and initially 15 of the buttons are disabled. I then loop through an array and try to re-enabled the buttons. However, only 13 of the 15 buttons are enabled. An _arraydisplay($aButtons) shows all 15 elements in there. I know it must be something easy for experience folks, but i am not seeing where I went wrong. Can someone help shed light on my sample script? Thank you. #include <ScrollBarConstants.au3> #include <WindowsConstants.au3> #include <ButtonConstants.au3> #include <StaticConstants.au3> #include <AutoItConstants.au3> #include <MsgBoxConstants.au3> #include <GUIConstantsEx.au3> #include <EditConstants.au3> #include <GuiComboBox.au3> #include <GuiRichEdit.au3> #include <GuiButton.au3> #include <Constants.au3> #include <GUIEdit.au3> #include <Array.au3> #include <File.au3> _Start() Func _Start() Global $LHToolBar = GUICreate("Toolbar", 823, 56, -1, -1) Global $Button1 = GUICtrlCreateButton("", 6, 6, 43, 43, $BS_ICON) Global $Button2 = GUICtrlCreateButton("", 55, 6, 43, 43, $BS_ICON) Global $Button3 = GUICtrlCreateButton("", 104, 6, 43, 43, $BS_ICON) Global $Button4 = GUICtrlCreateButton("", 153, 6, 43, 43, $BS_ICON) Global $Button5 = GUICtrlCreateButton("", 202, 6, 43, 43, $BS_ICON) Global $Button6 = GUICtrlCreateButton("", 257, 6, 43, 43, $BS_ICON) Global $Button7 = GUICtrlCreateButton("", 306, 6, 43, 43, $BS_ICON) Global $Button8 = GUICtrlCreateButton("", 355, 6, 43, 43, $BS_ICON) Global $Button9 = GUICtrlCreateButton("", 404, 6, 43, 43, $BS_ICON) Global $Button10 = GUICtrlCreateButton("", 453, 6, 43, 43, $BS_ICON) Global $Button11 = GUICtrlCreateButton("", 508, 6, 43, 43, $BS_ICON) Global $Button12 = GUICtrlCreateButton("", 557, 6, 43, 43, $BS_ICON) Global $Button13 = GUICtrlCreateButton("", 606, 6, 43, 43, $BS_ICON) Global $Button14 = GUICtrlCreateButton("", 655, 6, 43, 43, $BS_ICON) Global $Button15 = GUICtrlCreateButton("", 704, 6, 43, 43, $BS_ICON) Global $Button16 = GUICtrlCreateButton("", 773, 6, 43, 43, $BS_ICON) GUISetState(@SW_SHOW) ;Press ESC key to terminates the toolbar HotKeySet("{ESC}", "_Stop") Global $aButtons[15] = [ _ "$Button1", _ "$Button2", _ "$Button3", _ "$Button4", _ "$Button5", _ "$Button6", _ "$Button7", _ "$Button8", _ "$Button9", _ "$Button10", _ "$Button11", _ "$Button12", _ "$Button13", _ "$Button14", _ "$Button15"] ;Let's disable 15 of those buttons. For $i = $Button1 To $Button15 ConsoleWrite($i & @CRLF) GUICtrlSetState($i, $GUI_DISABLE) Next MsgBox(0, "", "Buttons are DISABLED!") ;Let's enable those 15 buttons. For $i = 0 To UBound($aButtons) GUICtrlSetState($i, $GUI_ENABLE) Next ;~ For $i = $Button1 To $Button15 ;~ GUICtrlSetState($i, $GUI_ENABLE) ;~ Next While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd EndFunc ;==>_Start Func _Stop() Exit EndFunc ;==>_Stop
-
Help with comparing two strings/values.
LisHawj replied to LisHawj's topic in AutoIt General Help and Support
@Chimp Please take me to the range and shoot me, dear lord! Thank you very much. -
I am writing a script to identify laptop models and compare it with a reference variable. If the computer model string match, then the script execute other functions. I have written the following, but the script reports the value/strings do not match. Am I overlooking something simple here? Global $e5490 = "Latitude 5490" $wbemFlagReturnImmediately = 0x10 $wbemFlagForwardOnly = 0x20 $colItems = "" $strComputer = "localhost" $objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\cimv2") $colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_ComputerSystem", "WQL", _ $wbemFlagReturnImmediately + $wbemFlagForwardOnly) If IsObj($colItems) Then For $objItem In $colItems $Output = $objItem.Model & @CRLF Next Else Sleep(10) EndIf Msgbox(0,"",$Output) $i = StringCompare($Output,$e5490) If $i = 0 Then MsgBox(0,"","Yes! A match!") Else MsgBox(0,"","No! Not a match!") EndIf
-
SciTE editor adding random codes
LisHawj replied to LisHawj's topic in AutoIt General Help and Support
@Jos I am not entirely positive on what caused the issue because I am not having the problem with any of the scripts I was working on last Friday. Same PC, no changes, and everything seems to be as it was before the random code generation on I reported last Friday. I'm marking this as self-resolved and will provide more information if the issue crops up again. Thank you very much. -
SciTE editor adding random codes
LisHawj replied to LisHawj's topic in AutoIt General Help and Support
I am running version SciTE Version 4.1.2 Nov 13 2018 21:38:53 with AutoIt Version: 3.3.14.5. The editor was working fine yesterday. If I uninstall the full editor and use the basic editor that comes with AutoIT, then I don't have the random code generation issue. As soon as I install the full editor, then the random code generation comes back. -
My SciTE editor is acting up today and I don't know how to fix it. When I try to save a script, the editor adds some gibberish lines to the end of the code (as demo below). I have attached an example. I have try to reinstall both AutoIT and the SciTE editor and the problem persists. Advice and insights is much appreciated. If $sSomething = "Something" Then Select Case $nClick = "6" ShellExecute("C:\Users\Administrator\AppData\Local\Microsoft\OneDrive\Onedrive.exe") Case $nClick = "7" If @OSArch = "x64" Then RegWrite("HKLM64\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce", "StartOD4B", "REG_SZ", "C:\Program Files (x86)\Applications\StartOD4B\StartOD4B.exe") ElseIf @OSArch = "x86" Then RegWrite("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce", "StartOD4B", "REG_SZ", "C:\Program Files (x86)\Applications\StartOD4B\StartOD4B.exe") EndIf EndSelect EndIf ;Upon running a Tidy or Syntax Check, SciTE added the following three lines to the end of my script. ;The content SciTE adds to the end of my script changes randomly. ;Sometime it adds partial codes from other functions in the script to the end of the script. t EndIf EndIf
-
"This app can't run on your PC" Windows 10 message
LisHawj replied to LisHawj's topic in AutoIt General Help and Support
@JLogan3o13 That is an excellent idea to exclude some of the .DLLs! Thank you very much for sharing that information. -
"This app can't run on your PC" Windows 10 message
LisHawj replied to LisHawj's topic in AutoIt General Help and Support
In the past, a small handful of creative employees have tried to replace the Office C2R files with files they received elsewhere when I sent out the script and the unpackaged Office C2R files. The script main purpose is to ensure the integrity of the original files. Hence, the script is also signed with our in-house software deployment certificate. But at this point, I think two files may not be that big an issue considering all the other security endpoints we have in place.