Chimaera Posted June 19, 2014 Share Posted June 19, 2014 Hi ive been trying to get a array working in 2D but it doesnt seem to work I normally create an array like this $sProgramString = "" $sProgramString = "|C:\Program Files\CCleaner\uninst.exe|C:\Program Files\Next item\uninst.exe" $sProgramString &= "|C:\Program Files\Defraggler\uninst.exe|C:\Program Files\Next item\uninst.exe" The thing is i want to use a switch to accompany the uninstall location Ccleaner for eg is "/S" They wont all have switches so they have to be kept in line so they work with the right uninstaller. there could be possibly 50 of them? I was looking at this but it gives syntax errors Local $sProgramString = "" $sProgramString[2][2] = [["C:\Program Files\CCleaner\uninst.exe|C:\Program Files\Defraggler\uninst.exe"],["/S|/S"]] Am i better to create 2 individual arrays and try and blend them together? Any suggestions would be helpfull If Ive just helped you ... miracles do happen. Chimaera CopyRobo() * Hidden Admin Account Enabler * Software Location From Registry * Find Display Resolution * _ChangeServices() Link to comment Share on other sites More sharing options...
guinness Posted June 19, 2014 Share Posted June 19, 2014 This is how you declare an array. Local $aProgramString[2][2] = [["C:\Program Files\CCleaner\uninst.exe|C:\Program Files\Defraggler\uninst.exe"],["/S|/S"]] _ArrayDisplay($aProgramString) UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 Link to comment Share on other sites More sharing options...
mikell Posted June 19, 2014 Share Posted June 19, 2014 The expected result is not very clear, what should the final array look like ? Link to comment Share on other sites More sharing options...
Chimaera Posted June 19, 2014 Author Share Posted June 19, 2014 (edited) It should be C:Program FilesCCleaneruninst.exe /S C:Program FilesDefraggleruninst.exe /S This will hopefully be the final form although i have no idea how to get there at the minute ShellExecuteWait( $aProgramList ??, $aProgramList ??) equats to ShellExecuteWait( C:Program FilesCCleaneruninst.exe, /S) So i can run them through a loop one after another Edited June 19, 2014 by Chimaera If Ive just helped you ... miracles do happen. Chimaera CopyRobo() * Hidden Admin Account Enabler * Software Location From Registry * Find Display Resolution * _ChangeServices() Link to comment Share on other sites More sharing options...
jdelaney Posted June 19, 2014 Share Posted June 19, 2014 #include <Array.au3> Local $aProgramString[2][2] = [["C:\Program Files\CCleaner\uninst.exe","/S"],["C:\Program Files\Defraggler\uninst.exe","/S"]] For $i = 0 To UBound($aProgramString) -1 ConsoleWrite($aProgramString[$i][0] & " " & $aProgramString[$i][1] & @CRLF) Next _ArrayDisplay($aProgramString) IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window. Link to comment Share on other sites More sharing options...
guinness Posted June 19, 2014 Share Posted June 19, 2014 Local $aProgramString[2][2] = [["C:\Program Files\CCleaner\uninst.exe", "/S"], ["C:\Program Files\Defraggler\uninst.exe", "/S"]] _ArrayDisplay($aProgramString) For $i = 0 To UBound($aProgramString) - 1 ShellExecuteWait($aProgramString[$i][0], $aProgramString[$i][1]) Next UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 Link to comment Share on other sites More sharing options...
Chimaera Posted June 19, 2014 Author Share Posted June 19, 2014 Ok interesting Many thanks guys ill go and have a play If Ive just helped you ... miracles do happen. Chimaera CopyRobo() * Hidden Admin Account Enabler * Software Location From Registry * Find Display Resolution * _ChangeServices() Link to comment Share on other sites More sharing options...
guinness Posted June 19, 2014 Share Posted June 19, 2014 I would recommend reading the wiki about arrays. This also isn't some new AutoIt thing, as arrays are the fundamental data structures in any language I know. UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 Link to comment Share on other sites More sharing options...
Chimaera Posted June 20, 2014 Author Share Posted June 20, 2014 Yep i am aware its not new and its always been my grey area, havent done anything for a long time now . Ive actually thought this through badly as i realzed that on some of them they require extra code for pressing buttons etc expandcollapse popupLocal $sProgramString = "" $sProgramString = "|C:\Program Files\CCleaner\uninst.exe" $sProgramString &= "|C:\Program Files\Defraggler\uninst.exe|C:\Program Files (x86)\HD Tune\unins000.exe" Local $aProgramArray = StringSplit($sProgramString, "|") _ArrayDisplay($aProgramArray) For $i = 0 To UBound($aProgramArray) - 1 If FileExists($aProgramArray[$i]) Then Local $UninCheck = $aProgramArray[$i] Select Case $UninCheck = "C:\Program Files\CCleaner\uninst.exe" ShellExecuteWait($aProgramArray[$i], "/S") Sleep(1000) Case $UninCheck = "C:\Program Files\Defraggler\uninst.exe" ShellExecuteWait($aProgramArray[$i], "/S") Sleep(1000) Case $UninCheck = "C:\Program Files (x86)\HD Tune\unins000.exe" ;~ $iPID = ShellExecuteWait($aProgramArray[$i], "") $iPID = Run ( "C:\Program Files (x86)\HD Tune\unins000.exe", '', @SW_SHOW ) ; run program to create PID Local $a = "" ; initalize array as empty Local $iTimer = TimerInit() ; start timer While Not IsArray($a) And TimerDiff($iTimer)<5000 ; If no array exists and timer is less than 5 secs $a = _WinAPI_EnumProcessWindows ($iPID,True) ; remake array with current windows WEnd If IsArray($a) Then ; array data exists Local $h = $a[1][0] ; <.this is grabbing the window's handle from the array, just because $h is shorter than $a[1][0] WinActivate($h) ; activate the window ControlFocus($h, "", 6) ; set focus to Yes button ControlClick($h, "", 6) ; click the button WinWaitClose($h) Else MsgBox(1,1,"Coundn't Find Window") EndIf Sleep(1000) Case Else ShellExecuteWait($aProgramArray[$i], "") Sleep(1000) EndSelect Else ContinueLoop EndIf Next Its not a fully working piece but you will get the idea of what im trying to do, the ones that have switches will be added with them the ones that need intervention will have extra code and the rest will use the case else On this piece i was using some code from an earlier example with IE, but is there an easier way to find the window? $iPID = Run ( "C:\Program Files (x86)\HD Tune\unins000.exe", '', @SW_SHOW ) ; run program to create PID Local $a = "" ; initalize array as empty Local $iTimer = TimerInit() ; start timer While Not IsArray($a) And TimerDiff($iTimer)<5000 ; If no array exists and timer is less than 5 secs $a = _WinAPI_EnumProcessWindows ($iPID,True) ; remake array with current windows WEnd If IsArray($a) Then ; array data exists Local $h = $a[1][0] ; <.this is grabbing the window's handle from the array, just because $h is shorter than $a[1][0] WinActivate($h) ; activate the window ControlFocus($h, "", 6) ; set focus to Yes button ControlClick($h, "", 6) ; click the button WinWaitClose($h) If Ive just helped you ... miracles do happen. Chimaera CopyRobo() * Hidden Admin Account Enabler * Software Location From Registry * Find Display Resolution * _ChangeServices() 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