-
Posts
4,425 -
Joined
-
Last visited
-
Days Won
15
Community Answers
-
kylomas's post in Mouseclick bug - need verification please - script provided was marked as the answer
Bert,
MouseClick("left", 736, 643, $L) ;bug is here. If I set the move to 0, the click is skipped $L is the number of times to click. Is that your intent?
kylomas
-
kylomas's post in Enter Dummy not working on ComboBox was marked as the answer
Jewtus,
You may be over thinking this...
#include <WindowsConstants.au3> #include <Array.au3> #include <GUIListView.au3> #include <GUIStatusBar.au3> #include <GUIConstantsEx.au3> $LoginForm = GUICreate("Login", 193, 100, 192, 124) $EnterUNLabel = GUICtrlCreateLabel("Username:", 5, 5, 86, 12) $UNEntry = GUICtrlCreateInput("", 60, 4, 125, 21) $EnterPWLabel = GUICtrlCreateLabel("Password:", 5, 25, 86, 12) $PWEntry = GUICtrlCreateInput("", 60, 24, 125, 21, 0x0020) $EnterDBLabel = GUICtrlCreateLabel("DropDown:", 5, 45, 86, 12) $DDEntry = GUICtrlCreateCombo("", 60, 44, 125, 21) ; guictrlsetdata($DDEntry,'one|two|three') ; $GoButton = GUICtrlCreateButton("Login", 61, 70, 81, 26) $cEnterDummy = GUICtrlCreateDummy() Local $aAccelKeys[1][2] = [["{ENTER}", $cEnterDummy]] GUISetAccelerators($aAccelKeys) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $GoButton, $cEnterDummy If GUICtrlRead($UNEntry)='' OR GUICtrlRead($PWEntry)='' OR GUICtrlRead($DDEntry)='' Then MsgBox(0,"Error","You must enter all parameters to continue") Else $ps_User=GUICtrlRead($UNEntry) $ps_Pass=GUICtrlRead($PWEntry) $ps_DD=GUICtrlRead($DDEntry) GUIDelete($LoginForm) ExitLoop EndIf EndSwitch WEnd kylomas
edit: Note - I populated the combobox for the hell of it. It has no bearing on the problem.
-
kylomas's post in Pausing in between lines was marked as the answer
You will find out shortly why you should have read the forum rules. Link at the bottom right of the page...
-
kylomas's post in Hotkey to trigger GUI button was marked as the answer
niftyapple,
If your purpose is to action the button when the enter key is pushed then an accelerator key (as orb pointed out) can do it like this...
Func _RunSingle() local $pFile = $path & "programs.txt" ;~ ensure file is in its spot before loading if NOT FileExists($pFile) Then FileWrite($pFile, "") EndIf local $count = _FileCountLines($pFile) if $count = 0 Then $count = 1 EndIf ;~Check for an empty file, write something to the first slot. will be removed later. Local $plist[$count] If FileGetSize($pfile) <= 1 Then $plist[0] = "" Else _FileReadToArray($pFile, $plist) for $i = UBound($plist) - 1 to 0 Step -1 if $plist[$i] = "" OR $plist[$i] = " " OR $plist[$i] = "|" Then _ArrayDelete($plist, $i) EndIf Next _ArrayDelete($plist, 0) EndIf ;~ Make sure there is data to put into the control before showing the GUI If UBound($plist) > 0 Then $GUISingle = GUICreate("Run Once", 500, 300) $GUISingleL1 = GUICtrlCreateCombo("", 10, 10, 200, 100) $GUISingleB1 = GUICtrlCreateButton("OK", 10, 130, 100, 100) $dummy_enter = GUICtrlCreatedummy() ; <----- add dummy def ; accelerator key definition Dim $aAccelKeys[1][2] = [["{ENTER}", $dummy_enter]] GUISetAccelerators($aAccelKeys) For $t in $plist GUICtrlSetData($GUISingleL1, $t) Next GUISetState(@SW_SHOW, $GUISingle) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $GUISingleB1, $dummy_enter ; <----- add dummy ctl $runsingle = GUICtrlRead($GUISingleL1) if $runsingle = "" Then msgbox(0, "Error", "That is not a correct item. Please select one from the drop down.") Else Local $show[2] $show = _GetContents() RunAs(_decrypt($show[0]), $domain, _decrypt($show[1]), 2, $runsingle) ExitLoop EndIf EndSwitch WEnd GUISetState(@SW_HIDE, $GUISingle) EndIf EndFunc not tested obviously
kylomas
-
kylomas's post in Help IsBinary Or IsString Or IsNumber was marked as the answer
Run this...
Local $aStr = "123" ConsoleWrite("Is" & VarGetType($aStr) & " variable type." & @CRLF) ConsoleWrite( (stringisdigit($aStr) ? 'Yes, it is a digit' : 'No, it is Klingon') & @CRLF) -
kylomas's post in array find was marked as the answer
asianqueen,
You are not really using any "wildcards" in your example. You are using a partial pattern match however.
This will solve your problem with data dependency within the code...
#include <GUIConstantsEx.au3> #include <array.au3> #include <array.au3> #include <GuiComboBox.au3> #AutoIt3Wrapper_Add_Constants=n local $inifile = @scriptdir & '\initest.ini' local $aNames = IniReadSectionNames($inifile) ; read the section names to an array local $gui010 = guicreate('',170,150) guictrlcreatelabel('Input Name', 20,20,100,20) local $inp010 = guictrlcreatecombo('',20,40,100,20) ; use a combo box for more than 1 matching entry local $Id = guictrlcreatelabel('',125,43,50,20) local $btn010 = guictrlcreatebutton('Find Name',20,120,130,20) guisetstate() while 1 switch guigetmsg() case $gui_event_close Exit case $btn010 _findname(guictrlread($inp010)) case $inp010 guictrlsetdata($Id,'ID = ' & inireadsection($inifile,guictrlread($inp010))[1][1]) ; populate ID field with selection change EndSwitch WEnd func _findname($sName) guictrlsetdata($Id,'') guictrlsetdata($inp010,'') for $1 = 1 to $aNames[0] if stringregexp($aNames[$1],'(?i)\Q' & $sName & '\E') then guictrlsetdata($inp010,$aNames[$1]) endif next _GUICtrlComboBox_SetCurSel ( $inp010 , 0 ) ; set edit box to 1st in list guictrlsetdata($Id,'ID = ' & inireadsection($inifile,guictrlread($inp010))[1][1]) ; populate ID field endfunc I changed the input control to a combobox control so that multiple matching entries can be listed. I added a display of the ID of the person currently selected. This works for this simple example, however, like SmOke_N said, if you do want more sophisticated functionality SQLite is the way to go.
-
kylomas's post in Use variables from another function was marked as the answer
or pass the value to the function...
example() Func Example() $hChild = GUICreate("Adding", 372, 284, -1, -1, -1, -1) $InputHost = GUICtrlCreateInput("", 8, 131, 357, 28, -1, 512) GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif") GUICtrlCreateLabel("Computer Hostname:", 8, 109, 163, 20, -1, -1) GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif") GUICtrlSetBkColor(-1, "-2") GUICtrlCreateLabel("ID:", 8, 179, 163, 20, -1, -1) GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif") GUICtrlSetBkColor(-1, "-2") $inputid = GUICtrlCreateInput("", 8, 202, 357, 28, -1, 512) GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif") $badd = GUICtrlCreateButton("A D D", 8, 242, 100, 36, -1, -1) GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif") $inputsearch2 = GUICtrlCreateInput("aa", 8, 31, 240, 28, -1, 512) GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif") GUICtrlCreateLabel("Search By Hostname:", 8, 7, 163, 20, -1, -1) GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif") GUICtrlSetBkColor(-1, "-2") $bsearch2 = GUICtrlCreateButton("S E A R C H", 258, 31, 100, 28, -1, -1) GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif") $bless = GUICtrlCreateButton("<", 8, 68, 32, 30, -1, -1) $bgreater = GUICtrlCreateButton(">", 216, 68, 32, 30, -1, -1) $bdelete = GUICtrlCreateButton("R E M O V E", 132, 242, 114, 36, -1, -1) GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif") $exit = GUICtrlCreateButton("E X I T", 265, 242, 100, 36, -1, -1) GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif") GUISetState(@SW_SHOW) While 1 Switch GUIGetMsg() Case -3 GUIDelete($hChild) ExitLoop Case $exit GUIDelete($hChild) Return Case $badd Addrecords(guictrlread($inputsearch2)) ; <----- pass as parm EndSwitch WEnd EndFunc ;==>Example Func Addrecords($inrec) ; change to accept parm MsgBox(0, "TEST", $inrec) EndFunc ;==>Addrecords -
kylomas's post in Help on _DateAdd was marked as the answer
mapl,
Try this...
#include <DateTimeConstants.au3> #include <GUIConstantsEx.au3> #include <MsgBoxConstants.au3> #Include <Date.au3> HotKeySet("{ESC}", "Terminate") GUICreate("Look-Up Tool", 350, 120, -1, -1) Global $idDate = GUICtrlCreateDate("", 10, 10, 180, 20, $DTS_SHORTDATEFORMAT) ; Date Picker Global $idTime = GUICtrlCreateDate("", 10, 40, 180, 20, $DTS_TIMEFORMAT) ; Time Picker $DTM_SETFORMAT_ = 0x1032 $style = "HH:mm" GUICtrlSendMsg($idTime, $DTM_SETFORMAT_, 0, $style) Global $idCalculate = GUICtrlCreateButton("Calculate Date/Time", 10, 90, 330, 20) GUICtrlSetOnEvent($idCalculate, "Calculate") GUICtrlCreateLabel("Result", 245, 10) local $strt010 = guictrlcreatelabel('',245,30,100,20) local $diff010 = guictrlcreatelabel('',245,50,100,20) GUISetState(@SW_SHOW) Local $iMsg = 0 While 1 $iMsg = GUIGetMsg() Switch $iMsg Case $idCalculate Calculate() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd Func Terminate() Exit 0 ; Terminate via ESC EndFunc Func Calculate() guictrlsetdata($strt010, guictrlread($idDate) & ' ' & guictrlread($idTime)) guictrlsetdata($diff010,_dateadd('h', -4, stringregexpreplace(guictrlread($idDate),'(\d+)/(\d+)/(\d\d\d\d)','$3/$1/$2') & ' ' & GUICtrlRead($idTime))) EndFunc DateAdd needs the date/time parm in a specific format. Also, as SmOke_N said, you are recreating controls needlessly.
kylomas
edit: Also the HotKey is not necessary to exit the script.
-
kylomas's post in Empty File, but may contain blank line(s) was marked as the answer
and another...
ConsoleWrite((_IsFileEmpty(@scriptdir & '\test.txt') ) ? 'No' & @CRLF : 'Yes' & @CRLF) func _IsFileEmpty($file) return (stringregexp(fileread($file),'.')) ? 1 : 0 endfunc -
kylomas's post in Print Computer Info into text file was marked as the answer
Rorschach,
Your filewrite is working fine. Your while...wend loop is not running because 1 is never greater than 1. Not sure why the while...wend is even there, better off without it. Regardless, try this, it runs on my pc...
#include <array.au3> #include "CompInfo.au3" ;If you are wanting to pull WMI data from different computers then Declare $cI_CompName as the computer name before the include. #Region Header #comments-start Title: Computer Information Automation UDF Library for AutoIt3 - EXAMPLES Filename: CompInfoExamples.au3 Description: Examples using the UDF's from CompInfo.au3 Author: Jarvis J. Stubblefield (JSThePatriot) http://www.vortexrevolutions.com/ Version: 00.03.08 Last Update: 11.09.06 Requirements: AutoIt v3.2 +, Developed/Tested on WindowsXP Pro Service Pack 2 Notes: Errors associated with incorrect objects will be common user errors. AutoIt beta 3.1.1.63 has added an ObjName() function that will be used to trap and report most of these errors. Special thanks to Firestorm (Testing, Use), Koala (Testing, Bug Fix), and everyone else that has helped in the creation of this Example File. #comments-end #EndRegion Header Local $FileNamePC = "c:\test.txt" Global $PcInfo = FileOpen($FileNamePC, 10) ; Check if file opened for writing OK If $PcInfo = -1 Then MsgBox(0, "Error", "Unable to open file the logfile MP510.") Exit EndIf Local $axul #Region ---- Software Functions ;While 1>1 ; the loop will not run because 1 is never greater than 1 While 1 #Region -- Users Dim $Users[1][1] _ComputerGetUsers($Users) if @error then exit ;_arraydisplay($Users) ; for debugging, comment out if not needed For $i = 1 To $Users[0][0] Step 1 FileWrite($FileNamePC, "Name: " & $Users[$i][0] & @CRLF & _ "Domain: " & $Users[$i][1] & @CRLF & _ "Status: " & $Users[$i][2] & @CRLF & _ "Local Account: " & $Users[$i][3] & @CRLF & _ "SID: " & $Users[$i][4] & @CRLF & _ "SIDType: " & $Users[$i][5] & @CRLF & _ "Description: " & $Users[$i][6] & @CRLF & _ "Full Name: " & $Users[$i][7] & @CRLF & _ "Disabled: " & $Users[$i][8] & @CRLF & _ "Lockout: " & $Users[$i][9] & @CRLF & _ "Password Changeable: " & $Users[$i][10] & @CRLF & _ "Password Expires: " & $Users[$i][11] & @CRLF & _ "Password Required: " & $Users[$i][12] & @CRLF & _ "Account Type: " & $Users[$i][13]) Next exitloop ; not sure why this is a loop, however, this will get you out of the loop or eliminate the while...wend altogether #EndRegion -- Users #EndRegion ---- Software Functions WEnd #Region -- BIOS ;~ Dim $BIOS ;~ _ComputerGetBIOS($BIOS) ;~ If @error Then ;~ $error = @error ;~ $extended = @extended ;~ Switch $extended ;~ Case 1 ;~ _ErrorMsg($ERR_NO_INFO) ;~ Case 2 ;~ _ErrorMsg($ERR_NOT_OBJ) ;~ EndSwitch ;~ EndIf ;~ For $i = 1 To $BIOS[0][0] Step 1 ;~ MsgBox(0, "Test _ComputerGetBIOS", "Name: " & $BIOS[$i][0] & @CRLF & _ ;~ "Status: " & $BIOS[$i][1] & @CRLF & _ ;~ "BIOS Characteristics: " & $BIOS[$i][2] & @CRLF & _ ;~ "BIOS Version: " & $BIOS[$i][3] & @CRLF & _ ;~ "Description: " & $BIOS[$i][4] & @CRLF & _ ;~ "Build Number: " & $BIOS[$i][5] & @CRLF & _ ;~ "Code Set: " & $BIOS[$i][6] & @CRLF & _ ;~ "Current Language: " & $BIOS[$i][7] & @CRLF & _ ;~ "Identification Code: " & $BIOS[$i][8] & @CRLF & _ ;~ "Installable Languages: " & $BIOS[$i][9] & @CRLF & _ ;~ "Language Edition: " & $BIOS[$i][10] & @CRLF & _ ;~ "List of Languages: " & $BIOS[$i][11] & @CRLF & _ ;~ "Manufacturer: " & $BIOS[$i][12] & @CRLF & _ ;~ "Other Target OS: " & $BIOS[$i][13] & @CRLF & _ ;~ "Primary BIOS: " & $BIOS[$i][14] & @CRLF & _ ;~ "Release Date: " & $BIOS[$i][15] & @CRLF & _ ;~ "Serial Number: " & $BIOS[$i][16] & @CRLF & _ ;~ "SM BIOS BIOS Version: " & $BIOS[$i][17] & @CRLF & _ ;~ "SM BIOS Major Version: " & $BIOS[$i][18] & @CRLF & _ ;~ "SM BIOS Minor Version: " & $BIOS[$i][19] & @CRLF & _ ;~ "SM BIOS Present: " & $BIOS[$i][20] & @CRLF & _ ;~ "Software Element ID: " & $BIOS[$i][21] & @CRLF & _ ;~ "Software Element State: " & $BIOS[$i][22] & @CRLF & _ ;~ "Target Operating System: " & $BIOS[$i][23] & @CRLF & _ ;~ "Version: " & $BIOS[$i][24]) ;~ Next ;~ #EndRegion -- BIOS ;~ #Region -- Memory ;~ Dim $Memory ;~ _ComputerGetMemory($Memory) ;~ If @error Then ;~ $error = @error ;~ $extended = @extended ;~ Switch $extended ;~ Case 1 ;~ _ErrorMsg($ERR_NO_INFO) ;~ Case 2 ;~ _ErrorMsg($ERR_NOT_OBJ) ;~ EndSwitch ;~ EndIf ;~ For $i = 1 To $Memory[0][0] Step 1 ;~ MsgBox(0, "Test _ComputerGetMemory", "Name: " & $Memory[$i][0] & @CRLF & _ ;~ "BankLabel: " & $Memory[$i][1] & @CRLF & _ ;~ "Capacity: " & $Memory[$i][2] & @CRLF & _ ;~ "CreationClassName: " & $Memory[$i][3] & @CRLF & _ ;~ "Description: " & $Memory[$i][4] & @CRLF & _ ;~ "DataWidth: " & $Memory[$i][5] & @CRLF & _ ;~ "DeviceLocator: " & $Memory[$i][6] & @CRLF & _ ;~ "FormFactor: " & $Memory[$i][7] & @CRLF & _ ;~ "HotSwappable: " & $Memory[$i][8] & @CRLF & _ ;~ "InterleaveDataDepth: " & $Memory[$i][9] & @CRLF & _ ;~ "InterleavePosition: " & $Memory[$i][10] & @CRLF & _ ;~ "Manufacturer: " & $Memory[$i][11] & @CRLF & _ ;~ "MemoryType: " & $Memory[$i][12] & @CRLF & _ ;~ "Model: " & $Memory[$i][13] & @CRLF & _ ;~ "OtherIdentifyingInfo: " & $Memory[$i][14] & @CRLF & _ ;~ "PartNumber: " & $Memory[$i][15] & @CRLF & _ ;~ "PositionInRow: " & $Memory[$i][16] & @CRLF & _ ;~ "PoweredOn: " & $Memory[$i][17] & @CRLF & _ ;~ "Removable: " & $Memory[$i][18] & @CRLF & _ ;~ "Replaceable: " & $Memory[$i][19] & @CRLF & _ ;~ "SerialNumber: " & $Memory[$i][20] & @CRLF & _ ;~ "SKU: " & $Memory[$i][21] & @CRLF & _ ;~ "Speed: " & $Memory[$i][22] & @CRLF & _ ;~ "Status: " & $Memory[$i][23] & @CRLF & _ ;~ "Tag: " & $Memory[$i][24] & @CRLF & _ ;~ "TotalWidth: " & $Memory[$i][25] & @CRLF & _ ;~ "TypeDetail: " & $Memory[$i][26] & @CRLF & _ ;~ "Version: " & $Memory[$i][27]) ;~ Next ;~ #EndRegion -- Memory ;~ #Region -- Motherboard ;~ Dim $Motherboard ;~ _ComputerGetMotherboard($Motherboard) ;~ If @error Then ;~ $error = @error ;~ $extended = @extended ;~ Switch $extended ;~ Case 1 ;~ _ErrorMsg($ERR_NO_INFO) ;~ Case 2 ;~ _ErrorMsg($ERR_NOT_OBJ) ;~ EndSwitch ;~ EndIf ;~ For $i = 1 To $Motherboard[0][0] Step 1 ;~ MsgBox(0, "Test _ComputerGetMotherboard", "Name: " & $Motherboard[$i][0] & @CRLF & _ ;~ "Availability: " & $Motherboard[$i][1] & @CRLF & _ ;~ "ConfigManagerErrorCode: " & $Motherboard[$i][2] & @CRLF & _ ;~ "ConfigManagerUserConfig: " & $Motherboard[$i][3] & @CRLF & _ ;~ "Description: " & $Motherboard[$i][4] & @CRLF & _ ;~ "CreationClassName: " & $Motherboard[$i][5] & @CRLF & _ ;~ "DeviceID: " & $Motherboard[$i][6] & @CRLF & _ ;~ "ErrorCleared: " & $Motherboard[$i][7] & @CRLF & _ ;~ "ErrorDescription: " & $Motherboard[$i][8] & @CRLF & _ ;~ "LastErrorCode: " & $Motherboard[$i][9] & @CRLF & _ ;~ "PNPDeviceID: " & $Motherboard[$i][10] & @CRLF & _ ;~ "PowerManagementCapabilities: " & $Motherboard[$i][11] & @CRLF & _ ;~ "PowerManagementSupported: " & $Motherboard[$i][12] & @CRLF & _ ;~ "PrimaryBusType: " & $Motherboard[$i][13] & @CRLF & _ ;~ "RevisionNumber: " & $Motherboard[$i][14] & @CRLF & _ ;~ "SecondaryBusType: " & $Motherboard[$i][15] & @CRLF & _ ;~ "Status: " & $Motherboard[$i][16] & @CRLF & _ ;~ "StatusInfo: " & $Motherboard[$i][17] & @CRLF & _ ;~ "SystemCreationClassName: " & $Motherboard[$i][18] & @CRLF & _ ;~ "SystemName: " & $Motherboard[$i][19]) ;~ Next ;~ #EndRegion -- Motherboard ;~ #Region -- Network Cards ;~ Dim $NetworkCards ;~ _ComputerGetNetworkCards($NetworkCards) ;~ If @error Then ;~ $error = @error ;~ $extended = @extended ;~ Switch $extended ;~ Case 1 ;~ _ErrorMsg($ERR_NO_INFO) ;~ Case 2 ;~ _ErrorMsg($ERR_NOT_OBJ) ;~ EndSwitch ;~ EndIf ;~ For $i = 1 To $NetworkCards[0][0] Step 1 ;~ MsgBox(0, "Test _ComputerGetNetworkCards", "Name: " & $NetworkCards[$i][0] & @CRLF & _ ;~ "Adapter Type: " & $NetworkCards[$i][1] & @CRLF & _ ;~ "Adapter Type ID: " & $NetworkCards[$i][2] & @CRLF & _ ;~ "Auto Sense: " & $NetworkCards[$i][3] & @CRLF & _ ;~ "Description: " & $NetworkCards[$i][4] & @CRLF & _ ;~ "Availability: " & $NetworkCards[$i][5] & @CRLF & _ ;~ "Config Manager Error Code: " & $NetworkCards[$i][6] & @CRLF & _ ;~ "Config Manager User Config: " & $NetworkCards[$i][7] & @CRLF & _ ;~ "Creation Class Name: " & $NetworkCards[$i][8] & @CRLF & _ ;~ "Device ID: " & $NetworkCards[$i][9] & @CRLF & _ ;~ "Error Cleared: " & $NetworkCards[$i][10] & @CRLF & _ ;~ "Error Description: " & $NetworkCards[$i][11] & @CRLF & _ ;~ "Index: " & $NetworkCards[$i][12] & @CRLF & _ ;~ "Installed: " & $NetworkCards[$i][13] & @CRLF & _ ;~ "Last Error Code: " & $NetworkCards[$i][14] & @CRLF & _ ;~ "MAC Address: " & $NetworkCards[$i][15] & @CRLF & _ ;~ "Manufacturer: " & $NetworkCards[$i][16] & @CRLF & _ ;~ "Max Number Controlled: " & $NetworkCards[$i][17] & @CRLF & _ ;~ "Max Speed: " & $NetworkCards[$i][18] & @CRLF & _ ;~ "Net Connection ID: " & $NetworkCards[$i][19] & @CRLF & _ ;~ "Net Connection Status: " & $NetworkCards[$i][20] & @CRLF & _ ;~ "Network Addresses: " & $NetworkCards[$i][21] & @CRLF & _ ;~ "Permanent Address: " & $NetworkCards[$i][22] & @CRLF & _ ;~ "PNP Device ID: " & $NetworkCards[$i][23] & @CRLF & _ ;~ "Power Management Capabilities: " & $NetworkCards[$i][24] & @CRLF & _ ;~ "Power Management Supported: " & $NetworkCards[$i][25] & @CRLF & _ ;~ "Product Name: " & $NetworkCards[$i][26] & @CRLF & _ ;~ "Service Name: " & $NetworkCards[$i][27] & @CRLF & _ ;~ "Speed: " & $NetworkCards[$i][28] & @CRLF & _ ;~ "Status: " & $NetworkCards[$i][29] & @CRLF & _ ;~ "Status Info: " & $NetworkCards[$i][30] & @CRLF & _ ;~ "System Creation Class Name: " & $NetworkCards[$i][31] & @CRLF & _ ;~ "System Name: " & $NetworkCards[$i][32] & @CRLF & _ ;~ "Time Of Last Reset: " & $NetworkCards[$i][33]) ;~ Next ;~ #EndRegion -- Network Cards ;~ #Region -- Processors ;~ Dim $Processors ;~ _ComputerGetProcessors($Processors) ;~ If @error Then ;~ $error = @error ;~ $extended = @extended ;~ Switch $extended ;~ Case 1 ;~ _ErrorMsg($ERR_NO_INFO) ;~ Case 2 ;~ _ErrorMsg($ERR_NOT_OBJ) ;~ EndSwitch ;~ EndIf ;~ For $i = 1 To $Processors[0][0] Step 1 ;~ MsgBox(0, "Test _ComputerGetProcessors", "Name: " & $Processors[$i][0] & @CRLF & _ ;~ "Address Width: " & $Processors[$i][1] & @CRLF & _ ;~ "Architecture: " & $Processors[$i][2] & @CRLF & _ ;~ "Availability: " & $Processors[$i][3] & @CRLF & _ ;~ "Description: " & $Processors[$i][4] & @CRLF & _ ;~ "Config Manager Error Code: " & $Processors[$i][5] & @CRLF & _ ;~ "Config Manager User Config: " & $Processors[$i][6] & @CRLF & _ ;~ "CPU Status: " & $Processors[$i][7] & @CRLF & _ ;~ "Creation Class Name: " & $Processors[$i][8] & @CRLF & _ ;~ "Current Clock Speed: " & $Processors[$i][9] & @CRLF & _ ;~ "Current Voltage: " & $Processors[$i][10] & @CRLF & _ ;~ "Data Width: " & $Processors[$i][11] & @CRLF & _ ;~ "Device ID: " & $Processors[$i][12] & @CRLF & _ ;~ "Error Cleared: " & $Processors[$i][13] & @CRLF & _ ;~ "Error Description: " & $Processors[$i][14] & @CRLF & _ ;~ "Ext Clock: " & $Processors[$i][15] & @CRLF & _ ;~ "Family: " & $Processors[$i][16] & @CRLF & _ ;~ "L2 Cache Size: " & $Processors[$i][17] & @CRLF & _ ;~ "L2 Cache Speed: " & $Processors[$i][18] & @CRLF & _ ;~ "Last Error Code: " & $Processors[$i][19] & @CRLF & _ ;~ "Level: " & $Processors[$i][20] & @CRLF & _ ;~ "Load Percentage: " & $Processors[$i][21] & @CRLF & _ ;~ "Manufacturer: " & $Processors[$i][22] & @CRLF & _ ;~ "Max Clock Speed: " & $Processors[$i][23] & @CRLF & _ ;~ "Other Family Description: " & $Processors[$i][24] & @CRLF & _ ;~ "PNP Device ID: " & $Processors[$i][25] & @CRLF & _ ;~ "Power Management Capabilities: " & $Processors[$i][26] & @CRLF & _ ;~ "Power Management Supported: " & $Processors[$i][27] & @CRLF & _ ;~ "Processor ID: " & $Processors[$i][28] & @CRLF & _ ;~ "Processor Type: " & $Processors[$i][29] & @CRLF & _ ;~ "Revision: " & $Processors[$i][30] & @CRLF & _ ;~ "Role: " & $Processors[$i][31] & @CRLF & _ ;~ "Socket Designation: " & $Processors[$i][32] & @CRLF & _ ;~ "Status: " & $Processors[$i][33] & @CRLF & _ ;~ "Status Info: " & $Processors[$i][34] & @CRLF & _ ;~ "Stepping: " & $Processors[$i][35] & @CRLF & _ ;~ "System Creation Class Name: " & $Processors[$i][36] & @CRLF & _ ;~ "System Name: " & $Processors[$i][37] & @CRLF & _ ;~ "Unique ID: " & $Processors[$i][38] & @CRLF & _ ;~ "Upgrade Method: " & $Processors[$i][39] & @CRLF & _ ;~ "Version: " & $Processors[$i][40] & @CRLF & _ ;~ "Voltage Caps: " & $Processors[$i][41]) ;~ Next ;~ #EndRegion -- Processors ;~ #Region -- System ;~ Dim $System ;~ _ComputerGetSystem($System) ;~ If @error Then ;~ $error = @error ;~ $extended = @extended ;~ Switch $extended ;~ Case 1 ;~ _ErrorMsg("Array contains no information.") ;~ Case 2 ;~ _ErrorMsg("$colItems isnt an object.") ;~ EndSwitch ;~ EndIf ;~ #Region -- System Product ;~ ;NOTE: UUID will return 0000's if it is unable to create a UUID. ;~ Dim $SystemProduct ;~ _ComputerGetSystemProduct($SystemProduct) ;~ If @error Then ;~ $error = @error ;~ $extended = @extended ;~ Switch $extended ;~ Case 1 ;~ _ErrorMsg($ERR_NO_INFO) ;~ Case 2 ;~ _ErrorMsg($ERR_NOT_OBJ) ;~ EndSwitch ;~ EndIf ;~ For $i = 1 To $SystemProduct[0][0] Step 1 ;~ MsgBox(0, "Test _ComputerGetSystemProduct", "Name: " & $SystemProduct[$i][0] & @CRLF & _ ;~ "Identifying Number: " & $SystemProduct[$i][1] & @CRLF & _ ;~ "SKU Number: " & $SystemProduct[$i][2] & @CRLF & _ ;~ "UUID: " & $SystemProduct[$i][3] & @CRLF & _ ;~ "Description: " & $SystemProduct[$i][4] & @CRLF & _ ;~ "Vendor: " & $SystemProduct[$i][5] & @CRLF & _ ;~ "Version: " & $SystemProduct[$i][6]) ;~ Next ;~ #EndRegion -- System Product ;~ #Region -- Video Cards ;~ Dim $VideoCards ;~ _ComputerGetVideoCards($VideoCards) ;~ If @error Then ;~ $error = @error ;~ $extended = @extended ;~ Switch $extended ;~ Case 1 ;~ _ErrorMsg($ERR_NO_INFO) ;~ Case 2 ;~ _ErrorMsg($ERR_NOT_OBJ) ;~ EndSwitch ;~ EndIf ;~ ;closes the log file ;~ FileClose($FileNamePC) ;~ #EndRegion -- Video Cards ;~ #Region ---- Internal Functions ;~ Func _ErrorMsg($message, $time = 0) ;~ MsgBox(48 + 262144, "Error!", $message, $time) ;~ EndFunc ;==>_ErrorMsg ;~ #EndRegion ---- Internal Functions kylomas
edit: I explicily declare the 2D array, however this is not neccessary as the UDF redim's whatever var is passed to it. Did this while troubleshooting and forgot to change it back.
-
kylomas's post in Txt File Array to Listview with Write/Delete was marked as the answer
Dan,
The same way we updated it before only now you'll get the listview data from the input control instead of the array, e.g.
GUICtrlCreateListViewItem(guictrlread($input_control),$lv) To delete an item see _GUICtrlListView_DeleteItem. Hint, you get the item index using another _GUICtrlListView_* function.
kylomas
-
kylomas's post in Removing a number from a string was marked as the answer
Use this one. It allows for any number of spaces between the text you want and the numbers...
#include <array.au3> Local $aBefore = [ _ 'Customer9 Details3 1', _ 'Site 14 Details 2', _ 'Slough Primary 2', _ 'Slough Secondary 5', _ '14Dynamic Bandwidth 9', _ 'Billing Details 14' _ ] For $1 = 0 To UBound($aBefore) - 1 $aBefore[$1] = StringRegExpReplace($aBefore[$1], '([\w+])\s+\d+$', '\1') Next _ArrayDisplay($aBefore) -
kylomas's post in How to install beta and stable on same machine was marked as the answer
Just download the Beta and install it...In SciTE you will see options to run prod or beta (under tools)...
-
kylomas's post in GoTo Beginning-ish was marked as the answer
polingkyle,
You buttons on the first gui do not seem to work because you are stuck in the second nested while...wend loop. See the following to fix this...
#RequireAdmin #NoTrayIcon #include <Constants.au3> #include <ButtonConstants.au3> #include <ComboConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> Local $USERNAME = EnvGet("USERNAME") IF @CPUArch = "X86" Then $AppNameCurrent = RegRead("HKLM\SOFTWARE\Inventory", "ApplicationName") $AppOwnerCurrent = RegRead("HKLM\SOFTWARE\Inventory", "ApplicationOwner") $LocationCurrent = RegRead("HKLM\SOFTWARE\Inventory", "Location") $PurposeCurrent = RegRead("HKLM\SOFTWARE\Inventory", "Purpose") $DeptNameCurrent = RegRead("HKLM\SOFTWARE\Inventory", "DeptName") $Monitor1Current = RegRead("HKLM\SOFTWARE\Inventory", "Monitor_1") $Monitor2Current = RegRead("HKLM\SOFTWARE\Inventory", "Monitor_2") $Monitor3Current = RegRead("HKLM\SOFTWARE\Inventory", "Monitor_3") Else $AppNameCurrent = RegRead("HKLM64\SOFTWARE\Inventory", "ApplicationName") $AppOwnerCurrent = RegRead("HKLM64\SOFTWARE\Inventory", "ApplicationOwner") $LocationCurrent = RegRead("HKLM64\SOFTWARE\Inventory", "Location") $PurposeCurrent = RegRead("HKLM64\SOFTWARE\Inventory", "Purpose") $DeptNameCurrent = RegRead("HKLM64\SOFTWARE\Inventory", "DeptName") $Monitor1Current = RegRead("HKLM64\SOFTWARE\Inventory", "Monitor_1") $Monitor2Current = RegRead("HKLM64\SOFTWARE\Inventory", "Monitor_2") $Monitor3Current = RegRead("HKLM64\SOFTWARE\Inventory", "Monitor_3") EndIf $Form1 = GUICreate("Server Registry Entries", 497, 371, 20, 20) $ServerNameLabel = GUICtrlCreateLabel("Server Name:", 80, 56, 69, 17) $ServerName = GUICtrlCreateInput(@ComputerName, 160, 56, 217, 21) ;AppName Dropdown Begin $AppNameLabel = GUICtrlCreateLabel("Application Name", 64, 80, 87, 17) IF $AppNameCurrent = "" Then $AppName = GUICtrlCreateCombo("Choose from dropdown menu", 160, 80, 217, 21, BitOR($CBS_DROPDOWN,$GUI_SS_DEFAULT_COMBO)) Else $AppName = GUICtrlCreateCombo($AppNameCurrent, 160, 80, 217, 21, BitOR($CBS_DROPDOWN,$GUI_SS_DEFAULT_COMBO)) EndIf GUICtrlSetData(-1, "App1|App2|App3") GUICtrlSetTip(-1, "Choose from dropdown") GUISetState(@SW_SHOW) ;AppName Dropdown End ;AppOwner Dropdown Begin $AppOwnerLabel = GUICtrlCreateLabel("Application Owner", 64, 104, 90, 17) IF $AppOwnerCurrent = "" Then $AppOwner = GUICtrlCreateCombo("Choose from dropdown menu", 160, 104, 217, 21, BitOR($CBS_DROPDOWNLIST,$GUI_SS_DEFAULT_COMBO)) Else $AppOwner = GUICtrlCreateCombo($AppOwnerCurrent, 160, 104, 217, 21, BitOR($CBS_DROPDOWNLIST,$GUI_SS_DEFAULT_COMBO)) EndIf GUICtrlSetData(-1, "Owner1|Owner2|Owner3") GUICtrlSetTip(-1, "Choose from dropdown") GUISetState(@SW_SHOW) ;AppOwner Dropdown End ;DeptName Dropdown Begin $DeptNameLabel = GUICtrlCreateLabel("Department Name", 64, 128, 90, 17) IF $DeptNameCurrent = "" Then $DeptName = GUICtrlCreateCombo("Choose from dropdown menu", 160, 128, 217, 25, BitOR($CBS_DROPDOWNLIST,$GUI_SS_DEFAULT_COMBO)) Else $DeptName = GUICtrlCreateCombo($DeptNameCurrent, 160, 128, 217, 25, BitOR($CBS_DROPDOWNLIST,$GUI_SS_DEFAULT_COMBO)) EndIf GUICtrlSetData(-1, "Dept1|Dept2|Dept3") GUICtrlSetTip(-1, "Choose from dropdown") GUISetState(@SW_SHOW) ;DeptName Dropdown End ;Location Dropdown Begin $LocationLabel = GUICtrlCreateLabel("Location of Server", 64, 152, 91, 17) IF $LocationCurrent = "" Then $Location = GUICtrlCreateCombo("Choose from dropdown menu", 160, 152, 217, 21, BitOR($CBS_DROPDOWNLIST,$GUI_SS_DEFAULT_COMBO)) Else $Location = GUICtrlCreateCombo($LocationCurrent, 160, 152, 217, 21, BitOR($CBS_DROPDOWNLIST,$GUI_SS_DEFAULT_COMBO)) EndIf GUICtrlSetData(-1, "City1|City2|City3") GUICtrlSetTip(-1, "Choose from dropdown") GUISetState(@SW_SHOW) ;Location Dropdown End $PurposeLabel = GUICtrlCreateLabel("Purpose of Server", 64, 176, 89, 17) $Purpose = GUICtrlCreateInput($PurposeCurrent, 160, 176, 217, 21) ;Monitor_1 Dropdown Begin $Monitor1Label = GUICtrlCreateLabel("Monitor 1", 104, 200, 48, 17) IF $Monitor1Current = "" Then $Monitor1 = GUICtrlCreateCombo("Choose from dropdown menu", 160, 200, 217, 21, BitOR($CBS_DROPDOWN,$GUI_SS_DEFAULT_COMBO)) Else $Monitor1 = GUICtrlCreateCombo($Monitor1Current, 160, 200, 217, 21, BitOR($CBS_DROPDOWN,$GUI_SS_DEFAULT_COMBO)) EndIf GUICtrlSetData(-1, "[email protected]|[email protected]|[email protected]") GUICtrlSetTip(-1, "Choose from dropdown") GUISetState(@SW_SHOW) ;Monitor_1 Dropdown EndFunc ;Monitor_2 Dropdown Begin $Monitor2Label = GUICtrlCreateLabel("Monitor 2", 104, 224, 48, 17) IF $Monitor2Current = "" Then $Monitor2 = GUICtrlCreateCombo("", 160, 224, 217, 21, BitOR($CBS_DROPDOWN,$GUI_SS_DEFAULT_COMBO)) Else $Monitor2 = GUICtrlCreateCombo($Monitor2Current, 160, 224, 217, 21, BitOR($CBS_DROPDOWN,$GUI_SS_DEFAULT_COMBO)) EndIf GUICtrlSetData(-1, "[email protected]|[email protected]|[email protected]") GUICtrlSetTip(-1, "") GUISetState(@SW_SHOW) ;Monitor_2 Dropdown End ;Monitor_3 Dropdown Begin $Monitor3Label = GUICtrlCreateLabel("Monitor 3", 104, 248, 48, 17) IF $Monitor3Current = "" Then $Monitor3 = GUICtrlCreateCombo("", 160, 248, 217, 21, BitOR($CBS_DROPDOWN,$GUI_SS_DEFAULT_COMBO)) Else $Monitor3 = GUICtrlCreateCombo($Monitor3Current, 160, 248, 217, 21, BitOR($CBS_DROPDOWN,$GUI_SS_DEFAULT_COMBO)) EndIf GUICtrlSetData(-1, "[email protected]|[email protected]|[email protected]") GUICtrlSetTip(-1, "") GUISetState(@SW_SHOW) ;Monitor_3 Dropdown End $OK = GUICtrlCreateButton("OK", 168, 296, 75, 25, $BS_DEFPUSHBUTTON) $Cancel = GUICtrlCreateButton("Cancel", 264, 296, 75, 25) GUISetIcon("C:\Users\kpoling\Pictures\Icons\Registry.ico") While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $OK ;BEGIN SCRIPT FOR CREDENTIAL INPUT ;HotKeySet("{Enter}", "_PressButton") $CredForm = GUICreate("Credentials", 368, 230, 80, 85) $DomainLabel = GUICtrlCreateLabel("Domain", 56, 64, 40, 17) $UsernameLabel = GUICtrlCreateLabel("Username", 48, 96, 52, 17) $PasswordLabel = GUICtrlCreateLabel("Password", 48, 128, 50, 17) $CredLabel = GUICtrlCreateLabel("Please enter your credentials:", 72, 24, 212, 24) $DomainInput = GUICtrlCreateCombo(@COMPUTERNAME, 120, 64, 161, 21, BitOR($CBS_DROPDOWN,$GUI_SS_DEFAULT_COMBO)) GUICtrlSetData(-1, @COMPUTERNAME & "|Domain1|Domain2") GUICtrlSetTip(-1, "Choose from dropdown") $UserInput = GUICtrlCreateInput("administrator", 120, 96, 161, 21) $PasswordInput = GUICtrlCreateInput("", 120, 128, 161, 21, $ES_PASSWORD) $CredOK = GUICtrlCreateButton("OK", 104, 176, 75, 25, $BS_DEFPUSHBUTTON) $CredCancel = GUICtrlCreateButton("Cancel", 192, 176, 75, 25) GUISetState(@SW_SHOW) GUISetIcon("C:\Users\kpoling\Pictures\Icons\Registry.ico") While 1 $nMsg1 = GUIGetMsg() Switch $nMsg1 Case $GUI_EVENT_CLOSE Exit Case $CredOK ;END SCRIPT FOR CREDENTIAL INPUT $ServerNameRes = GUICtrlRead($ServerName) $AppNameRes = GUICtrlRead($AppName) $AppOwnerRes = GUICtrlRead($AppOwner) $DeptNameRes = GUICtrlRead($DeptName) $LocationRes = GUICtrlRead($Location) $PurposeRes = GUICtrlRead($Purpose) $Monitor1Res = GUICtrlRead($Monitor1) $Monitor2Res = GUICtrlRead($Monitor2) $Monitor3Res = GUICtrlRead($Monitor3) $UserInputRes = GUICtrlRead($UserInput) $DomainInputRes = GUICtrlRead($DomainInput) $PasswordInputRes = GUICtrlRead($PasswordInput) $RemRegSvc = 'SC \\' & $ServerNameRes & ' START "RemoteRegistry"' $AppNameCMD = 'REG ADD \\' & $ServerNameRes & '\HKLM\SOFTWARE\Inventory /f /v ApplicationName /t REG_EXPAND_SZ /d "' & $AppNameRes & '"' $AppOwnerCMD = 'REG ADD \\' & $ServerNameRes & '\HKLM\SOFTWARE\Inventory /f /v ApplicationOwner /t REG_Multi_SZ /d "' & $AppOwnerRes & '"' $DeptNameCMD = 'REG ADD \\' & $ServerNameRes & '\HKLM\SOFTWARE\Inventory /f /v DeptName /t REG_EXPAND_SZ /d "' & $DeptNameRes & '"' $LocationCMD = 'REG ADD \\' & $ServerNameRes & '\HKLM\SOFTWARE\Inventory /f /v Location /t REG_EXPAND_SZ /d "' & $LocationRes & '"' $Monitor1CMD = 'REG ADD \\' & $ServerNameRes & '\HKLM\SOFTWARE\Inventory /f /v Monitor_1 /t REG_EXPAND_SZ /d "' & $Monitor1Res & '"' $Monitor2CMD = 'REG ADD \\' & $ServerNameRes & '\HKLM\SOFTWARE\Inventory /f /v Monitor_2 /t REG_EXPAND_SZ /d "' & $Monitor2Res & '"' $Monitor3CMD = 'REG ADD \\' & $ServerNameRes & '\HKLM\SOFTWARE\Inventory /f /v Monitor_3 /t REG_EXPAND_SZ /d "' & $Monitor3Res & '"' $PurposeCMD = 'REG ADD \\' & $ServerNameRes & '\HKLM\SOFTWARE\Inventory /f /v Purpose /t REG_EXPAND_SZ /d "' & $PurposeRes & '"' ;Begin Write Registry Keys RunAsWait($UserInputRes, $DomainInputRes, $PasswordInputRes, 1, @ComSpec & " /c " & $RemRegSvc) RunAsWait($UserInputRes, $DomainInputRes, $PasswordInputRes, 1, @ComSpec & " /c " & $AppNameCMD) RunAsWait($UserInputRes, $DomainInputRes, $PasswordInputRes, 1, @ComSpec & " /c " & $AppOwnerCMD) RunAsWait($UserInputRes, $DomainInputRes, $PasswordInputRes, 1, @ComSpec & " /c " & $DeptNameCMD) RunAsWait($UserInputRes, $DomainInputRes, $PasswordInputRes, 1, @ComSpec & " /c " & $LocationCMD) RunAsWait($UserInputRes, $DomainInputRes, $PasswordInputRes, 1, @ComSpec & " /c " & $Monitor1CMD) RunAsWait($UserInputRes, $DomainInputRes, $PasswordInputRes, 1, @ComSpec & " /c " & $Monitor2CMD) RunAsWait($UserInputRes, $DomainInputRes, $PasswordInputRes, 1, @ComSpec & " /c " & $Monitor3CMD) RunAsWait($UserInputRes, $DomainInputRes, $PasswordInputRes, 1, @ComSpec & " /c " & $PurposeCMD) ;End Write Registry Keys ;Begin Registry Key Verification IF @CPUArch = "X86" Then $AppNameCurrent = RegRead("HKLM\SOFTWARE\Inventory", "ApplicationName") $AppOwnerCurrent = RegRead("HKLM\SOFTWARE\Inventory", "ApplicationOwner") $LocationCurrent = RegRead("HKLM\SOFTWARE\Inventory", "Location") $PurposeCurrent = RegRead("HKLM\SOFTWARE\Inventory", "Purpose") $DeptNameCurrent = RegRead("HKLM\SOFTWARE\Inventory", "DeptName") $Monitor1Current = RegRead("HKLM\SOFTWARE\Inventory", "Monitor_1") $Monitor2Current = RegRead("HKLM\SOFTWARE\Inventory", "Monitor_2") $Monitor3Current = RegRead("HKLM\SOFTWARE\Inventory", "Monitor_3") Else $AppNameCurrent = RegRead("HKLM64\SOFTWARE\Inventory", "ApplicationName") $AppOwnerCurrent = RegRead("HKLM64\SOFTWARE\Inventory", "ApplicationOwner") $LocationCurrent = RegRead("HKLM64\SOFTWARE\Inventory", "Location") $PurposeCurrent = RegRead("HKLM64\SOFTWARE\Inventory", "Purpose") $DeptNameCurrent = RegRead("HKLM64\SOFTWARE\Inventory", "DeptName") $Monitor1Current = RegRead("HKLM64\SOFTWARE\Inventory", "Monitor_1") $Monitor2Current = RegRead("HKLM64\SOFTWARE\Inventory", "Monitor_2") $Monitor3Current = RegRead("HKLM64\SOFTWARE\Inventory", "Monitor_3") EndIf $FormComplet = GUICreate("CMG Server Registry Entries", 498, 372, 310, 124) GUISetIcon("C:\Users\kpoling\Pictures\Icons\Registry.ico", -1) $Label1 = GUICtrlCreateLabel("Verify Registry Keys:", 160, 16, 181, 24) GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif") $ServerNameCompLabel = GUICtrlCreateLabel("ServerName", 80, 59, 69, 17) $AppNameCompLabel = GUICtrlCreateLabel("Application Name:", 59, 83, 90, 17) $AppOwnerCompLabel = GUICtrlCreateLabel("Application Owner:", 58, 107, 93, 17) $DeptNameCompLabel = GUICtrlCreateLabel("Department Name:", 57, 131, 93, 17) $LocCompLabel = GUICtrlCreateLabel("Location of Server:", 56, 155, 94, 17) $PurpCompLabel = GUICtrlCreateLabel("Purpose of Server:", 57, 179, 92, 17) $Monitor1CompLabel = GUICtrlCreateLabel("Monitor 1:", 99, 203, 51, 17) $Monitor2CompLabel = GUICtrlCreateLabel("Monitor 2:", 99, 227, 51, 17) $Monitor3CompLabel = GUICtrlCreateLabel("Monitor 3:", 99, 251, 51, 17) $ServerNameComp = GUICtrlCreateInput(@COMPUTERNAME, 160, 56, 217, 21) GUICtrlSetState(-1, $GUI_DISABLE) $AppNameComp = GUICtrlCreateInput($AppNameCurrent, 160, 80, 217, 21) GUICtrlSetState(-1, $GUI_DISABLE) $AppOwnerComp = GUICtrlCreateInput($AppOwnerCurrent, 160, 104, 217, 21) GUICtrlSetState(-1, $GUI_DISABLE) $DeptNameComp = GUICtrlCreateInput($DeptNameCurrent, 160, 128, 217, 21) GUICtrlSetState(-1, $GUI_DISABLE) $LocationComp = GUICtrlCreateInput($LocationCurrent, 160, 152, 217, 21) GUICtrlSetState(-1, $GUI_DISABLE) $PurposeComp = GUICtrlCreateInput($PurposeCurrent, 160, 176, 217, 21) GUICtrlSetState(-1, $GUI_DISABLE) $Monitor1Comp = GUICtrlCreateInput($Monitor1Current, 160, 200, 217, 21) GUICtrlSetState(-1, $GUI_DISABLE) $Monitor2Comp = GUICtrlCreateInput($Monitor2Current, 160, 224, 217, 21) GUICtrlSetState(-1, $GUI_DISABLE) $Monitor3Comp = GUICtrlCreateInput($Monitor3Current, 160, 248, 217, 21) GUICtrlSetState(-1, $GUI_DISABLE) $BackButton = GUICtrlCreateButton("Go Back", 160, 304, 75, 25) GUICtrlSetState(-1, $GUI_ENABLE) $DoneButton = GUICtrlCreateButton("Exit", 260, 304, 75, 25, $BS_DEFPUSHBUTTON) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $BackButton GUISetState(@SW_HIDE,$FormComplet) GUISetState(@SW_HIDE,$credform) exitloop 2 ; <------------------------ you were stuck in second nested while loop Case $GUI_EVENT_CLOSE Exit Case $DoneButton Exit EndSwitch WEnd ;End Registry Key Verification ; Exit ; <---- this has no effect, it never gets executed Case $CredCancel Exit EndSwitch WEnd Case $Cancel Exit EndSwitch WEnd You do not need to issue GuiSetState() till after you have created all controls relevant to the current gui, as llewxam observed.
While your use of nested while...wend loops is technically possible, it makes trouble shooting and maintenance a nightmare. I would encourage you to take a step back and define your task in terms of function / flow and re-organize your code. At a glance, I would say that each gui should be a separate function.
Good Luck,
kylomas
edit: additional info
1. - don't use a hotkey for the enter key, use an accelerator key (see the Help file)
2. - the function pointed to by the hotkey does not exist
3. - It is possible to do what you want using one gui and enabling / disabling controls. Just something to consider.
-
kylomas's post in How to save one array in another was marked as the answer
Change
_FileWriteFromArray($hExtensionsFile, $a & @CRLF) to
_FileWriteFromArray($hExtensionsFile, $a) You could have referenced your array within an array like this...
_ArrayDisplay($Entries[0]) kylomas
-
kylomas's post in New to the GUI. Need Buttons. was marked as the answer
Slightly more complicated approach...
#include <GUIConstantsEx.au3> Local $aBTN[8] Local $gui010 = GUICreate('Button Example', 400, 400) For $1 = 0 To UBound($aBTN) - 1 $aBTN[$1] = GUICtrlCreateButton('OFF', 20, $1 * 40 + 20, 360, 30) Next ; the above loop is the same as the following button definitions ;~ $aBTN[0] = GUICtrlCreateButton('OFF', 20, 20, 360, 30) ;~ $aBTN[1] = GUICtrlCreateButton('OFF', 20, 60, 360, 30) ;~ $aBTN[2] = GUICtrlCreateButton('OFF', 20, 100, 360, 30) ;~ $aBTN[3] = GUICtrlCreateButton('OFF', 20, 140, 360, 30) ;~ $aBTN[4] = GUICtrlCreateButton('OFF', 20, 180, 360, 30) ;~ $aBTN[5] = GUICtrlCreateButton('OFF', 20, 220, 360, 30) ;~ $aBTN[6] = GUICtrlCreateButton('OFF', 20, 260, 360, 30) ;~ $aBTN[7] = GUICtrlCreateButton('OFF', 20, 300, 360, 30) GUISetState() While 1 $iMSG = GUIGetMsg() Switch $iMSG Case $gui_event_close Exit Case $aBTN[0] To $aBTN[UBound($aBTN) - 1] _Toggle_BTN($iMSG) EndSwitch WEnd Func _Toggle_BTN($ctrlid) GUICtrlSetData($ctrlid, GUICtrlRead($ctrlid) = 'OFF' ? 'ON' : 'OFF') EndFunc ;==>_BTN -
kylomas's post in Find String in text File was marked as the answer
behdadsoft,
Based on your definition the following should work without having to iterate an array...
#RequireAdmin #include <File.au3> ; Local Var Local $CreateList = @ScriptDir & "\List.txt" Local $ReadPath = @DesktopDir & "\Sample.txt" local $The_String_To_Seacrh_For = 'some string' local $str = fileread($ReadPath) $str = stringreplace($str,$The_String_To_Seacrh_For,'//' & $The_String_To_Seacrh_For,1) ; replace first occurrence only filewrite($CreateList) kylomas
-
kylomas's post in File Deletion was marked as the answer
Hobbyist,
FileClose was in the wrong place (should have been in function _MyExp(). The following is the complete code and works for multiple opens.
;<<<<<<<<<<<<<<<<<<<<<<<< #include <Array.au3> ;for American Express function #include <ButtonConstants.au3> #include <ColorConstants.au3> #include <Date.au3> #include <EditConstants.au3> #include <File.au3> #include <GUIConstantsEx.au3> #include <GUIListBox.au3> #include <GuiListView.au3> #include <ListViewConstants.au3> #include <Misc.au3> #include <MsgBoxConstants.au3> ;#include <StaticConstants.au3> #include <String.au3> ; Only used to fill array #include <WindowsConstants.au3> #include <StringConstants.au3> #include <FileConstants.au3> #include <GuiButton.au3> ;<<<<<<<<<<<< #Region ### START Koda GUI section ### Form=C:\Users\\Autoit Trys\Vendors Trials\My combo Form Test.kxf $main = GUICreate("Dash Board", 680, 515, 150, 100) ;height was 480 $List1 = GUICtrlCreateListView("", 192, 72, 470, 260, $LVS_SINGLESEL, $LVS_EX_GRIDLINES + $LVS_EX_FULLROWSELECT) GUICtrlSetBkColor($List1, $COLOR_aqua) GUICtrlSetState($List1, $GUI_enABLE) $List3 = GUICtrlCreateListView("", 192, 72, 470, 260, $LVS_SINGLESEL, $LVS_EX_GRIDLINES + $LVS_EX_FULLROWSELECT) GUICtrlSetBkColor($List3, $COLOR_aqua) GUICtrlSetState($List3, $GUI_DISABLE); GUICtrlSetState($List3, $GUI_HIDE) $Button14 = GUICtrlCreateButton("Spending vs Budget", 10, 140, 158, 33) GUICtrlSetState($Button14, $GUI_enABLE) GUICtrlSetState($Button14, $GUI_FOCUS) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") $Button15 = GUICtrlCreateButton("Spending Log", 10, 180, 158, 33) GUICtrlSetState($Button15, $GUI_enABLE) GUICtrlSetState($Button15, $GUI_FOCUS) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") $Group1 = GUICtrlCreateGroup("Default Month", 28, 230, 121, 121) GUICtrlCreateGroup("", -99, -99, 1, 1) Local $idFilemenu = GUICtrlCreateMenu("&File") ;added August 3,2014 Local $idDelete = GUICtrlCreateMenuItem("Delete Spending Log", $idFilemenu) ;added Oct 18, 2014 Local $idRunmenu = GUICtrlCreateMenu("&Run") ;added August 3,2014 Local $idSpendingLog = GUICtrlCreateMenuItem("Spending Log", $idRunmenu) GUICtrlSetState($idSpendingLog, $GUI_CHECKED) ;defaults to BudgetLog at startup Local $idFileitem2 = GUICtrlCreateMenuItem("Spending vs Budget", $idRunmenu) GUISetState(@SW_SHOW) ;#EndRegion ### END Koda GUI section ### Global $sIni = @LocalAppDataDir & "\AE Dash Board Settings.ini" Global $Monthmgr ;my change Oct 6 Global $sMon ;my change Oct 6 Global $aRadio[13] Global $aMon[13] = ["", "January", "February", "March", "April", "May", "June", _ "July", "August", "September", "October", "November", "December"] $cEnterPressed = GUICtrlCreateDummy();x Global $listswitch = 1 ;switch between List 1 & 2 ;x Global $aAccelKeys[1][2] = [["{ENTER}", $cEnterPressed]];x GUISetAccelerators($aAccelKeys);x Global $budgetlogfile Global $ABC For $i = 1 To 12 $iX = (($i > 6) ? (103) : (38)) $iY = 242 + (17 * Mod($i - 1, 6)) $aRadio[$i] = GUICtrlCreateRadio(StringLeft($aMon[$i], 3), $iX, $iY, 45, 17) Next GUICtrlSetState($aRadio[_MyCheck()], $GUI_CHECKED) GUISetState() local $ret ; <-- use for function results checking While 1 $iMsg = GUIGetMsg() Switch $iMsg Case $GUI_EVENT_CLOSE Exit Case $aRadio[1] To $aRadio[12] For $i = 1 To 12 GUICtrlSetState($aRadio[$i], $GUI_FOCUS) If $iMsg = $aRadio[$i] Then $Monthmgr = $aMon[$i] & " " & StringTrimRight(_NowCalc(), 15) _MyChoice($Monthmgr) _MyValue($i) ExitLoop EndIf Next Case $Button14;Spending vs Budget _MyExp() If FileGetSize("c:\2014 Budget\Monthly Log\" & $ABC & ".csv") < 1 Then MsgBox($MB_SYSTEMMODAL, "Error", " No Entries For : " & $ABC) EndIf Case $idDelete ; delete file from menu bar If GUICtrlSetState($idDelete, $GUI_CHECKED) Then If FileExists("c:\2014 Budget\Monthly Log\" & _MyMonth($sMon) & ".csv") then if MsgBox($MB_YESNO, "Delete", " Delete This Month ? : " & _MyMonth($sMon)) = 6 Then $ret = FileDelete("c:\2014 Budget\Monthly Log\" & _MyMonth($sMon) & ".csv") ConsoleWrite($ret = 1 ? 'File deleted' & @CRLF : 'File delete failed' & @crlf) endif Else MsgBox($MB_SYSTEMMODAL, "Check", "File Does Not Exist.") endif GUICtrlSetState($idDelete, $GUI_unCHECKED) endif Case $idFileitem2 ;spending vs budget _GUICtrlListView_DeleteAllItems($List3) ;added 10/09/2014 GUICtrlSetState($idFileitem2, $GUI_CHECKED) GUICtrlSetState($idSpendingLog, $GUI_unCHECKED) GUICtrlSetState($List1, $GUI_DISABLE); GUICtrlSetState($List1, $GUI_HIDE) GUICtrlSetState($List3, $GUI_enABLE); GUICtrlSetState($List3, $GUI_show) $listswitch = 3 If _GUICtrlListView_GetItemCount($List3) = 0 Then _MyExp() EndIf If FileGetSize("c:\2014 Budget\Monthly Log\" & $ABC & ".csv") < 1 Then MsgBox($MB_SYSTEMMODAL, "Error", " No Entries For : " & $ABC) EndIf Case $Button15 ;Expense Log GUICtrlSetState($idFileitem2, $GUI_unCHECKED) GUICtrlSetState($idSpendingLog, $GUI_CHECKED) GUICtrlSetState($List1, $GUI_enABLE); GUICtrlSetState($List1, $GUI_show) GUICtrlSetState($List3, $GUI_DISABLE); GUICtrlSetState($List3, $GUI_HIDE) $ListDel = String($List1) $ListSave = String($List1) Case $idSpendingLog ;Expense Log from menu bar GUICtrlSetState($idFileitem2, $GUI_unCHECKED) GUICtrlSetState($idSpendingLog, $GUI_CHECKED) GUICtrlSetState($List1, $GUI_enABLE); GUICtrlSetState($List1, $GUI_show) GUICtrlSetState($List3, $GUI_DISABLE); GUICtrlSetState($List3, $GUI_HIDE) $listswitch = 1 $filemode = 1 $ListDel = String($List1) $ListSave = String($List1) EndSwitch WEnd _GUICtrlListView_UnRegisterSortCallBack($List3) Func _MyChoice($sMon) ;Month Name Chosen -write -$Monthmgr IniWrite($sIni, "Month", "Month", $sMon) EndFunc ;==>_MyChoice Func _MyValue($i) ;Month Checked For MyChoice - write value of $i IniWrite($sIni, "Checked", "Checked", $i) EndFunc ;==>_MyValue Func _MyCheck() ;Month Checked For MyChoice - read at next startup its MyValue Return IniRead($sIni, "Checked", "Checked", 1) ; Default is 1 EndFunc ;==>_MyCheck Func _MyMonth($sMon) ;Month Name Chosen -read -$Monthmgr Return IniRead($sIni, "Month", "Month", "January") ; Default is 1 EndFunc ;==>_MyMonth Func today() ;Return the current date in mm/dd/yyyy form Return (@MON & "-" & @MDAY & "-" & @YEAR) EndFunc ;==>today Func _MyExp() $ABC = _MyMonth($sMon) Local $budgetlogfile = FileOpen("c:\2014 Budget\Monthly Log\" & $ABC & ".csv", 0) If FileGetSize("c:\2014 Budget\Monthly Log\" & $ABC & ".csv") < 1 Then MsgBox($MB_SYSTEMMODAL, "Error", " No Entries For : " & $ABC) EndIf If $budgetlogfile = -1 Then If MsgBox($MB_YESNO, "Error", "Month Does Not Exist." & @CRLF & "Create Month: " & $ABC) = 6 Then $File = "c:\2014 Budget\Monthly Log\" & $ABC & ".csv" _FileCreate($File) Return True EndIf EndIf fileclose($budgetlogfile) EndFunc ;==>_MyExp kylomas
-
kylomas's post in I want to add a clickable text web link in my gui was marked as the answer
computergroove,
Something like this..
#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> GUICreate("My GUI") Local $hyperlink = GUICtrlCreateLabel("Ckick Me !!", 20, 20, 200, 40) GUICtrlSetFont(-1, 24, 400, 4, "MS Sans Serif") GUICtrlSetColor(-1, 0x0000FF) GUICtrlSetCursor(-1, 0) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $hyperlink ShellExecute("http://www.funk.eu") EndSwitch WEnd kylomas
edit: adapted from a response by kafu in the link that JL pointed you to.
-
kylomas's post in Send-command printing more then 1 letter ? was marked as the answer
FredX,
Your second HotKey instruction is never allowed to execute do to the 1ST while...wend loop. Just move the HotKeySet like this...
HotKeySet("1", "_A") HotKeySet("2", "_B") While 1 Sleep(10) ;Keeps script running WEnd Func _A() HotKeySet("1") ; Prevent each "a" firing the function Send("Liebe Mitbewohner und Nachbarn,") HotKeySet("1", "_A") ; Reset the HotKey ready for the next press EndFunc ;==>_A While 1 Sleep(10) ;Keeps script running WEnd Func _B() HotKeySet("2") ; Prevent each "a" firing the function Send("mit freundlichen Grüßen") HotKeySet("2", "_B") ; Reset the HotKey ready for the next press EndFunc ;==>_A ;Liebe Mitbewohner und Nachbarn,2Liebe Mitbewohner und Nachbarn,mit freundlichen Grüßen kylomas
-
kylomas's post in String Replace in array not working was marked as the answer
Jewtus,
Your syntax is wrong, try this...
$ViewParams[$p][1] = StringReplace($ViewParams[$p][1],'1900-01-01','') It would be better to follow jchd's suggestion and avoid the whole problem.
kylomas
edit: grammar
-
kylomas's post in stdoutread output help was marked as the answer
ajenkins,
Try this. It replaces hex '08' with ''.
Func _GetTrack() $sStdout = "" $prog = @TempDir & "\eac3to.exe" $input = "F:\" $hPid = Run('"' & $prog & '""' & $input & '"',$input,@SW_HIDE,0x2) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE exitprog() EndSwitch $sStdout &= StdoutRead($hPid,False) If @error Then ExitLoop If StringLen($sStdout) > 0 Then MsgBox(0,"TRACKS",stringregexpreplace($sStdout,'\x08','')) EndIf WEnd EndFunc ;==>_GetTrack kylomas
-
kylomas's post in SRE: how to find '12' and '23' from $sString = '123' was marked as the answer
Ha, I got it...
#include <array.au3> Local $sSourceString = 'ab1234567890cd' local $cnt = 4 local $aRET = stringregexp($sSourceString,'(?=(\d{' & $cnt & '}))',3) ConsoleWrite($aRET & @CRLF) _arraydisplay($aRET) -
kylomas's post in How to delete all the same files name? was marked as the answer
langthang084,
Take the tooltip out. The following runs on my slow assed system in appx. 57 seconds...
#include <FileConstants.au3> #include <File.au3> ;------------------------------------------------------------------------------------------------------------------ ; create files ;------------------------------------------------------------------------------------------------------------------ local $f1 = 'K:\folder1\' local $f2 = 'K:\folder2\' filedelete($f1) filedelete($f2) local $st = timerinit(), $hfl, $idx for $1 = 1 to 15000 $hfl = fileopen($f1 & 'file' & stringformat('%05i',$1) & '.doc',bitor($FO_CREATEPATH, $FO_OVERWRITE)) if $hfl = -1 then exit msgbox(0,'F1 failed','') fileclose($hfl) Next for $1 = 1 to 2000 $idx = stringformat('%05i',random(1,15000,1)) while fileexists($f2 & 'file' & $idx & '.doc') $idx = stringformat('%05i',random(1,15000,1)) wend $hfl = fileopen($f2 & 'file' & $idx & '.doc',bitor($FO_OVERWRITE,$FO_CREATEPATH)) if $hfl = -1 then exit msgbox(0,'F2 failed','') fileclose($hfl) Next ConsoleWrite('Time to create files = ' & stringformat('%4.2f',timerdiff($st)/1000) & ' seconds' & @CRLF) ;------------------------------------------------------------------------------------------------------------------ ; your code modified to run on my system ;------------------------------------------------------------------------------------------------------------------ $st = timerinit() $path = "k:\FOLDER2\" $path2 = "k:\FOLDER1\" $listLD = _FileListToArray($path, "*.doc", 1, False) $listFull = _FileListToArray($path2, "*.doc", 1, False) for $i = 1 to $listFull[0] ; using this for progress instead of tooltip if mod($i,1000) = 0 then ConsoleWrite('Processed ' & stringformat('%05i',$i) & ' files -- time = ' & stringformat('%4.2f',timerdiff($st)/1000) & @CRLF) for $f = 1 to $listLD[0] ; ToolTip("Full " & $i & " LD " & $f, 600, 100) ; if $listLD[$i] = $listFull[$f] Then ; you have the index var reversed causing an array exception if $listLD[$F] = $listFull[$I] Then FileDelete($path2 & $ListFull[$I]) ContinueLoop EndIf Next Next ConsoleWrite('Time to delete duplicate files = ' & stringformat('%4.2f',timerdiff($st)/1000) & @CRLF) Exit Also, see comments in code about your array indexes.
kylomas
edit: spelling
edit2: Using a progress control increased the time appx 2 seconds...
#include <FileConstants.au3> #include <File.au3> ;------------------------------------------------------------------------------------------------------------------ ; create files ;------------------------------------------------------------------------------------------------------------------ local $f1 = 'K:\folder1\' local $f2 = 'K:\folder2\' filedelete($f1) filedelete($f2) local $st = timerinit(), $hfl, $idx for $1 = 1 to 15000 $hfl = fileopen($f1 & 'file' & stringformat('%05i',$1) & '.doc',bitor($FO_CREATEPATH, $FO_OVERWRITE)) if $hfl = -1 then exit msgbox(0,'F1 failed','') fileclose($hfl) Next for $1 = 1 to 2000 $idx = stringformat('%05i',random(1,15000,1)) while fileexists($f2 & 'file' & $idx & '.doc') $idx = stringformat('%05i',random(1,15000,1)) wend $hfl = fileopen($f2 & 'file' & $idx & '.doc',bitor($FO_OVERWRITE,$FO_CREATEPATH)) if $hfl = -1 then exit msgbox(0,'F2 failed','') fileclose($hfl) Next ConsoleWrite('Time to create files = ' & stringformat('%4.2f',timerdiff($st)/1000) & ' seconds' & @CRLF) ;------------------------------------------------------------------------------------------------------------------ ; your code modified to run on my system ;------------------------------------------------------------------------------------------------------------------ $st = timerinit() progresson('Dups Checker','') $path = "k:\FOLDER2\" $path2 = "k:\FOLDER1\" $listLD = _FileListToArray($path, "*.doc", 1, False) $listFull = _FileListToArray($path2, "*.doc", 1, False) for $i = 1 to $listFull[0] ; using this for progress instead of tooltip if mod($i,1000) = 0 then ConsoleWrite('Processed ' & stringformat('%05i',$i) & ' files -- time = ' & stringformat('%4.2f',timerdiff($st)/1000) & @CRLF) progressset( int(($i/$listfull[0])*100), int(($i/$listfull[0])*100) & '%' ) for $f = 1 to $listLD[0] ; ToolTip("Full " & $i & " LD " & $f, 600, 100) ; if $listLD[$i] = $listFull[$f] Then ; you have the index var reversed causing an array exception if $listLD[$F] = $listFull[$I] Then FileDelete($path2 & $ListFull[$I]) ContinueLoop EndIf Next Next progressoff() ConsoleWrite('Time to delete duplicate files = ' & stringformat('%4.2f',timerdiff($st)/1000) & @CRLF) Exit -
kylomas's post in How to list all detected process from array list to MsgBox..? was marked as the answer
gracea,
Try this...
#include <array.au3> Local $ProcessListss[3] ; [N] = TOTAL LIST COUNT $ProcessListss[0] = "calc.exe" ; CALCULATOR $ProcessListss[1] = "notepad.exe" ; NOTEPAD $ProcessListss[2] = "mspaint.exe" ; MSPAINT local $ListToMsgBoxx ; declare your variable <<<<<<<<<<<<<<<<<< For $ProcessNamee IN $ProcessListss If ProcessExists($ProcessNamee) Then ;MsgBox(4096,"",$ProcessNamee) $ListToMsgBoxx &= $ProcessNamee & @CRLF ; add concatenation <<<<<<<<<<<<<<<<<<<<<< EndIf Sleep (100) Next MsgBox(4096,"",$ListToMsgBoxx)