
JonnyThunder
Active Members-
Posts
106 -
Joined
-
Last visited
Everything posted by JonnyThunder
-
Catching hangs / detecting dead processes
JonnyThunder replied to JonnyThunder's topic in AutoIt General Help and Support
Thank you for your reply - thats really helpful. I'm going to have a play around with it and see if I can resolve the issue. We noticed something else happening on the PC which is doing the scanning. It seems that after a couple of thousand PCs - the script starts bombing out all attempts to connect to anything with WMI (until after you reboot). Hmmmm. -
Catching hangs / detecting dead processes
JonnyThunder replied to JonnyThunder's topic in AutoIt General Help and Support
hi there, thanks for your responses. Okay, i've only got one window which does everything - so getting the PID should be easy enough. I can call another autoit script and pass that ID - but how do I do the 'step 3' part within AutoIT? -
Hello again, Right. I've written a rather complicated script which scans all the PCs listed in our Active Directory and scans them for various things. The problems begin, when using WMI connections. If a machine has issues with WMI - often the script will just hang. Now, out of 5000+ PCs on our network, only a handful have WMI issues. I've adapted the script to automatically add the last failed machine to an exclude list - but currently have no way of killing the script if the process hangs. So... my question is... Is there any way to either (1) automatically kill the scripts process if the process hangs or (2) kill the script with another external detection script, based on it hanging? Ooh, good one for a tuesday morning! Many thanks, JT
-
Using variables with objects
JonnyThunder replied to JonnyThunder's topic in AutoIt General Help and Support
Ahh, thats brilliant. i actually went down the same way of thinking and tried eval, but not execute. Thanks for your post PsaltyDS. Mucho appreciate-o. /nicotine required. -
Using variables with objects
JonnyThunder replied to JonnyThunder's topic in AutoIt General Help and Support
This script does work, but not sure what you mean by it! It's still pulling information from those properties without variables. -
Hello, Im using various WMI queries to extract information on a PC. I'd have a bit of code like this... $colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_BaseBoard", "WQL", $wbemFlagReturnImmediately + $wbemFlagForwardOnly) If IsObj($colItems) then Dim $data_motherboard[5] For $objItem In $colItems $data_motherboard[0] = $objItem.Manufacturer $data_motherboard[1] = $objItem.Model $data_motherboard[2] = $objItem.Product $data_motherboard[3] = $objItem.SerialNumber $data_motherboard[4] = $objItem.Version Next Else $data_motherboard = False Endif Is there any way to use a variable in place of the object properties? So instead of.... $objitem.Manufacturer I'm after something like... $objitem.$mypropertyname I've tried it as above, but it doesn't work. Is there any way of doing this? Thanks, JT
-
Making a window unshiftable! :)
JonnyThunder replied to JonnyThunder's topic in AutoIt General Help and Support
Brilliant, thanks. Oddly I thought i'd tried the extended style yesterday - but the change to the new way of using includes is messing with my head! :-) Thanks tho. that did the trick! -
Hello, I've been asked to write an app which displays a message in a window. They want this window to stay on top of all others until it's closed. Are there any settings I can apply to a Gui window which will do this? Thanks, JT
-
Hello, I've got a script that runs through a list of PCs and uses WMI to connect to the PC, and extract some information about memory / modem / manufacturer. The problem is, the script will hang if there is an issue with WMI. it sits for quite some time before giving this error: "The requested action with this object has failed". Are there any error trapping fascilities for using WMI objects? Also, what is the cleanest way to destroy the WMI object after use? I'm using this code to initiate the WMI object: ; Create WMI object $objWMIService = ObjGet("winmgmts:\\" & $machine & "\root\CIMV2") ; Check WMI is active if isobj($objWMIService) Then ; Do stuff here else ; couldnt connect to WMI Endif ; Clear WMI object? $objWMIService = "" There must be a machine out in our network which has WMI problems - but how can I ensure my script doesn't die when it gets to these machines? The script above catches most of the instances where it cant get a WMI connection, but I think the machines that make the script die, there IS a WMI connection - but the query hangs it. Thanks, Simon
-
New error since older version of AutoIT3
JonnyThunder replied to JonnyThunder's topic in AutoIt GUI Help and Support
Ahh yes, sorry - am having a dead-head day today. It was the changes to the #includes which caused all the errors. All sorted now. Thanks for the reply. -
Hello, I downloaded the latest version of AutoIT3 (this morning) and recompiled a script i'd been working on. I now get an error : "Line -1: Error: variable used without being declared". Can anyone shed some light on this? Had automatic declaration of variables changed since last version or something? Thanks, JT
-
Hi guys & girls, Can anyone tell me if it's possible to query AD for DHCP scopes? I've got a script I wrote in VBS but am struggling to translate it for AutoIT3. Im basically after a list of the DHCP scopes and descriptions. or are there any UDFs which cover DHCP scopes? Thanks, JT
-
Hello, Is there any way to get a compiled script to include an external .AU3 file, but only if it exists? Thanks, JT
-
Hello, I'm writing a tool which puts a machine into sleep mode. The problem is, I want to avoid doing this when processor usage is high (i.e. - something is happening on the PC). Can anyone tell me how I can check processor usage? Thanks, JT
-
OMG - I can't believe I never found this until today! Absolutely stunning tool for AutoIT - thanks so much. This saves me SO much time!
-
Date / Time stamp (unix style)
JonnyThunder replied to JonnyThunder's topic in AutoIt General Help and Support
Ahh never mind. Figured it out. Just in case anyone else likes storing date/time as integer - here's the functions.... ; Function to return current time in integer format Func nowtime () return _DateDiff( 's',"1970/01/01 00:00:00",_NowCalc()) EndFunc ; Function to return date from an unix style integer timestamp Func datefromint ( $intime ) return _DateAdd ( 's', $intime, "1970/01/01 00:00:00" ) EndFunc EDIT: Ahh, you just beat me to it! :-) -
Ello, I'm using this function to create a unix style integer time stamp (seconds since 1/1/1970). Can anyone tell me how to do the reverse of this function?? Thanks, ConsoleWrite ( nowtime () ) ; returns 1208771333 Func nowtime () return _DateDiff( 's',"1970/01/01 00:00:00",_NowCalc()) EndFunc
-
Ello! I think the UDF is great, but a little overcomplicated. Take the PHP implementation of mySQL for instance - although there are a stack of mySQL commands - you'd only use a handful of them.... mysql_connect mysql_query mysql_fetch_array mysql_close At a push, you may also use these too... mysql_insert_id mysql_num_rows mysql_affected_rows Like I said, I like your UDF - but I'd personally limit it to only the commands that are needed to perform operations. For instance, there's no real need for a delete function when this can be acheived with a query command.
-
How to read keypress
JonnyThunder replied to JonnyThunder's topic in AutoIt General Help and Support
Thanks guys, i'll give that a shot and see what buttons it'll recognise. I guess some buttons aren't recognized because a driver is required to identify them under Windows. -
How to read keypress
JonnyThunder replied to JonnyThunder's topic in AutoIt General Help and Support
Actually, just found this script elsewhere on the forum - but doesn't solve my problem.... Global Const $WH_KEYBOARD_LL = 13 Global $hHook Global $hStub_KeyProc = DllCallbackRegister("_KeyProc", "long", "int;wparam;lparam") Global $hmod = DllCall("kernel32.dll", "hwnd", "GetModuleHandle", "ptr", 0) Global $hHook = DllCall("user32.dll", "hwnd", "SetWindowsHookEx", "int", _ $WH_KEYBOARD_LL, "ptr", DllCallbackGetPtr($hStub_KeyProc), "hwnd", $hmod[0], "dword", 0) Global $buffer = "" While 1 Sleep(10) WEnd Func EvaluateKey($keycode) Msgbox(0, 'Key Pressed', '$keyCode = ' & $keyCode & @CRLF & 'Chr($keyCode) = ' & Chr($keyCode)) If $keyCode = 65 then Msgbox(0, 'Winner!', 'Somebody pressed A') EndIf EndFunc ;==>EvaluateKey Func _KeyProc($nCode, $wParam, $lParam) Local $ret, $KEYHOOKSTRUCT If $nCode < 0 Then $ret = DllCall("user32.dll", "long", "CallNextHookEx", "hwnd", $hHook[0], _ "int", $nCode, "wparam", $wParam, "lparam", $lParam) Return $ret[0] EndIf If $wParam = 256 Then $KEYHOOKSTRUCT = DllStructCreate("dword;dword;dword;dword;ptr", $lParam) EvaluateKey(DllStructGetData($KEYHOOKSTRUCT, 1)) EndIf $ret = DllCall("user32.dll", "long", "CallNextHookEx", "hwnd", $hHook[0], _ "int", $nCode, "ptr", $wParam, "ptr", $lParam) Return $ret[0] EndFunc ;==>_KeyProc Func OnAutoItExit() DllCall("user32.dll", "int", "UnhookWindowsHookEx", "hwnd", $hHook[0]) DllCallbackFree($hStub_KeyProc) EndFunc ;==>OnAutoItExit When running this, it doesn't pick up the media keys on laptops (anything outside of the actual standard keyboard layout). Does anyone know of a way to do this?? -
Ello, I'm writing something to allow programmable actions for keys on a laptop. How can I return the keycode from a key being pressed, without knowing what the key is beforehand?? Thanks, JT
-
Button Snake [Game] v2.0! - NOW WITH LEVEL PLAY!
JonnyThunder replied to JonnyThunder's topic in AutoIt Example Scripts
Yeah, there is a total score counter $absolute_apples (or something like that). it's just that the titlebar shows the level score instead. Anyway, thats it for me. I'm not doing anything else with this game now - so anyone can pick up the mantle if they want to. Hope someone had fun with it anyway! -
Button Snake [Game] v2.0! - NOW WITH LEVEL PLAY!
JonnyThunder replied to JonnyThunder's topic in AutoIt Example Scripts
BRAND NEW VERSION NOW POSTED! Lots of new features included, along with a front end. See first post for details!!! -
Button Snake [Game] v2.0! - NOW WITH LEVEL PLAY!
JonnyThunder replied to JonnyThunder's topic in AutoIt Example Scripts
Lol... love it. Next release i'll put those sounds in and release as a package. -
Button Snake [Game] v2.0! - NOW WITH LEVEL PLAY!
JonnyThunder replied to JonnyThunder's topic in AutoIt Example Scripts
Thats what im working on now. The new version will basically have a list of inbuilt levels which you'll run through. You will be able to change them if you like - im just looking for some samples now. I could do it myself, but im busy writing the code!