-
Posts
132 -
Joined
-
Last visited
Profile Information
-
Interests
Language
Travel
History
Creation Science
Recent Profile Visitors
850 profile views
NDog's Achievements
-
Parsix reacted to a post in a topic: how do you destroy, undeclare, unset variable?
-
NDog reacted to a post in a topic: RegExp - Remove Leading/Trailing char
-
What If I have a really long nested If statement or contained within a function, and I need to break out of if,else,elseif statment though? eg Func X() Do stuff If $x = 0 Then Do Stuff Else Do Stuff -- >I want to leave if statement if something doesn't work here to avoid Doing more stuff Doing more Stuff EndIf More stuff EndFunc According to the posters logic above I should rewrite all my If statements to seperate functionS?
-
NDog reacted to a post in a topic: _FileListToArray multiple search filters
-
_FileListToArray multiple search filters
NDog replied to NDog's topic in AutoIt General Help and Support
Yes that is much better $hFilesFolders = _FileListToArrayRec($sDriverDumpDir, 'Driver.nfo;oem*.inf', $FLTAR_FILES, $FLTAR_RECUR, $FLTAR_SORT, $FLTAR_FULLPATH) -
Sorry for the silly question. Since _FileListToArray doesn't support multiple filters, how then do I add all the desired multiple filters into one array? $hFilesFolders = _FileListToArray($sDriverDumpDir, 'driver.nfo') $hFilesFolders = _FileListToArray($sDriverDumpDir, 'oem*.inf')
-
NDog reacted to a post in a topic: Regex toolkit
-
NDog reacted to a post in a topic: Regex toolkit
-
NDog reacted to a post in a topic: Regex toolkit
-
I can confirm this same bug today with later version of autoit than 3.3.12.0 Since all my code requires Windows PE support, I will be sticking to 3.3.12.0 for now.
-
Hi there, could this tool generate autoit code from this tool? I'm using the match and replace option and then manually writing StringRegExpReplace() function, but the code does not work as described in the Regex toolkit, presumably I don't know what function I should use, hence the request
-
[solved] clear an image without resizing the control?
NDog replied to NDog's topic in AutoIt GUI Help and Support
Thanks Melba23 always to my rescue! -
NDog reacted to a post in a topic: [solved] clear an image without resizing the control?
-
[solved] clear an image without resizing the control?
NDog replied to NDog's topic in AutoIt GUI Help and Support
bump -
How do you first clear an image without resizing the control (as a function)? I'm not sure if this is a bug but if you compare clearing as a function vs as a global? it works differently? I need to clear the image first as sometimes no image file is found #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <ColorConstants.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> $hMain = GUICreate("Test", -1, 300, -1, -1, BitOr($WS_SIZEBOX, $WS_SYSMENU, $WS_MAXIMIZEBOX, $WS_MINIMIZEBOX), $WS_EX_ACCEPTFILES) $btn = GUICtrlCreateButton("Change", 120, 80, 75, 20, $BS_DEFPUSHBUTTON) $picUser = GUICtrlCreatePic("", 270, 10, 100, 80) $sImage = "C:\Windows\Web\Screen\img100.jpg" GUICtrlSetImage($picUser,""); - can be left alone without resizing control $sImage = "C:\Windows\Web\Screen\img104.jpg" GUICtrlSetImage($picUser, $sImage) GUISetState(@SW_SHOW) While True $nMsg = GUIGetMsg() Select Case $nMsg = $GUI_EVENT_CLOSE Exit Case $nMsg = $btn ButtonPressed("C:\Windows\Web\Screen\img102.jpg") EndSelect WEnd Func ButtonPressed($imagelocation) ;GUICtrlSetImage($picUser,""); - don't comment out - it will clear picture but resize control GUICtrlSetImage($picUser, $imagelocation) EndFunc
-
how to change pic in GUICtrlCreatePic
NDog replied to jakalspop's topic in AutoIt General Help and Support
- -
How to change a listview color item?
NDog replied to NDog's topic in AutoIt General Help and Support
Thanks @Dannyfirex - I didn't realise the $hImage is just an array (containing images) - wow I will look at your UDF too @Melba23 it looks very easy to use - thanks -
NDog reacted to a post in a topic: How to change a listview color item?
-
Hi there I am making a program to detect if a computer is online or not. I would like the color or a circle in a listview box to change from yellow to red or yellow to green depending if online or not. Is it possible? I have my code so far for testing with. I'm getting stuck with changing the color as it doesn't seem to be able to be done dynamically.. #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <ColorConstants.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <GuiListView.au3> #include <GuiImageList.au3> $hMain = GUICreate("Test", -1, 300, -1, -1, BitOr($WS_SIZEBOX, $WS_SYSMENU, $WS_MAXIMIZEBOX, $WS_MINIMIZEBOX), $WS_EX_ACCEPTFILES);x il drag & drop ;;top GUICtrlCreateLabel("Listview colour", 55, 0, 275, 40) GUICtrlSetFont(-1, 24, 400, 0, "Comic Sans MS") GUICtrlSetColor(-1, $COLOR_GREEN) GUICtrlCreateLabel("Testing 123", 200, 40, 120, 18) GUICtrlSetFont(-1, 8, 40, 0, "Comic Sans MS") GUICtrlSetColor(-1, $COLOR_BLUE) ;;body GUICtrlCreateLabel("User:", 25, 68, 30, 16) $inUser = GUICtrlCreateInput("", 56, 66, 83, 21) $btnLookup = GUICtrlCreateButton("Lookup", 150, 60, 75, 33, $BS_DEFPUSHBUTTON) $btnGreen = GUICtrlCreateButton("Green", 230, 60, 43, 33) $btnRed = GUICtrlCreateButton("Red", 275, 60, 43, 33) $listComputers = GUICtrlCreateListView("Name |Model |Serial |OS Install date|HDD", 55, 100, 290, 100, BitOR($LVS_SHOWSELALWAYS, $LVS_NOSORTHEADER, $LVS_REPORT, $LVS_SINGLESEL)) GUICtrlSetState($inUser, $GUI_FOCUS) GUISetState(@SW_SHOW) ; Main GUI loop While True $nMsg = GUIGetMsg() Select Case $nMsg = $GUI_EVENT_CLOSE Exit Case $nMsg = $inUser GUICtrlSetState($inUser, $GUI_FOCUS) Case $nMsg = $btnLookup LookupButtonPressed() Case $nMsg = $btnGreen $iIndex = _GUICtrlListView_GetSelectedIndices($listComputers) $machine = _GUICtrlListView_GetItemText($listComputers, Number($iIndex)) ; ; change to green? ;_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($listComputers, 0x00FF00, 16, 16)) ; green Case $nMsg = $btnRed $iIndex = _GUICtrlListView_GetSelectedIndices($listComputers) $machine = _GUICtrlListView_GetItemText($listComputers, Number($iIndex)) ; ; change to red? ;_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($listComputers, 0xFF0000, 16, 16)) ; red EndSelect WEnd Func LookupButtonPressed() _GUICtrlListView_DeleteAllItems($listComputers) ;$aMachines = machine_lookup($user, $searchstring) Local $aMachines[2][5] $aMachines[0][0] = "PC01" $aMachines[0][1] = "HP Compaq 6000" $aMachines[0][2] = "ABC123" $aMachines[0][3] = "01/01/2001" $aMachines[0][4] = "Toshiba HDD" $aMachines[1][0] = "PC02" $aMachines[1][1] = "HP Compaq 6000" $aMachines[1][2] = "XYZ456" $aMachines[1][3] = "01/01/2001" $aMachines[1][4] = "Toshiba HDD" ;_ArrayDisplay($aMachines) If Not @error Then If IsArray($aMachines) Then $sComputers = _ArrayToString($aMachines, " - ") $sComputers = StringReplace($sComputers, @CRLF, "|") ;ConsoleWrite($sComputers & @CRLF) For $i = 0 To UBound($aMachines) - 1 $machine = $aMachines[$i][0] $model = $aMachines[$i][1] $serial = $aMachines[$i][2] $OSInstallDate = $aMachines[$i][3] $HDD = $aMachines[$i][4] _GUICtrlListView_AddItem($listComputers, $machine) _GUICtrlListView_AddSubItem($listComputers, $i, $model,1) _GUICtrlListView_AddSubItem($listComputers, $i, $serial,2) _GUICtrlListView_AddSubItem($listComputers, $i, $OSInstallDate,3) _GUICtrlListView_AddSubItem($listComputers, $i, $OSInstallDate,3) _GUICtrlListView_AddSubItem($listComputers, $i, $HDD,4) $hImage = _GUIImageList_Create(16, 16) _GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($listComputers, 0xFFFF00, 16, 16)) ; yellow _GUICtrlListView_SetImageList($listComputers, $hImage, 1) Next _GUICtrlListView_SetItemSelected($listComputers, 0) EndIf EndIf EndFunc
-
Does autoit support a list or dictionary?
NDog replied to NDog's topic in AutoIt General Help and Support
if there is a solution to just use _ArrayAdd() thats good. I guess something along those lines _ArrayAdd("A Block,A7_PROJ,44:D2:44:F9:B0:5D,172.16.60.14") ; OK + wiki, HDMI + LAN _ArrayAdd("A Block,A9_PROJ,64:EB:8C:DA:A7:61,172.16.60.19") ; OK + wiki, HDMI + LAN _ArrayAdd("B Block,B6_PROJ,64:EB:8C:D6:92:11,172.16.60.17") ; OK + wiki, VGA + HDMI + LAN _ArrayAdd("C Block,C1_PROJ,64:EB:8C:DA:A7:64,172.16.60.16") ; OK + wiki, HDMI + LAN _ArrayAdd("C Block,C6_PROJ,00:26:AB:FE:29:A6,172.16.60.15") ; OK + wiki, HDMI + LAN _ArrayAdd("C Block,C7_PROJ,64:EB:8C:D4:A7:4C,172.16.60.11") ; OK + wiki, HDMI (only) _ArrayAdd("C Block,C8_PROJ,F8:D0:27:03:71:FF,172.16.60.39") ; _ArrayAdd("C Block,C9_PROJ,F8:D0:27:00:96:93,172.16.60.37") ; OK + wiki, HDMI + LAN cable connected but not live _ArrayAdd("C Block,C10_PROJ,64:EB:8C:D5:8C:84,172.16.60.24") ; ? _ArrayAdd("C Block,TEPUNA_PROJ,9C:AE:D3:DF:4F:DB,172.16.60.28") ; OK + wiki, HDMI + LAN Thanks for point in the right direction -
Does autoit support a list or dictionary?
NDog replied to NDog's topic in AutoIt General Help and Support
I think SQLite may be too step a learning curve as well as adding more complexity. Also I will still have to rearrange data into the db file, so I would rather leave all the data as text. It's not just me editing the script but other people who should be able to quickly add to it. With vbs you can just do something like this Set lDetected = CreateObject("System.Collections.ArrayList") lDetected.Add "value1" lDetected.Add "value2" lDetected.Add "value3" For Each u In lDetected WScript.Echo u Next Is there something as simple in autoit? I would prefer to use autoit as the iniwrite functions are brilliant and clean code. Thanks -
Does autoit support List? I would like to create an array but without having to declare every variable individually every time, as we move the order around eg adding another projector to a classroom eg A and the script is quite heavily modified as required. It gets tedious having to change all the numbers every time and over time the list will get much larger write-projector-ini.au3 ; list of projectors around the school ; these should be added into list alphabetically ; WARNING - Projector names are case sensitive and must appear exactly as named! Dim $projector[100] $projector[1] = 'A Block,A7_PROJ,44:D2:44:F9:B0:5D,172.16.60.14' ; OK + wiki, HDMI + LAN $projector[2] = 'A Block,A8_PROJ,F8:D0:27:00:96:93,172.16.60.37' ; OK + wiki $projector[3] = 'A Block,A9_PROJ,64:EB:8C:DA:A7:61,172.16.60.19' ; OK + wiki, HDMI + LAN $projector[4] = 'B Block,B6_PROJ,64:EB:8C:D6:92:11,172.16.60.17' ; OK + wiki, VGA + HDMI + LAN $projector[5] = 'C Block,C1_PROJ,64:EB:8C:DA:A7:64,172.16.60.16' ; OK + wiki, HDMI + LAN $projector[6] = 'C Block,C6_PROJ,00:26:AB:FE:29:A6,172.16.60.15' ; OK + wiki, HDMI + LAN $projector[7] = 'C Block,C7_PROJ,64:EB:8C:D4:A7:4C,172.16.60.11' ; OK + wiki, HDMI (only) $projector[8] = 'C Block,C8_PROJ,F8:D0:27:03:71:FF,172.16.60.39' ; OK + wiki $projector[9] = 'C Block,C10_PROJ,64:EB:8C:D5:8C:84,172.16.60.24' ; wiki $projector[10] = 'C Block,TEPUNA_PROJ,9C:AE:D3:DF:4F:DB,172.16.60.28' ; OK + wiki, HDMI + LAN $projector[11] = 'D Block,D2_PROJ,64:EB:8C:D9:6C:C6,172.16.60.6' ; OK + wiki, VGA + LAN (impractible to use HDMI in this classroom due to length + varnish floor) $projector[12] = 'D Block,D4_PROJ,44:D2:44:F9:B0:59,172.16.60.13' ; OK + wiki, HDMI + LAN $projector[13] = 'D Block,D7_PROJ,64:EB:8C:D3:87:B2,172.16.60.18' ; OK + wiki, HDMI + LAN $projector[14] = 'D Block,D8_PROJ,64:EB:8C:D4:A7:4D,172.16.60.27' ; wiki + VGA (temporary) + LAN $projector[15] = 'D Block,D9_PROJ,64:EB:8C:D5:8C:CB,172.16.60.2' ; OK + wiki, HDMI + LAN $projector[16] = 'E Block,E2_PROJ,64:EB:8C:D9:6C:C9,172.16.60.7' ; OK + wiki, HDMI + LAN $projector[17] = 'E Block,E3_PROJ,64:EB:8C:B9:53:9E,172.16.60.25' ; OK + wiki, HDMI + LAN + speaker $projector[18] = 'E Block,E4_PROJ,64:EB:8C:B9:3B:BC,172.16.60.40' ; TO INSTALL HDMI + LAN $projector[19] = 'F Block,F3_PROJ,64:EB:8C:B9:69:21,172.16.60.34' ; OK + wiki, HDMI + LAN + speaker $projector[20] = 'F Block,F4_PROJ,64:EB:8C:B8:68:DB,172.16.60.35' ; OK + wiki, HDMI + LAN + speaker $projector[21] = 'F Block,F5_PROJ,64:EB:8C:B9:67:75,172.16.60.36' ; OK + wiki, HDMI + LAN + speaker $projector[22] = 'F Block,F8_PROJ,64:EB:8C:DA:A7:5C,172.16.60.5' ; OK + wiki, HDMI + Screenbeam (no LAN cable) $projector[23] = 'F Block,F9_PROJ,64:EB:8C:D6:92:0B,172.16.60.9' ; OK + wiki, HDMI + LAN $projector[24] = 'G Block,G4_PROJ,64:EB:8C:D9:F1:63,172.16.60.38' ; OK + wiki $projector[25] = 'G Block,G5_PROJ,64:EB:8C:D6:92:0A,172.16.60.12' ; OK + wiki, HDMI + LAN $projector[26] = 'J Block,J1_PROJ,64:EB:8C:D6:92:14,172.16.60.32' ; OK + wiki, HDMI + LAN $projector[27] = 'J Block,J12L_PROJ,64:EB:8C:2F:68:92,172.16.60.20' ; OK + wiki, HDMI + LAN $projector[28] = 'J Block,J12R_PROJ,64:EB:8C:2F:E8:B8,172.16.60.21' ; OK + wiki, LAN (only) $projector[29] = 'J Block,J13_PROJ,64:EB:8C:DA:A7:5D,172.16.60.23' ; OK + wiki, HDMI + LAN $projector[30] = 'J Block,J15_PROJ,64:EB:8C:A8:01:E5,172.16.60.33' ; OK + wiki, HDMI + LAN $projector[31] = 'J Block,J17_PROJ,64:EB:8C:D6:EC:C4,172.16.60.31' ; OK + wiki, HDMI (requires LAN) $projector[32] = 'J Block,J19_PROJ,64:EB:8C:D5:8C:AB,172.16.60.4' ; OK + wiki, HDMI + LAN $projector[33] = 'K Block,K2_PROJ,64:EB:8C:D3:88:08,172.16.60.29' ; OK + wiki, HDMI + LAN $projector[34] = 'K Block,K3_PROJ,64:EB:8C:D5:8C:AC,172.16.60.26' ; OK + wiki, HDMI + VGA + LAN (requires dongle) $projector[35] = 'K Block,K4_PROJ,64:EB:8C:D6:92:15,172.16.60.30' ; OK + wiki, HDMI + LAN $projector[36] = 'Library,LIB_PROJ,64:EB:8C:D3:88:05,172.16.60.8' ; OK + wiki, HDMI + LAN $projector[37] = 'Music,M1_PROJ,64:EB:8C:B9:52:F7,172.16.60.22' ; OK + wiki, HDMI + LAN $projector[38] = 'T Block,T1_PROJ,64:EB:8C:D6:92:17,172.16.60.1' ; OK + wiki, VGA + LAN $projector[39] = 'T Block,T2_PROJ,64:EB:8C:DA:A7:88,172.16.60.10' ; OK + wiki, HDMI + LAN $projector[40] = 'T Block,T6_PROJ,64:EB:8C:D5:8C:A7,172.16.60.3' ; OK + wiki, HDMI + LAN ; write ini file $profiledir = 'C:\ProgramData\SEIKO EPSON CORPORATION\EMP NS Connection' Dim $profilefile[1] $profilefile[0] = 'Profile_s.plist' ;'$profilefile[1] = 'Profile_sa.plist' If Not FileExists($profiledir) Then DirCreate($profiledir) EndIf For $i = 0 To UBound($profilefile) - 1 FileDelete($profiledir & '\' & $profilefile[$i]) Next For $i = 0 To UBound($profilefile) - 1 If $profilefile[$i] <> "" Then For $j = 1 To UBound($projector) - 1 ;ConsoleWrite("$projector" & $j & ": " & $projector[$j] & @CRLF) If $projector[$j] <> "" Then ; split into array Local $aProjector = StringSplit($projector[$j],",") Local $Profile = $aProjector[1] Local $NM = $aProjector[2] Local $UN = StringLower($aProjector[3]) Local $IP = $aProjector[4] ; reset counter to 1 upon different $profile If Not IsDeclared("x") Then $x = $Profile $k = 1 Else If $x = $Profile Then $k = $k + 1 Else $x = $Profile $k = 1 EndIf EndIf ConsoleWrite($Profile & " " & $k & @CRLF) ; write ini section IniWrite($profiledir & '\' & $profilefile[$i], $Profile, "IP"&$k, $IP) ;change IniWrite($profiledir & '\' & $profilefile[$i], $Profile, "NM"&$k, $NM) ;change IniWrite($profiledir & '\' & $profilefile[$i], $Profile, "ED"&$k, "") IniWrite($profiledir & '\' & $profilefile[$i], $Profile, "UN"&$k, $UN) ;change IniWrite($profiledir & '\' & $profilefile[$i], $Profile, "CK"&$k, "1") If IniWrite($profiledir & '\' & $profilefile[$i], $Profile, "DS"&$k, "0") Then FileWriteLine($profiledir & '\' & $profilefile[$i], "") EndIf EndIf Next EndIf Next I looked into using a dictionary, however it appears I am doing it wrong #include 'scriptingdic.au3' $oObj = _InitDictionary() $oObj.Add("A Block", "A7_PROJ, 44:D2:44:F9:B0:5D, 172.16.60.14") $oObj.Add("B Block", "A8_PROJ, F8:D0:27:00:96:93, 172.16.60.37") $oObj.Add("C Block", "A9_PROJ, 64:EB:8C:DA:A7:61, 172.16.60.19") $oObj.Add("D Block", "B6_PROJ, 64:EB:8C:D6:92:11, 172.16.60.17") $oObj.Add("E Block", "C1_PROJ, 64:EB:8C:DA:A7:64, 172.16.60.16") ;MsgBox(0, '', $oObj.Item("A Block")) Thanks for any tips or advice
-
Taken from here there is a method to set a null variable using wmi objects http://stackoverflow.com/questions/5961299/set-dns-to-obtain-automatically-programmatically ManagementClass mClass = new ManagementClass("Win32_NetworkAdapterConfiguration"); ManagementObjectCollection mObjCol = mClass.GetInstances(); foreach (ManagementObject mObj in mObjCol) { if ((bool)mObj["IPEnabled"]) { ManagementBaseObject mboDNS = mObj.GetMethodParameters("SetDNSServerSearchOrder"); if (mboDNS != null) { mboDNS["DNSServerSearchOrder"] = null; mObj.InvokeMethod("SetDNSServerSearchOrder", mboDNS, null); } } } How could I modify the following autoit code to do this? Local $sNetAdapter = "Ethernet" Local $objWMIService = ObjGet("winmgmts:\\" & @ComputerName & "\root\CIMV2") Local $sQueryNetAdapterConfig, $colNetAdapterConfig, $objNetAdapter, $iReturn = 0 Local $adapterName $adapterName = _GetNetworkAdapterFromID($sNetAdapter) If $adapterName Then $sNetAdapter = $adapterName $sQueryNetAdapterConfig = "select * from Win32_NetworkAdapterConfiguration Where Caption like '%" & $sNetAdapter & "'" ConsoleWrite($sQueryNetAdapterConfig & @CRLF) $colNetAdapterConfig = $objWMIService.ExecQuery($sQueryNetAdapterConfig, "WQL", $wbemFlagReturnImmediately + $wbemFlagForwardOnly) ConsoleWrite($colNetAdapterConfig & @CRLF) Local $aDNSServerSearchOrder[2] $aDNSServerSearchOrder[0] = "1.1.1.1" $aDNSServerSearchOrder[1] = "1.1.1.2" For $objNetAdapter In $colNetAdapterConfig ConsoleWrite($objNetAdapter.Description & " Loop " & @CRLF) $iReturn = $objNetAdapter.SetDNSServerSearchOrder($aDNSServerSearchOrder) ConsoleWrite($iReturn & @CRLF) Next Above code works, but I want the line $iReturn = $objNetAdapter.SetDNSServerSearchOrder($aDNSServerSearchOrder) To be something like $iReturn = $objNetAdapter.SetDNSServerSearchOrder(0) If that makes sense Thanks