-
Posts
3,079 -
Joined
-
Last visited
-
Days Won
52
Everything posted by Subz
-
Autoit code to change local group policy
Subz replied to Davidyese's topic in AutoIt General Help and Support
It's just a registry key that needs to be added, here is the process I normally use to identify the registry keys for group policy: Google: admx "Turn off Windows Defender" This should return: Turn off Microsoft Defender Antivirus from https://admx.help You can then just use set the registry key, since it's HKLM it would require #RequireAdmin or have it run using system account. -
Why not just use CSV (as below) and then FileReadToArray? Change the spreadsheet to be: Column A Keyname Column B Valuename Column C RegSZ Column D String
-
You have two types of common arrays 1 dimensional array $aArray[Row Index#] example $aArray[0] $aArray[1] etc... 2 dimensional array $aArray[Row Index No.][Column Index No.] example $aArray[0][0] ;~ Row 0, Column 0 $aArray[0][1] ;~ Row 0, Column 1 $aArray[1][0] ;~ Row 1, Column 0 $aArray[1][1] ;~ Row 1, Column 1 So in your example you could use 2 dimensional array ;~ Keyname: In Excel this would be A1 $aArray[0][0] = "HKEY_CURRENT_USER\Software\FabFilter\Pro-MB\1.0" ;~ Valuename: In Excel this would be B1 $aArray[0][1] = "showInteractiveHelp" ;~ RegType: In Excel this would be C1 $aArray[0][2] = "REG_DWORD" ;~ RegData: In Excel this would be D1 $aArray[0][3] = "00000000" ;~ Keyname: In Excel this would be A2 $aArray[1][0] = "HKEY_CURRENT_USER\Software\FabFilter\Pro-MB\1.0" ;~ Valuename: In Excel this would be B2 $aArray[1][1] = "showWelcomeHint" ;~ RegType: In Excel this would be C2 $aArray[1][2] = "REG_DWORD" ;~ RegData: In Excel this would be D2 $aArray[1][3] = "00000000" etc... You can then use loop to iterate through the array for example: For $i = 0 To Ubound($aArray) - 1 ;~ Loop from index 0 to last row of the array RegWrite($aArray[$i][0], $aArray[$i][1], $aArray[$i][2], $aArray[$i][3]) Next
-
Verify Username and Email Address
Subz replied to seadoggie01's topic in AutoIt General Help and Support
You should use UPN (User Principal Name), as Azure/Entra doesn't recognise samAccountName attribute. if using Get-Mailbox you can request PrimarySmtpAddress or as mentioned use Get-MgUser -UserId 'UPN' | Select-Object DisplayName, Mail which should also show the PrimarySmtpAddress. -
The following would show you the reason for the error (based on RegWrite return errors) AddRegKeyHKCUValue() Func AddRegKeyHKCUValue() Local $sKeyname = "" ; <====A null value will trigger an error! Local $sValuename = "UserContent" Local $sRegSZ = "REG_SZ" Local $sString = "C:\Program Files\Native Instruments\Reflektor\16 User_Impulses\" RegWrite($sKeyname, $sValuename, $sRegSZ, $sString) Switch @error Case 0 $sError = "The HKCU valuename and string WAS successfully added!" Case 1 $sError = "Unable to open requested key" Case 2 $sError = "Unable to open requested main key" Case 3 $sError = "Unable to remote connect to the registry" Case -1 $sError = "Unable to open requested value" Case -2 $sError = "Value type not supported" EndSwitch SplashTextOn("NOTICE!!", $sError, 800, 50, -1, -1) Sleep(2000) SplashOff() EndFunc
-
add path and executable in ListView
Subz replied to angel83's topic in AutoIt General Help and Support
You could just use one ini file, using the full path as unique key, example: [File Paths] C:\Folder 1\filename.exe = filename.exe C:\Folder 2\filename.exe = filename.exe Basic example: #include <GuiListView.au3> #include <GUIConstants.au3> #include <WINAPI.au3> #include <misc.au3> #include <ColorConstants.au3> #include <GuiListView.au3> #include <MsgBoxConstants.au3> #include <Array.au3> #include <File.au3> #include <GuiComboBox.au3> #include <GuiConstantsEx.au3> #include <GuiEdit.au3> #include <GuiListBox.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <Word.au3> Global $g_aFileList[0] Global $g_sIniFile = @ScriptDir & "\Test.ini" Opt("GUIResizeMode", $GUI_DOCKAUTO) $hGUI = GUICreate("Test", 1024, 800) GUISetBkColor(0xFFFF00) $iLVStyle = BitOR($LVS_REPORT, $LVS_SHOWSELALWAYS) $iLVExtStyle = BitOR($WS_EX_CLIENTEDGE, $LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT) $hListView = GUICtrlCreateListView("#|EXE NAME|EXE PATH|ADD|", 34, 274, 850, 444, $iLVStyle, $iLVExtStyle) _GUICtrlListView_SetExtendedListViewStyle($hListView, BitOr($LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT)) _GuiCtrlListView_SetColumnWidth($hListView,0,35) _GuiCtrlListView_SetColumnWidth($hListView,1,290) _GuiCtrlListView_SetColumnWidth($hListView,2,290) $OkButton = GUICtrlCreateButton("SAVE", 42, 200, 75, 23,$WS_BORDER) $AddButton = GUICtrlCreateButton("Add", 122, 242, 75, 23,$WS_BORDER) $RemButton = GUICtrlCreateButton("Delete", 202, 242, 75, 23,$WS_BORDER) $RemButton3 = GUICtrlCreateButton("Delete All", 298, 242, 88, 23,$WS_BORDER) GUISetState(@SW_SHOW, $hGUI) _FillList($g_sIniFile) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $OkButton For $i = 0 To _GUICtrlListView_GetItemCount($hListView) - 1 IniWrite($g_sIniFile, "File Paths", _GUICtrlListView_GetItemText($hListView, $i, 2) & "\" & _GUICtrlListView_GetItemText($hListView, $i, 1), _GUICtrlListView_GetItemText($hListView, $i, 1)) Next Case $AddButton REPIT() Case $RemButton _GUICtrlListView_DeleteItemsSelected($hListView) Case $RemButton3 _GUICtrlListView_DeleteAllItems($hListView) EndSwitch WEnd Func REPIT() Local $sBrowseFolder = FileSelectFolder ("Select Folder with Documents to merge", "", 4, @ScriptDir) IF Not @error Then _AddSelectFolder($sBrowseFolder) EndIf EndFunc Func _AddSelectFolder($_sFolderPath) Local $aFolderList = _FileListToArrayRec($_sFolderPath, "*.exe", $FLTAR_FILES, $FLTAR_RECUR, 0, 2) If @error Then Return _ArrayConcatenate($g_aFileList, $aFolderList, 1) _AddListViewArray() EndFunc ;==>_AddSelectFolder Func _AddListViewArray() $g_aFileList = _ArrayUnique($g_aFileList, Default, Default, Default, $ARRAYUNIQUE_NOCOUNT) _ArraySort($g_aFileList) Local $aFileList = $g_aFileList _ArrayColInsert($aFileList, 0) _ArrayColInsert($aFileList, 1) For $i = 0 To UBound($aFileList) - 1 $aFileList[$i][0] = $i+1 $aFileList[$i][1] = StringRegExpReplace($aFileList[$i][2], ".*\\", "") $aFileList[$i][2] = StringRegExpReplace($aFileList[$i][2], "\\[^\\]*$", "") Next _GUICtrlListView_DeleteAllItems($hListView) _GUICtrlListView_AddArray($hListView, $aFileList) EndFunc Func _FillList($sFile) Local $aIniList = IniReadSection($g_sIniFile, "File Paths") If Not @error Then ;~ Delete Row Count _ArrayDelete($aIniList, 0) $g_aFileList = $aIniList _ArrayColDelete($g_aFileList, 1) _AddListViewArray() EndIf EndFunc -
Packaging script fails to install - (Moved)
Subz replied to Heather's topic in AutoIt General Help and Support
Have you installed the prerequisites? See Download SAP .NET Connector (SAP NCo) - Documentation - Confluence (atlassian.net). Are you also sure the switches are correct? Normally setup.exe msi uses /s to install or to use the msi switches would use something like: setup.exe /s /v" /QN /NoRestart" (note no space between /v and double quote). -
Env does not respond to WM_SETTINGCHANGE
Subz replied to Homes32's topic in AutoIt General Help and Support
The following will set the environment variable functions work for me, although @TempDir will not update until the script is re-run. -
It all depends on the size of the Window, if you want text longer than the size of the window, you would probably require a scrollbar to read it, GuiCtrlCreateEdit is better suited for this. You can also use label but this is suitable when the data doesn't require scrollbars. GuCtrlCreateEdit example: #NoTrayIcon #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <GuiEdit.au3> #include <ScrollBarsConstants.au3> #include <WindowsConstants.au3> Global $hGui = GUICreate("Test", 300, 300) Global $idEdit = GUICtrlCreateEdit(@YEAR & "/" & @MON & "/" & @MDAY & " " & @HOUR & ":" & @MIN & ":" & @SEC, 5, 5, 290, 290, BitOR($ES_READONLY, $ES_MULTILINE, $WS_VSCROLL)) _GUICtrlEdit_Scroll($idEdit, $SB_SCROLLCARET) GUISetState() AdlibRegister('_UpdateEdit', 1000) While 1 Switch GuiGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func _UpdateEdit() Local $sMoreText = @YEAR & "/" & @MON & "/" & @MDAY & " " & @HOUR & ":" & @MIN & ":" & @SEC GUICtrlSetData($idEdit, GUICtrlRead($idEdit) & @CRLF & $sMoreText) _GUICtrlEdit_Scroll($idEdit, $SB_SCROLLCARET) EndFunc
-
Shellexecute and Separate Chrome Kiosk Instances
Subz replied to BobbyH's topic in AutoIt General Help and Support
ShellExecute("Chrome.exe", 'https://www.google.com --user-data-dir="' & @TempDir & '\Kiosk1"') ShellExecute("Chrome.exe", 'https://www.amazon.com --user-data-dir="' & @TempDir & '\Kiosk2"') -
You could also use the FileSaveDialog at the beginning of the script so the user can select the Show file or create a new one, basic example: ;----------------------------------------------- #include <File.au3> #include <GUIConstantsEx.au3> #include <GuiListView.au3> ;----------------------------------------------- Global $g_sMasterShow = "D:\Master_Backup\Shows\Master_Show.shw" Global $g_sWorkingDir = "D:\Master_Backup" Global $g_sShwFileDir = $g_sWorkingDir & "\Shows" Global $g_sShwFileName = @YEAR&"-"&@MON&"-"&@MDAY&"_SHOW.shw" Global $g_sShwFilePath, $g_bShwFilePath = False Global $g_hGUI = GUICreate("Session List Producer", 940, 255) GUISetFont(12, 800, 0, "Calibri") ;----------------------------------------------- Global $g_idAddToList = GUICtrlCreateButton("Add to List", 10, 10, 200, 25) Global $g_idListView = GUICtrlCreateListView("Current Session Files Listing", 220, 10, 500, 235, 0x0008, 0x00000020) _GUICtrlListView_SetColumnWidth($g_idListView, 0, 500) Global $g_idExitMe = GUICtrlCreateButton("Exit", 10, 40, 200, 25) _AddToList() ;----------------------------------------------- GUISetState(@SW_SHOW, $g_hGUI) ;----------------------------------------------- While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $g_idAddToList _AddToList() Case $g_idExitMe Exit EndSwitch WEnd ;----------------------------------------------- Func _AddToList() ; SECTION A ; Check if Show File Path equals false, dialog only appears once ;----------------- If Not $g_bShwFilePath Then $g_sShwFilePath = FileSaveDialog("Select a SHOW File", $g_sShwFileDir, "SHOW(*.shw)",0,$g_sShwFileName) If @error Then Exit MsgBox(4096, "Error", "No file was selected") If Not FileExists($g_sShwFilePath) Then FileCopy($g_sMasterShow, $g_sShwFilePath, 1) $g_sShwFileName = StringTrimLeft($g_sShwFilePath,StringInStr($g_sShwFilePath,"\",0,-1)) EndIf ;~ Show File Path has been set $g_bShwFilePath = True ;----------------- Local $iItem Local $sFileSelectDialog = FileOpenDialog('Select Session Files', $g_sWorkingDir, 'Session Files (*.edl)', 4) If @error Then Return SetError(1, 0, Null) Local $aSplit = StringSplit($sFileSelectDialog,'|', 2) If Not IsArray($aSplit) Then Return SetError(1, 0, Null) If UBound($aSplit) = 1 Then _GUICtrlListView_FindText($g_idListView, $aSplit[0], -1, False) Else For $i = 1 To UBound($aSplit) - 1 If _GUICtrlListView_FindText($g_idListView, $aSplit[0] & "\" & $aSplit[$i], -1, False) = -1 Then GUICtrlCreateListViewItem($aSplit[0] & "\" & $aSplit[$i], $g_idListView) Next EndIf EndFunc ;==>_AddToList
-
Basic example, untested. ;~ Folder Path Local $sFolder = "C:\Folder" ;~ Check if folder exists If FileExists($sFolder) Then ;~ Result is true, delete folder + files and subfolders Local $bDirRemove = DirRemove($sFolder, 1) ;~ Force logoff if the deletion was unsuccessful If $bDirRemove = False Then Shutdown(4) ;~ If folder deletion was successful then show msgbox and exit MsgBox(4096, "Result", "Folder Deleted Successfully") Exit Else ;~ If the folder doesn't exist, msgbox and exit MsgBox(4096, "Result", "Folder does not exist") Exit EndIf
-
How to convert String to Array without any delimiters?
Subz replied to LWC's topic in AutoIt General Help and Support
Your code isn't like Andreik example, unsure why you're creating a temp variable to redeclare it. You could simply write: Local $Foobar[] = ["like|this"] MsgBox(4096, "Result", $Foobar[0]) -
please help, i am to dumb for simple array or eval
Subz replied to meme18's topic in AutoIt General Help and Support
Not sure what you mean since $profileName[x] isn't associated with a control, so nothing for GuiCtrlRead to read, or do you mean something like: Local $profilename[5] = ["Profile1","Profile2","Profile3", "Profile4", "Profile5"] For $i = 0 To UBound($profilename) - 1 ConsoleWrite($profilename[$i] & @CRLF) IniWrite($IniFile, "profilename", "profilename" & $i, $profilename[$i]) Next -
You can't use the $emailDealer button after you've already disabled it, you would need some type of event to occur for example when switching tabs While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $emailEd ;send email to AR Exit Case $PageControl1 If GUICtrlRead($PageControl1) = 0 Then ;~ If tab 0 then do this GUICtrlSetState($emailDealer, $GUI_DISABLE) GUICtrlSetState($adddealeremail,$GUI_DISABLE) GUICtrlSetState($emailEd,$GUI_ENABLE) ElseIf GUICtrlRead($PageControl1) = 1 Then ;~ If tab 1 then do this GUICtrlSetState($emailDealer, $GUI_ENABLE) GUICtrlSetState($adddealeremail,$GUI_ENABLE) GUICtrlSetState($emailEd,$GUI_DISABLE) EndIf EndSwitch WEnd
-
Try looping within a loop or you could try _ArrayFind function ;~ Loop through $mydata2 For $i = 1 To UBound($mydata2)-1 If StringStripWS($mydata2[$i][0],7) = "" Then ContinueLoop ;~ Loop through $mydata For $j = 1 To UBound($mydata)-1 ;~ Check if $mydata[x][column 0] = $mydata2[x][column 0] and set $mydata[x][column 4] to $mydata2[x][column 1] If StringStripWS($mydata[$j][0],7) = StringStripWS($mydata2,7) Then $mydata[$j][4]=$mydata2[$i][1] Next Next
-
Being able to store a variable permanently
Subz replied to Dsmoeg999's topic in AutoIt General Help and Support
Save the variable to either registry or ini file and then have your script re-read it on loading. -
Help with delete row from array if value exist in cell
Subz replied to kemo1987's topic in AutoIt General Help and Support
Basic example: #include <Array.au3> Local $mydata[11][4] = [[0],[1],[2],[3],[5],[6],[1],[2],[3],[5],[6]] Local $filesn[] = [1,20,3] _ArrayDisplay($mydata, "Before") For $i = UBound($filesn) - 1 To 0 Step -1 $aFindAll = _ArrayFindAll($mydata, $filesn[$i], 1, 0) If @error Then ContinueLoop For $j = UBound($aFindAll) - 1 To 0 Step - 1 _ArrayDelete($mydata, $aFindAll[$j]) Next Next _ArrayDisplay($mydata, "After") -
Get password LAPS and error. Please help me or guide me.
Subz replied to KORN's topic in AutoIt General Help and Support
You can also use Waters AD UDF to grab the password from the computer for example: #include <AD.au3> MsgBox(4096, "LAPS Password", @ComputerName & " = " & _Get_LAPSPassword(@ComputerName)) Func _Get_LAPSPassword($_sComputerName) _AD_Open() If @error Then Exit MsgBox(4096, "Active Directory Error", "Unable to connect to Active Directory." & @CRLF & "Please check:" & @CRLF & @TAB & " Network Connection" & @CRLF & @TAB & "You have rights to read computer attributes.") Local $sLAPSPassword = _AD_GetObjectAttribute($_sComputerName & "$", "ms-Mcs-AdmPwd") _AD_Close() Return $sLAPSPassword EndFunc -
The "OpenWith" Command Doesn't Work on Win11.
Subz replied to HowaWe's topic in AutoIt General Help and Support
It works if you re-enable the legacy context menus (it does for me anyway). reg.exe add "HKCU\Software\Classes\CLSID\{86ca1aa0-34aa-4e8b-a509-50c905bae2a2}\InprocServer32" /f /ve -
Normally to get the bit type I always check: Reg Key: HKLM\SOFTWARE\Microsoft\Office\16.0\Outlook Reg Value: "Bitness" Reg Data: x86 Reg Key: HKLM64\SOFTWARE\Microsoft\Office\16.0\Outlook Reg Value: "Bitness" Reg Data: x64
-
TimerInit() and TimerDiff() Results Question
Subz replied to Tonik's topic in AutoIt General Help and Support
@mistersquirrle Local $hTimer in the main script of the body, would be the same as declaring it as a global variable. So while you could use local, imho, it is better to have the scope declared correctly. -
Excel functions not working on new PC
Subz replied to nmellis's topic in AutoIt General Help and Support
Try to add some error handling to see where the issue is coming from see _Excel_BookOpen for an example -
You would need to update your array when the user clicks OK Example: Case $Button1 $TestArray1[1] = GUICtrlRead($input) MsgBox(0,"Msgbox",$TestArray1[1])