Jewtus
Active Members-
Posts
529 -
Joined
-
Last visited
Profile Information
-
Member Title
If it wasn't for physics and law enforcement, I'd be unstoppable
-
Location
Boston USA
Recent Profile Visitors
469 profile views
Jewtus's Achievements
-
Jewtus reacted to a post in a topic: Is possible read output python script?
-
Jewtus reacted to a post in a topic: stdoutread not picking up error
-
Ohhhhhh that makes sense. I didn't realize they worked separately. That makes WAY more sense. Thanks @Jos!
-
I assume it should have been Run instead of RunWait? I tried just run and still I get the empty msgbox. I thought that maybe the stdoutread was getting wiped out when it errors so I even tried using a temp string but still no luck: #include <AutoItConstants.au3> #include <MsgBoxConstants.au3> _Example() Func _Example() Local $pid = Run('"' & @ComSpec & '" /c net share SharedFolder="C:\TEST" /grant:everyone,FULL', '', @SW_HIDE, $STDOUT_CHILD + $STDERR_CHILD) local $sOutput While 1 $sTemp = StdoutRead($pid) ; Exit the loop if the process closes or StdoutRead returns an error. If @error Then ExitLoop Else $sOutput=$sTemp EndIf Sleep(10) WEnd MsgBox($MB_SYSTEMMODAL, "Stdout Read:", $sOutput) EndFunc
-
I tried to run both examples, but I still get a blank msgbox. Its weird because I use the exact same function elsewhere and I get the readout, but it doesn't capture this error. I actually really only care to capture the failures (if it is successful I just want the script to continue).
-
Can you describe what happens? Does nothing show up in the Array? Do you get error messages?
-
I'm trying to run a command line to create a network shared folder and make sure that I don't get an access denied error. When I use the following: $pid = RunWait('"' & @ComSpec & '" /c net share SharedFolder="C:\TEST" /grant:everyone,FULL', '', @SW_HIDE, $STDOUT_CHILD) $sOutput = StdoutRead($pid) MsgBox(0, "", $sOutput) It runs but a blank msgbox shows up and the following is written to the SCITE console: System error 5 has occurred. Access is denied. Why isn't this being captured? Is there any way of telling if the command executed correctly?
-
excellent thank you!!
-
Jewtus reacted to a post in a topic: Loop to create submenu items
-
I'm attempting to perform a loop to create a sub menu for each drive on a machine and then I want to call a function using the selected drive name. This is an example of my menu: $mBuild = GUICtrlCreateMenu("Create Share folder") $aDrivesList = DriveGetDrive('ALL') _ArrayColInsert($aDrivesList, 1) For $x = 1 To UBound($aDrivesList) - 1 $aDrivesList[$x][1]=GUICtrlCreateMenuItem(StringUpper($aDrivesList[$x][0] & "\"), $mBuild) Next When I do my case statement in the gui... how do I make the case trigger based off which one was selected? If I can figure out the index of the one selected, I can use the array to pull back the text. This is the case statement for my UI: While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE, $mExit GUIDelete($MachineSelectorGUI) ExitLoop Case $mBuild BuildShare() EndSwitch WEnd
-
TreeView Select getting inconsistent results
Jewtus replied to Jewtus's topic in AutoIt General Help and Support
That too appears to work. I'm going to use that instead. -
TreeView Select getting inconsistent results
Jewtus replied to Jewtus's topic in AutoIt General Help and Support
I think I might know what happened. I put in _beginupdate and _Endupdate (as well as locked the GUI) and I was still able to reproduce the issue, but when I applied images (I was trying to get the error to happen on the examples and was not able to do so) and it fixed the issue. Not exactly sure why, but when I gave the _add function an output variable the problem seemed to go away. #include <GUITreeView.au3> NetworkGUI() Func NetworkGUI($parent = 0) $MachineSelectorGUI = GUICreate("Network Check", 616, 500, Default, Default, Default, Default, $parent) $idMachineList = GUICtrlCreateTreeView(16, 16, 584, 420,BitOR($TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS),$WS_EX_CLIENTEDGE) $g_hImage = _GUIImageList_Create(16, 16, 5, 3) _GUIImageList_AddIcon($g_hImage, "shell32.dll", 13) _GUIImageList_AddIcon($g_hImage, "shell32.dll", 14) _GUICtrlTreeView_SetNormalImageList($idMachineList, $g_hImage) $g_hStateImage = _GUIImageList_Create(16, 16, 5, 3) _GUIImageList_AddIcon($g_hStateImage, "shell32.dll", 15) _GUIImageList_AddIcon($g_hStateImage, "shell32.dll", 23) _GUICtrlTreeView_SetStateImageList($idMachineList, $g_hStateImage) $btnSelect = GUICtrlCreateButton("Select", 528, 448, 75, 25) ;Menus $mFile = GUICtrlCreateMenu("File") $mSearchForHosts = GUICtrlCreateMenuItem("Search network for hosts", $mFile) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE GUIDelete($MachineSelectorGUI) ExitLoop Case $btnSelect local $sSelected='',$hItem=0 $hItem=_GUICtrlTreeView_GetSelection($idMachineList) ConsoleWrite($hItem&@CRLF) If $hItem <> 0 Then $sSelected=_GUICtrlTreeView_GetText($idMachineList, $hItem) MsgBox(0,"",$sSelected) Else MsgBox(0,"Oops...","Please select a host to check") EndIf Case $mSearchForHosts Local $aMachines[244]=['192.168.1.1', '192.168.1.2', '192.168.1.3', '192.168.1.4', '192.168.1.5', '192.168.1.6', '192.168.1.7', '192.168.1.8', '192.168.1.9', '192.168.1.10', '192.168.1.11', '192.168.1.12', '192.168.1.13', '192.168.1.14', '192.168.1.15', '192.168.1.16', '192.168.1.17', '192.168.1.18', '192.168.1.19', '192.168.1.20', '192.168.1.21', '192.168.1.22', '192.168.1.23', '192.168.1.24', '192.168.1.25', '192.168.1.26', '192.168.1.27', '192.168.1.28', '192.168.1.29', '192.168.1.30', '192.168.1.31', '192.168.1.32', '192.168.1.33', '192.168.1.34', '192.168.1.35', '192.168.1.36', '192.168.1.37', '192.168.1.38', '192.168.1.39', '192.168.1.40', '192.168.1.41', '192.168.1.42', '192.168.1.43', '192.168.1.44', '192.168.1.45', '192.168.1.46', '192.168.1.47', '192.168.1.48', '192.168.1.49', '192.168.1.50', '192.168.1.51', '192.168.1.52', '192.168.1.53', '192.168.1.54', '192.168.1.55', '192.168.1.56', '192.168.1.57', '192.168.1.58', '192.168.1.59', '192.168.1.60', '192.168.1.61', '192.168.1.62', '192.168.1.63', '192.168.1.64', '192.168.1.65', '192.168.1.66', '192.168.1.67', '192.168.1.68', '192.168.1.69', '192.168.1.70', '192.168.1.71', '192.168.1.72', '192.168.1.73', '192.168.1.74', '192.168.1.75', '192.168.1.76', '192.168.1.77', '192.168.1.78', '192.168.1.79', '192.168.1.80', '192.168.1.81', '192.168.1.82', '192.168.1.83', '192.168.1.84', '192.168.1.85', '192.168.1.86', '192.168.1.87', '192.168.1.88', '192.168.1.89', '192.168.1.90', '192.168.1.91', '192.168.1.92', '192.168.1.93', '192.168.1.94', '192.168.1.95', '192.168.1.96', '192.168.1.97', '192.168.1.98', '192.168.1.99', '192.168.1.100', '192.168.1.101', '192.168.1.102', '192.168.1.103', '192.168.1.104', '192.168.1.105', '192.168.1.106', '192.168.1.107', '192.168.1.108', '192.168.1.109', '192.168.1.110', '192.168.1.111', '192.168.1.112', '192.168.1.113', '192.168.1.114', '192.168.1.115', '192.168.1.116', '192.168.1.117', '192.168.1.118', '192.168.1.119', '192.168.1.120', '192.168.1.121', '192.168.1.122', '192.168.1.123', '192.168.1.124', '192.168.1.125', '192.168.1.126', '192.168.1.127', '192.168.1.128', '192.168.1.129', '192.168.1.130', '192.168.1.131', '192.168.1.132', '192.168.1.133', '192.168.1.134', '192.168.1.135', '192.168.1.136', '192.168.1.137', '192.168.1.138', '192.168.1.139', '192.168.1.140', '192.168.1.141', '192.168.1.142', '192.168.1.143', '192.168.1.144', '192.168.1.145', '192.168.1.146', '192.168.1.147', '192.168.1.148', '192.168.1.149', '192.168.1.150', '192.168.1.151', '192.168.1.152', '192.168.1.153', '192.168.1.154', '192.168.1.155', '192.168.1.156', '192.168.1.157', '192.168.1.158', '192.168.1.159', '192.168.1.160', '192.168.1.161', '192.168.1.162', '192.168.1.163', '192.168.1.164', '192.168.1.165', '192.168.1.166', '192.168.1.167', '192.168.1.168', '192.168.1.169', '192.168.1.170', '192.168.1.171', '192.168.1.172', '192.168.1.173', '192.168.1.174', '192.168.1.175', '192.168.1.176', '192.168.1.177', '192.168.1.178', '192.168.1.179', '192.168.1.180', '192.168.1.181', '192.168.1.182', '192.168.1.183', '192.168.1.184', '192.168.1.185', '192.168.1.186', '192.168.1.187', '192.168.1.188', '192.168.1.189', '192.168.1.190', '192.168.1.191', '192.168.1.192', '192.168.1.193', '192.168.1.194', '192.168.1.195', '192.168.1.196', '192.168.1.197', '192.168.1.198', '192.168.1.199', '192.168.1.200', '192.168.1.201', '192.168.1.202', '192.168.1.203', '192.168.1.204', '192.168.1.205', '192.168.1.206', '192.168.1.207', '192.168.1.208', '192.168.1.209', '192.168.1.210', '192.168.1.211', '192.168.1.212', '192.168.1.213', '192.168.1.214', '192.168.1.215', '192.168.1.216', '192.168.1.217', '192.168.1.218', '192.168.1.219', '192.168.1.220', '192.168.1.221', '192.168.1.222', '192.168.1.223', '192.168.1.224', '192.168.1.225', '192.168.1.226', '192.168.1.227', '192.168.1.228', '192.168.1.229', '192.168.1.230', '192.168.1.231', '192.168.1.232', '192.168.1.233', '192.168.1.234', '192.168.1.235', '192.168.1.236', '192.168.1.237', '192.168.1.238', '192.168.1.239', '192.168.1.240', '192.168.1.241', '192.168.1.242', '192.168.1.243', '192.168.1.244'] GUISetState(@SW_LOCK) local $ahItem[UBound($aMachines)] _GUICtrlTreeView_BeginUpdate($idMachineList) For $x=1 to UBound($aMachines)-1 If $aMachines[$x]<>'' then $ahItem[$x]=_GUICtrlTreeView_Add($idMachineList,0,$aMachines[$x],0,1) _GUICtrlTreeView_SetStateImageIndex($idMachineList, $ahItem[$x], 1) Else $ahItem[$x]=_GUICtrlTreeView_Add($idMachineList,0,$aMachines[$x],0,1) _GUICtrlTreeView_SetStateImageIndex($idMachineList, $ahItem[$x], 2) EndIf Next _GUICtrlTreeView_EndUpdate($idMachineList) GUISetState(@SW_UNLOCK) EndSwitch WEnd EndFunc -
TreeView Select getting inconsistent results
Jewtus replied to Jewtus's topic in AutoIt General Help and Support
It happens every couple times I try it, but your suggestion was a good idea. I put a console write in to see what $hItem was getting passed into the GetText function and they are in fact changing: OUTPUT: 0x0000000CDDA17620 0x0000000CDDBDA300 0x0000000CDDBDA6C0 This is 3 different values I selected, but the msgbox that showed up was still for the last IP in the list. I also tried changing: If $hItem <> 0 Then to If $hItem > 0 Then and I still am able to reproduce the issue. I'm going to keep focusing in on the GetText function because clearly that is where the issue is in my script. EDIT: I added Case $mTEST $input=InputBox("Input hItem","") $sSelected=_GUICtrlTreeView_GetText($idMachineList, $input) MsgBox(0,"",$sSelected) to validate the values that write to the console, and when I run the value through the input box... it shows the first record in the list... I've also been able to determine that if I click the Tree view before it finishes adding everything, I'm able to reproduce the issue almost every time. -
I'm trying to build a tree view that contains a list of IPs and then when you select one, additional steps are taken with the IP. I found an example of how to read the selected text of a treeview but I keep running into a problem. Sometimes, when I hit the "select" button in my UI, it returns the last record in the list and NOT the record I have selected. The weird part about this is that I've tried this a number of times on several different computers and windows versions and I keep getting the same issue. Sometimes it will ONLY select the last record, sometimes it selects the last record the first time and then starts letting you select, and sometimes it works without issue. Can anyone advise? Here is an example code block: #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <GUITreeView.au3> NetworkGUI() Func NetworkGUI($parent = 0) $MachineSelectorGUI = GUICreate("Network Check", 616, 500, Default, Default, Default, Default, $parent) $idMachineList = GUICtrlCreateTreeView(16, 16, 584, 420) $btnSelect = GUICtrlCreateButton("Select", 528, 448, 75, 25) ;Menus $mFile = GUICtrlCreateMenu("File") $mSearchForHosts = GUICtrlCreateMenuItem("Search network for hosts", $mFile) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE GUIDelete($MachineSelectorGUI) ExitLoop Case $btnSelect $hItem=0 $hItem=_GUICtrlTreeView_GetSelection($idMachineList) If $hItem <> 0 Then $sSelected=_GUICtrlTreeView_GetText($idMachineList, $hItem) MsgBox(0,"",$sSelected) Else MsgBox(0,"Oops...","Please select a host to check") EndIf Case $mSearchForHosts Local $aMachines[244]=['192.168.1.1', '192.168.1.2', '192.168.1.3', '192.168.1.4', '192.168.1.5', '192.168.1.6', '192.168.1.7', '192.168.1.8', '192.168.1.9', '192.168.1.10', '192.168.1.11', '192.168.1.12', '192.168.1.13', '192.168.1.14', '192.168.1.15', '192.168.1.16', '192.168.1.17', '192.168.1.18', '192.168.1.19', '192.168.1.20', '192.168.1.21', '192.168.1.22', '192.168.1.23', '192.168.1.24', '192.168.1.25', '192.168.1.26', '192.168.1.27', '192.168.1.28', '192.168.1.29', '192.168.1.30', '192.168.1.31', '192.168.1.32', '192.168.1.33', '192.168.1.34', '192.168.1.35', '192.168.1.36', '192.168.1.37', '192.168.1.38', '192.168.1.39', '192.168.1.40', '192.168.1.41', '192.168.1.42', '192.168.1.43', '192.168.1.44', '192.168.1.45', '192.168.1.46', '192.168.1.47', '192.168.1.48', '192.168.1.49', '192.168.1.50', '192.168.1.51', '192.168.1.52', '192.168.1.53', '192.168.1.54', '192.168.1.55', '192.168.1.56', '192.168.1.57', '192.168.1.58', '192.168.1.59', '192.168.1.60', '192.168.1.61', '192.168.1.62', '192.168.1.63', '192.168.1.64', '192.168.1.65', '192.168.1.66', '192.168.1.67', '192.168.1.68', '192.168.1.69', '192.168.1.70', '192.168.1.71', '192.168.1.72', '192.168.1.73', '192.168.1.74', '192.168.1.75', '192.168.1.76', '192.168.1.77', '192.168.1.78', '192.168.1.79', '192.168.1.80', '192.168.1.81', '192.168.1.82', '192.168.1.83', '192.168.1.84', '192.168.1.85', '192.168.1.86', '192.168.1.87', '192.168.1.88', '192.168.1.89', '192.168.1.90', '192.168.1.91', '192.168.1.92', '192.168.1.93', '192.168.1.94', '192.168.1.95', '192.168.1.96', '192.168.1.97', '192.168.1.98', '192.168.1.99', '192.168.1.100', '192.168.1.101', '192.168.1.102', '192.168.1.103', '192.168.1.104', '192.168.1.105', '192.168.1.106', '192.168.1.107', '192.168.1.108', '192.168.1.109', '192.168.1.110', '192.168.1.111', '192.168.1.112', '192.168.1.113', '192.168.1.114', '192.168.1.115', '192.168.1.116', '192.168.1.117', '192.168.1.118', '192.168.1.119', '192.168.1.120', '192.168.1.121', '192.168.1.122', '192.168.1.123', '192.168.1.124', '192.168.1.125', '192.168.1.126', '192.168.1.127', '192.168.1.128', '192.168.1.129', '192.168.1.130', '192.168.1.131', '192.168.1.132', '192.168.1.133', '192.168.1.134', '192.168.1.135', '192.168.1.136', '192.168.1.137', '192.168.1.138', '192.168.1.139', '192.168.1.140', '192.168.1.141', '192.168.1.142', '192.168.1.143', '192.168.1.144', '192.168.1.145', '192.168.1.146', '192.168.1.147', '192.168.1.148', '192.168.1.149', '192.168.1.150', '192.168.1.151', '192.168.1.152', '192.168.1.153', '192.168.1.154', '192.168.1.155', '192.168.1.156', '192.168.1.157', '192.168.1.158', '192.168.1.159', '192.168.1.160', '192.168.1.161', '192.168.1.162', '192.168.1.163', '192.168.1.164', '192.168.1.165', '192.168.1.166', '192.168.1.167', '192.168.1.168', '192.168.1.169', '192.168.1.170', '192.168.1.171', '192.168.1.172', '192.168.1.173', '192.168.1.174', '192.168.1.175', '192.168.1.176', '192.168.1.177', '192.168.1.178', '192.168.1.179', '192.168.1.180', '192.168.1.181', '192.168.1.182', '192.168.1.183', '192.168.1.184', '192.168.1.185', '192.168.1.186', '192.168.1.187', '192.168.1.188', '192.168.1.189', '192.168.1.190', '192.168.1.191', '192.168.1.192', '192.168.1.193', '192.168.1.194', '192.168.1.195', '192.168.1.196', '192.168.1.197', '192.168.1.198', '192.168.1.199', '192.168.1.200', '192.168.1.201', '192.168.1.202', '192.168.1.203', '192.168.1.204', '192.168.1.205', '192.168.1.206', '192.168.1.207', '192.168.1.208', '192.168.1.209', '192.168.1.210', '192.168.1.211', '192.168.1.212', '192.168.1.213', '192.168.1.214', '192.168.1.215', '192.168.1.216', '192.168.1.217', '192.168.1.218', '192.168.1.219', '192.168.1.220', '192.168.1.221', '192.168.1.222', '192.168.1.223', '192.168.1.224', '192.168.1.225', '192.168.1.226', '192.168.1.227', '192.168.1.228', '192.168.1.229', '192.168.1.230', '192.168.1.231', '192.168.1.232', '192.168.1.233', '192.168.1.234', '192.168.1.235', '192.168.1.236', '192.168.1.237', '192.168.1.238', '192.168.1.239', '192.168.1.240', '192.168.1.241', '192.168.1.242', '192.168.1.243', '192.168.1.244'] For $x=1 to UBound($aMachines)-1 If $aMachines[$x]<>'' then GUICtrlCreateTreeViewItem($aMachines[$x], $idMachineList) GUICtrlSetImage(-1, "shell32.dll", 16) EndIf Next EndSwitch WEnd EndFunc
-
Jewtus reacted to a post in a topic: How to get text from a treeview item when its clicked
-
Jewtus reacted to a post in a topic: Trouble with multithreading and stdoutread
-
Trouble with multithreading and stdoutread
Jewtus replied to Jewtus's topic in AutoIt General Help and Support
fair enough... Multi-tasking @Chimp that looks and works very well, but the one part I actually need out of it... I need the host name. When I run _nPing('192.168.183.1-255') to see what host names are on my direct network, I do get an array back, but I don't get any hostnames. I have been running into issues with _TCPIpToName on windows 10 and that is why I reverted back to doing what I know.. command lines. Edit: found the resolve flag... that seems to have worked. Any reason I shouldn't change $MAX_PROCESS? -
Try this: #include <File.au3> #include <Array.au3> #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <GUIListBox.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> $Masen_1 = GUICreate("Masen's Headquarter", 777, 574, 192, 124) GUISetCursor (0) GUISetBkColor(0xFF0000) $Home = GUICtrlCreateButton("Home", 112, 64, 75, 25, $WS_GROUP) $Company = GUICtrlCreateButton("Company", 192, 64, 75, 25, $WS_GROUP) $Music = GUICtrlCreateButton("Music", 432, 64, 75, 25, $WS_GROUP) $Pictures = GUICtrlCreateButton("Pictures", 352, 64, 75, 25, $WS_GROUP) $Website = GUICtrlCreateButton("Website", 272, 64, 75, 25, $WS_GROUP) $Admin = GUICtrlCreateButton("Admin", 512, 64, 75, 25, $WS_GROUP) $MHQ = GUICtrlCreateLabel("Masen's Headquarter Interface", 112, 8, 577, 50) GUICtrlSetFont(-1, 30, 800, 0, "MS Sans Serif") GUICtrlSetColor(-1, 0x0000FF) GUICtrlSetBkColor(-1, 0x000000) $Open = GUICtrlCreateButton("Open", 80, 520, 75, 25, $WS_GROUP) $SD1 = GUICtrlCreatePic("C:\Users\masen\Desktop\Workshop Interface\Prototype Images\Space Divider1.bmp", 32, 112, 716, 12, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS)) $Folder = GUICtrlCreateLabel("Folders", 304, 128, 127, 39) GUICtrlSetFont(-1, 22, 800, 0, "MS Reference Sans Serif") GUICtrlSetColor(-1, 0xFFFFFF) GUICtrlSetBkColor(-1, 0x000000) $Folders = GUICtrlCreateButton("Folders", 592, 64, 75, 25, $WS_GROUP) $List1 = GUICtrlCreateList("", 24, 184, 713, 318) $ListValues=List1() for $x=1 to UBound($ListValues)-1 _GUICtrlListBox_AddFile($List1,$ListValues[$x]) Next GUISetState(@SW_SHOW) Global $var While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func List1 () ; List all the files and folders in the desktop directory using the default parameters and return the full path. Local $aFileList = _FileListToArray(@DesktopDir, Default, Default, True) _ArrayDisplay($aFileList) If @error = 1 Then MsgBox($MB_SYSTEMMODAL, "", "Path was invalid.") Exit EndIf If @error = 4 Then MsgBox($MB_SYSTEMMODAL, "", "No file(s) were found.") Exit EndIf Return $aFileList EndFunc ;==>Example
-
I have a script that searches the network and finds the hostname of any IP that I'm trying to build but I'm running into a couple issues: 1) I put a counter in to limit the number of threads that runs but it doesn't seem to be working and I have no idea what I'm missing 2) The loop also reads stdout, but I think that the way I have my loop setup, its purging the stdout value if the process has finished This is what I've been fooling around with: #include <GUIConstantsEx.au3> #include <array.au3> $addresses=CheckNetwork() _ArrayDisplay($addresses) Func CheckNetwork() ;Uses local host ;Check for IP range to search $found = 0 ;how many active connections you have $localIP1 = @IPAddress1 $localIP2 = @IPAddress2 $localIP3 = @IPAddress3 $localIP4 = @IPAddress4 If $localIP1 <> "0.0.0.0" Then $found += 1 If $localIP2 <> "0.0.0.0" Then $found += 1 If $localIP3 <> "0.0.0.0" Then $found += 1 If $localIP4 <> "0.0.0.0" Then $found += 1 If $found > 1 Then ;if there is more than one network available you will be prompted to choose which to scan If $found <3 then GUICreate("Choose an IP range", 240, 55, (@DesktopWidth / 2) - 120, @DesktopHeight / 4) Else GUICreate("Choose an IP range", 240, 115, (@DesktopWidth / 2) - 120, @DesktopHeight / 4) EndIf $IPShow = StringSplit($localIP1, ".") $button1 = GUICtrlCreateButton($IPShow[1] & "." & $IPShow[2] & "." & $IPShow[3] & ".xxx", 5, 5, 110, 40) $IPShow = StringSplit($localIP2, ".") $button2 = GUICtrlCreateButton($IPShow[1] & "." & $IPShow[2] & "." & $IPShow[3] & ".xxx", 125, 5, 110, 40) $IPShow = StringSplit($localIP3, ".") $button3 = GUICtrlCreateButton($IPShow[1] & "." & $IPShow[2] & "." & $IPShow[3] & ".xxx", 5, 50, 110, 40) $IPShow = StringSplit($localIP4, ".") $button4 = GUICtrlCreateButton($IPShow[1] & "." & $IPShow[2] & "." & $IPShow[3] & ".xxx", 125, 50, 110, 40) If @IPAddress1 = "0.0.0.0" Then GUICtrlDelete($button1) If @IPAddress2 = "0.0.0.0" Then GUICtrlDelete($button2) If @IPAddress3 = "0.0.0.0" Then GUICtrlDelete($button3) If @IPAddress4 = "0.0.0.0" Then GUICtrlDelete($button4) GUISetState(@SW_SHOW, "Choose an IP range") Do $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then Exit If $msg = $button1 Then $chosenIP = @IPAddress1 ExitLoop EndIf If $msg = $button2 Then $chosenIP = @IPAddress2 ExitLoop EndIf If $msg = $button3 Then $chosenIP = @IPAddress3 ExitLoop EndIf If $msg = $button4 Then $chosenIP = @IPAddress4 ExitLoop EndIf Until 1 = 2 GUIDelete("Choose an IP range") Else If $localIP1 <> "0.0.0.0" Then $chosenIP = $localIP1 If $localIP2 <> "0.0.0.0" Then $chosenIP = $localIP2 If $localIP3 <> "0.0.0.0" Then $chosenIP = $localIP3 If $localIP4 <> "0.0.0.0" Then $chosenIP = $localIP4 EndIf $oct = StringSplit($chosenIP, ".") $range = $oct[1] & "." & $oct[2] & "." & $oct[3] & "." Local $address[255][3] For $i = 0 To 254 $address[$i][0] = $range & $i+1; generate IP $address[$i][1] = 0 $address[$i][2] = 0 Next $threads=5 local $current=0,$total=UBound($address)-1,$counter=0 ProgressOn("Working","Working") Do $sPercent=Round(($current/$total)*100,2) ProgressSet($sPercent,$sPercent&"%") For $i = 0 To UBound($address)-1 $sIP=$address[$i][0] If $address[$i][1] = 0 and $counter < $threads then $cmdLine='"' & @ComSpec & '" /c "ping -n 1 -w 5 -a '&$sIP&'"' $address[$i][1] = Run($cmdLine, '', @SW_HIDE,$STDOUT_CHILD) $counter=$counter+1 Elseif $address[$i][1] <> 0 Then If $address[$i][2]="" or $address[$i][2]=0 then $address[$i][2]=StdoutRead($address[$i][1]) If ProcessExists($address[$i][1])=0 AND $counter>0 then $counter=$counter-1 $current=$current+1 EndIf EndIf Next Until $counter=0 ProgressOff() Return $address EndFunc When I run this, it seems fine until one thread finishes and then it just fires every single other ping. It also doesn't seem to be saving the output in my array on a consistent basis (seems to purge the values when finished). Am I missing something obvious?
-
No results when reading remote registry
Jewtus replied to Jewtus's topic in AutoIt General Help and Support
EDIT: Ok this seems to work with the service off.. Func WMI_GetRemoteRegVal($sHost, $sRegPath, $sUser = "", $sPass = "") Local $strKeyPath = '', $arrValueNames, $arrValueTypes, $strValue, $aReturn[0][2] $aString = StringSplit($sRegPath, "\") $sStringBase = $aString[1] For $x = 2 To UBound($aString) - 1 If $strKeyPath = '' Then $strKeyPath = $aString[$x] Else $strKeyPath = $strKeyPath & '\' & $aString[$x] EndIf Next If $sStringBase = "HKEY_CLASSES_ROOT" Or $sStringBase = "HKCR" Then $nHKEY = 0x80000000 If $sStringBase = "HKEY_CURRENT_USER" Or $sStringBase = "HKCU" Then $nHKEY = 0x80000001 If $sStringBase = "HKEY_LOCAL_MACHINE" Or $sStringBase = "HKLM" Then $nHKEY = 0x80000002 If $sStringBase = "HKEY_USERS" Or $sStringBase = "HKU" Then $nHKEY = 0x80000003 If $sStringBase = "HKEY_CURRENT_CONFIG" Or $sStringBase = "HKCC" Then $nHKEY = 0x80000005 $objSWbemLocator = ObjCreate("WbemScripting.SWbemLocator") If $sHost='locahost' Then $objSWbemServices = $objSWbemLocator.ConnectServer($sHost, "root\CIMV2") Else $objSWbemServices = $objSWbemLocator.ConnectServer($sHost, "root\CIMV2", $sUser, $sPass) EndIf $objRegistry = $objSWbemServices.Get("StdRegProv") $objRegistry.EnumValues($nHKEY, $strKeyPath, $arrValueNames, $arrValueTypes) For $i = 0 To UBound($arrValueNames) - 1 $strValueName = $arrValueNames[$i] $objRegistry.GetStringValue($nHKEY, $strKeyPath, $strValueName, $strValue) _ArrayAdd($aReturn, $arrValueNames[$i] & "|" & $strValue) Next If UBound($aReturn) > 0 Then Return $aReturn Else Return -1 EndIf EndFunc ;==>WMI_GetRemoteRegVal