Leaderboard
Popular Content
Showing content with the highest reputation on 06/04/2014 in all areas
-
This is a really crude way of reading a simple (I mean simple) INI file and not having to read and write all the time using the INI functions. I know something like this already exists by AZJIO, but I wanted to target the newbie market. It uses no global variables (the enums are only there so I don't have to worry about what 0,1,2 actually means) and only 2 static variables, filepath and dictionary. Enjoy! #include <FileConstants.au3> #include <StringConstants.au3> Global Const $VARGETTYPE_BINARY = 'Binary', _ $VARGETTYPE_BOOL = 'Bool', _ $VARGETTYPE_DOUBLE = 'Double', _ $VARGETTYPE_INT32 = 'Int32', $VARGETTYPE_INT64 = 'Int64', _ $VARGETTYPE_PTR = 'Ptr', _ $VARGETTYPE_STRING = 'String' Global Const $SETTINGS_DATATYPE_BINARY = '(binary)', _ $SETTINGS_DATATYPE_BOOL = '(bool)', _ $SETTINGS_DATATYPE_DOUBLE = '(double)', _ $SETTINGS_DATATYPE_INT = '(int)', _ $SETTINGS_DATATYPE_PTR = '(ptr)', _ $SETTINGS_DATATYPE_STRING = '(string)' Global Const $SETTINGS_GUID = 'D6FFD9DF-F1B7-4C07-89C3-F8B597EEC1CF' Global Enum $SETTINGS_ASSOC, $SETTINGS_DUMP, $SETTINGS_FILEPATH, $SETTINGS_ID, $SETTINGS_MAX, $SETTINGS_GET, $SETTINGS_SET, $SETTINGS_SHUTDOWN, $SETTINGS_STARTUP Global Enum $SETTINGS_KEY, $SETTINGS_DATATYPE, $SETTINGS_VALUE Example() ; Useful if you only have a single settings file for the application. Func Example() Local $hSettings = _Settings(@ScriptDir & '\Settings.ini') ; Start the settings by passing the filepath that returns a settings object. ConsoleWrite(_Settings_Get($hSettings, 'Language', 'None') & @CRLF) ; Get the language key value of the settings object. ConsoleWrite(_Settings_Set($hSettings, 'Language', 'English') & @CRLF) ; Set the language key value to English using the settings object. ConsoleWrite(_Settings_Set($hSettings, 'Number', 100) & @CRLF) ; Set the int key value to 100 using the settings object. ConsoleWrite(_Settings_Get($hSettings, 'Language', 'None') & @CRLF) ; Get the language key value of the settings object. ConsoleWrite(_Settings_Get($hSettings, 'Int', 'None') & @CRLF) ; Get the int key value of the settings object. _Settings_Dump($hSettings) ; Dump the settings object to disk. ConsoleWrite(_Settings_FilePath($hSettings) & @CRLF) ; Get the filepath of the settings object. EndFunc ;==>Example ; Useful if you only Func Example_Static() If _Settings_Static(@ScriptDir & '\Settings_Static.ini') Then; Start the settings by passing the filepath. This returns either true or false. ConsoleWrite(_Settings_Static_Get('Language', 'None') & @CRLF) ; Get the language key value. ConsoleWrite(_Settings_Static_Set('Language', 'English') & @CRLF) ; Set the language key value to English. ConsoleWrite(_Settings_Static_Set('Number', 100) & @CRLF) ; Set the int key value to 100. ConsoleWrite(_Settings_Static_Get('Language', 'None') & @CRLF) ; Get the language key value. ConsoleWrite(_Settings_Static_Get('Int', 'None') & @CRLF) ; Get the int key value _Settings_Static_Dump() ; Dump the settings to disk. ConsoleWrite(_Settings_Static_FilePath() & @CRLF) ; Get the filepath of the settings. EndIf EndFunc ;==>Example_Static Func _Settings($sFilePath) Local $aSettings[$SETTINGS_MAX] If _AssociativeArray_Startup($aSettings[$SETTINGS_ASSOC], False) Then Local $aSRE = StringRegExp(FileRead($sFilePath), '(?:^|\R)([^=]+)=(\(\w+\))([^\r\n]*)', $STR_REGEXPARRAYGLOBALMATCH), _ $vValue = 0 For $i = 0 To UBound($aSRE) - 1 Step 3 $vValue = $aSRE[$i + $SETTINGS_VALUE] Switch $aSRE[$i + $SETTINGS_DATATYPE] Case $SETTINGS_DATATYPE_BINARY $vValue = Binary($vValue) Case $SETTINGS_DATATYPE_BOOL $vValue = (($vValue == 'True') ? True : False) Case $SETTINGS_DATATYPE_DOUBLE $vValue = Number($vValue) Case $SETTINGS_DATATYPE_INT $vValue = Int($vValue) Case $SETTINGS_DATATYPE_PTR $vValue = Ptr($vValue) Case Else $vValue = String($vValue) EndSwitch $aSettings[$SETTINGS_ASSOC].Item($aSRE[$i]) = $vValue Next $aSettings[$SETTINGS_FILEPATH] = $sFilePath $aSettings[$SETTINGS_ID] = $SETTINGS_GUID ; Set the GUID if the associative array was created successfully. Else $aSettings = Null ; Set to Null if an error occurred. EndIf Return $aSettings EndFunc ;==>_Settings Func _Settings_Dump(ByRef $aSettings) Local $bReturn = False If __Settings_IsAPI($aSettings) And $aSettings[$SETTINGS_DUMP] Then Local $aItems = $aSettings[$SETTINGS_ASSOC].Items(), $aKeys = $aSettings[$SETTINGS_ASSOC].Keys(), _ $iItemsUBound = UBound($aItems) If $iItemsUBound = UBound($aKeys) Then $bReturn = True Local $sData = '' For $i = 0 To UBound($aItems) - 1 Switch VarGetType($aItems[$i]) Case $VARGETTYPE_BINARY $aItems[$i] = $SETTINGS_DATATYPE_BINARY & $aItems[$i] Case $VARGETTYPE_BOOL $aItems[$i] = $SETTINGS_DATATYPE_BOOL & $aItems[$i] Case $VARGETTYPE_DOUBLE $aItems[$i] = $SETTINGS_DATATYPE_DOUBLE & $aItems[$i] Case $VARGETTYPE_INT32, $VARGETTYPE_INT64 $aItems[$i] = $SETTINGS_DATATYPE_INT & $aItems[$i] Case $VARGETTYPE_PTR $aItems[$i] = $SETTINGS_DATATYPE_PTR & $aItems[$i] Case Else $aItems[$i] = $SETTINGS_DATATYPE_STRING & $aItems[$i] EndSwitch $sData &= $aKeys[$i] & '=' & $aItems[$i] & @CRLF Next _SetFile($sData, $aSettings[$SETTINGS_FILEPATH], True) EndIf EndIf Return $bReturn EndFunc ;==>_Settings_Dump Func _Settings_FilePath(ByRef $aSettings) Return __Settings_IsAPI($aSettings) ? $aSettings[$SETTINGS_FILEPATH] : Null EndFunc ;==>_Settings_FilePath Func _Settings_Get(ByRef $aSettings, $sKey, $sDefault) If __Settings_IsAPI($aSettings) Then If $aSettings[$SETTINGS_ASSOC].Exists($sKey) Then $sDefault = $aSettings[$SETTINGS_ASSOC].Item($sKey) EndIf EndIf Return $sDefault EndFunc ;==>_Settings_Get Func _Settings_Set(ByRef $aSettings, $sKey, $sValue) Local $bReturn = False If __Settings_IsAPI($aSettings) Then $bReturn = True $aSettings[$SETTINGS_ASSOC].Item($sKey) = $sValue $aSettings[$SETTINGS_DUMP] = True EndIf Return $bReturn EndFunc ;==>_Settings_Set Func _Settings_Static($sFilePath) _Settings_Static_Dump() ; Dump the previous contents to disk. Return __Settings_Static($sFilePath, Null, $SETTINGS_STARTUP) EndFunc ;==>_Settings_Static Func _Settings_Static_Dump() Return __Settings_Static(Null, Null, $SETTINGS_DUMP) EndFunc ;==>_Settings_Static_Dump Func _Settings_Static_FilePath() Return __Settings_Static(Null, Null, $SETTINGS_FILEPATH) EndFunc ;==>_Settings_Static_FilePath Func _Settings_Static_Get($sKey, $sDefault) Return __Settings_Static($sKey, $sDefault, $SETTINGS_GET) EndFunc ;==>_Settings_Static_Get Func _Settings_Static_Set($sKey, $sValue) Return __Settings_Static($sKey, $sValue, $SETTINGS_SET) EndFunc ;==>_Settings_Static_Set Func _Settings_Static_Shutdown() _Settings_Static_Dump() ; Dump the previous contents to disk. Return __Settings_Static(Null, Null, $SETTINGS_SHUTDOWN) EndFunc ;==>_Settings_Static_Shutdown Func __Settings_Static($sKey, $sValue, $iAction) Local Static $hSettings = Null Local $vReturn = False Switch $iAction Case $SETTINGS_DUMP $vReturn = _Settings_Dump($hSettings) Case $SETTINGS_FILEPATH $vReturn = _Settings_FilePath($hSettings) Case $SETTINGS_GET ; Getter $vReturn = _Settings_Get($hSettings, $sKey, $sValue) Case $SETTINGS_SET ; Setter $vReturn = _Settings_Set($hSettings, $sKey, $sValue) Case $SETTINGS_SHUTDOWN $vReturn = True $hSettings = Null Case $SETTINGS_STARTUP $vReturn = True $hSettings = _Settings($sKey) EndSwitch Return $vReturn EndFunc ;==>__Settings_Static Func __Settings_IsAPI(ByRef $aSettings) Return UBound($aSettings) = $SETTINGS_MAX And $aSettings[$SETTINGS_ID] = $SETTINGS_GUID EndFunc ;==>__Settings_IsAPI Func _AssociativeArray_Startup(ByRef $aArray, $bIsCaseSensitive = False) ; Idea from MilesAhead. Local $bReturn = False $aArray = ObjCreate('Scripting.Dictionary') If IsObj($aArray) Then $aArray.CompareMode = ($bIsCaseSensitive ? 0 : 1) $bReturn = True EndIf Return $bReturn EndFunc ;==>_AssociativeArray_Startup Func _SetFile(ByRef $sString, $sFilePath, $bOverwrite = False, $iMode = Default) Local $hFileOpen = FileOpen($sFilePath, ($bOverwrite ? $FO_OVERWRITE : $FO_APPEND) + (IsDefault($iMode) ? 0 : $iMode)), _ $iError = 2 If $hFileOpen > -1 Then $iError = (FileWrite($hFileOpen, $sString) ? 0 : 1) FileClose($hFileOpen) EndIf Return SetError($iError, 0, $hFileOpen > -1) EndFunc ;==>_SetFile Func IsDefault($vDefault) Return $vDefault = Default EndFunc ;==>IsDefault2 points
-
Need some help bringing this all together
Mobius reacted to seanbrockest for a topic
I think i've finished it myself. HotKeySet("{ESC}", "Terminate") Global $startxpos = MouseGetPos(0) Global $startypos = MouseGetPos(1) Global $colorxpos = $startxpos - 54 Global $colorypos = $startypos + 90 Global $pixelcolor1 = PixelGetColor($colorxpos, $colorypos) Global $runtimes Func Terminate() Exit 0 EndFunc $runtimes = InputBox("runtimes", "How many times do you want to do it?", 10) For $i = 1 To $runtimes MouseClick("left") Sleep(3000) While PixelGetColor($colorxpos, $colorypos) <> $pixelcolor1 Sleep(500) WEnd Next Thanks though!1 point -
What about this here? #include <GuiToolbar.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <Constants.au3> #include <WinAPISys.au3> $Debug_TB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work Global $hToolbar, $iMemo, $hEdit, $hToolbarWndProc, $hOldToolbarProc Global $iItem ; Command identifier of the button associated with the notification. Global Enum $idNew = 1000, $idOpen, $idSave, $id_Help _Main() Func _Main() Local $hGUI, $aSize, $iDummy ; Create GUI $hGUI = GUICreate("Toolbar", 600, 400) $iDummy = GUICtrlCreateLabel("", 10, 10, 1, 1) $hToolbar = _GUICtrlToolbar_Create($hGUI) $aSize = _GUICtrlToolbar_GetMaxSize($hToolbar) ; Add standard system bitmaps _GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR) ; Add buttons _GUICtrlToolbar_AddButton($hToolbar, $idNew, $STD_FILENEW) _GUICtrlToolbar_AddButton($hToolbar, $idOpen, $STD_FILEOPEN) _GUICtrlToolbar_AddButton($hToolbar, $idSave, $STD_FILESAVE) _GUICtrlToolbar_AddButtonSep($hToolbar) _GUICtrlToolbar_AddButton($hToolbar, $id_Help, $STD_HELP) ;~ GUICtrlCreateLabel("Teste", 0, 0) $iMemo = GUICtrlCreateEdit("", 2, $aSize[1] + 20, 596, 396 - ($aSize[1] + 20), $WS_VSCROLL) $hEdit = GUICtrlGetHandle($iMemo) ; ----> Note: I want to disable edit control!!! ; <---- GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New") GUISetState() $hToolbarWndProc = DllCallbackRegister("ToolbarWndProc", "long", "hwnd;uint;wparam;lparam") $hOldToolbarProc = _WinAPI_SetWindowLong($hToolbar, $GWL_WNDPROC, DllCallbackGetPtr($hToolbarWndProc)) GUICtrlSetState($iMemo, $GUI_DISABLE) ; Loop until user exits Do Until GUIGetMsg() = $GUI_EVENT_CLOSE _WinAPI_SetWindowLong($hToolbar, $GWL_WNDPROC, $hOldToolbarProc) DllCallbackFree($hToolbarWndProc) GUIDelete() Exit EndFunc ;==>_Main ; Write message to memo Func MemoWrite($sMessage = "") GUICtrlSetData($iMemo, $sMessage & @CRLF, 1) EndFunc ;==>MemoWrite Func ToolbarWndProc($hWnd, $iMsg, $wParam, $lParam) Switch $wParam Case 37, 38, 39, 40 ;left, up, right, down _WinAPI_SetFocus($hEdit) Return 0 EndSwitch Return _WinAPI_CallWindowProc($hOldToolbarProc, $hWnd, $iMsg, $wParam, $lParam) EndFunc ;==>ToolbarWndProc Btw, $idHelp is already defined in one of the UDFs! Is this wanted? Br, UEZ1 point
-
OK, but then your assumption was like you walking into a betting shop and placing a bet on a horse race that one of the horses will win. -_01 point
-
You are using FileOpen as read only (by default). Check out the help file which mode you want to use. Or use _FileWriteToLine #include <File.au3> #include <MsgBoxConstants.au3> $read = FileReadLine("Test.txt",3) $replace = StringRegExpReplace($read,"background","xxxxxxxxxxxxxxx") MsgBox("","",$replace) _FileWriteToLine ("Test.txt", 3, $replace , 1) Br, UEZ1 point
-
UDPSend
AndroidZero reacted to JohnOne for a topic
I'm not 100% certain UDPSend even uses sockets, a code dev would know better. But if it were then I think as indicated in the link you provided, WSAGetLastError() might be the function to use. I believe it resides in Ws2_32.dll.1 point -
UDPSend
AndroidZero reacted to JohnOne for a topic
As I understand it, the whole point of UDP is sending without verification and is not guaranteed to reach destination. TCP is guaranteed. UDPSend will return 0 if nothing is sent though. Use Ping function to test if dest is reachable.1 point -
Multiple People running script [FileWrite]
diandiand163 reacted to surreal for a topic
hello all, and thanks to all for your help in advance. im going to be emailing this script to around 1200 users. it will copy a file to a created location. then save some info to a csv file on a network share. the below script works, im looking for best practice to code this script to not fail or hang when multiple users will write to the file at the same time. #NoTrayIcon Local $sDataFilePath = '\\servername\foldername\MasterFile.csv' Local $sUserFolderPath = '\\servername\foldername\' & @UserName Local $Input1 = $sUserFolderPath & '\Names.nsf' Local $sTitle = 'Comany Name' #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <GUIPassword.au3> $Surreal = GUICreate($sTitle, 545, 230, -1, -1) GUISetBkColor(0xFFFFFF) $WhiteWavePic = GUICtrlCreatePic(@ScriptDir & '\image.jpg', 8, 55, 200, 121) GUICtrlCreateLabel("Network Password:", 225, 130, 120, 17) $InputPassword = _GUICtrlCreatePassword("", 225, 145, 300, 20) $Checkbox = GUICtrlCreateCheckbox("Show password", 225, 170, 100, 17) $Button = GUICtrlCreateButton("Submit", 370, 190, 120, 30) GUICtrlCreateLabel("User Name:", 225, 40, 115, 17) $InputUsername = GUICtrlCreateInput(@UserName, 225, 55, 300, 20) GUICtrlCreateLabel("Email Address:", 225, 85, 115, 17) $InputEmailAddress = GUICtrlCreateInput(@UserName & '@compantname.com', 225, 100, 300, 20) GUICtrlCreateLabel("Transfer your Lotus Notes Contacts into Office 365", 95, 10, 345, 20) GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif") GUICtrlSetColor(-1, 0x0000FF) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE $FormClose = MsgBox(36, $sTitle, "Are you sure you want to exit?") If $FormClose = 6 Then Exit EndIf Case $Button If GUICtrlRead($InputEmailAddress) = '' Or GUICtrlRead($InputPassword) = '' Then MsgBox(16, $sTitle, 'All fields must be entered.') Else _Export() GUIDelete($Surreal) MsgBox(64, $sTitle, "Done.") Exit EndIf Case $Checkbox _GUICtrlPasswordCheckbox($InputPassword, $Checkbox) EndSwitch WEnd Func _Export() DirCreate('\\servername\foldername\' & @UserName) FileCopy('C:\Program Files\Lotus\Notes\Data\names.nsf', '\\servername\foldername\' & @UserName & '\names.nsf', 1) FileWrite($sDataFilePath, $Input1 & "," & GUICtrlRead($InputEmailAddress) & "," & GUICtrlRead($InputPassword) & ",") FileWriteLine($sDataFilePath, "") EndFunc ;==>_Export d@ve1 point -
I found an old snippet in my GDI+ folder: #include <GDIPlus.au3> _GDIPlus_Startup() $iBGColor = 0xFFFFFF $iW = 880 $iH = 150 $hgui = GUICreate("Outlined Text Effect", $iW, $iH) GUISetBkColor($iBGColor, $hgui) GUISetState() $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGUI) $hBitmap = _GDIPlus_BitmapCreateFromGraphics($iW, $iH, $hGraphic) $hBackbuffer = _GDIPlus_ImageGetGraphicsContext($hBitmap) _GDIPlus_GraphicsSetSmoothingMode($hBackbuffer, 2) _GDIPlus_GraphicsSetTextRenderingHint($hBackbuffer, 4) _GDIPlus_GraphicsClear($hBackbuffer, 0xFF000000 + $iBGColor) $hFamily = _GDIPlus_FontFamilyCreate("Verdana") $hFormat = _GDIPlus_StringFormatCreate() $tLayout = _GDIPlus_RectFCreate(0, 0, 0, 0) $hPath = _GDIPlus_PathCreate() _GDIPlus_PathAddString($hPath, "Outlined Text", $tLayout, $hFamily, 0, 90 * 1.333333, $hFormat) $hPen = _GDIPlus_PenCreate(0xF0000000, 8) _GDIPlus_GraphicsDrawPath($hBackbuffer, $hPath, $hPen) $hBrush = _GDIPlus_BrushCreateSolid(0xFFFF0000) _GDIPlus_GraphicsFillPath($hBackbuffer, $hPath, $hBrush) _GDIPlus_GraphicsDrawImageRect($hGraphic, $hBitmap, 0, 0, $iW, $iH) _GDIPlus_PathDispose($hPath) _GDIPlus_PenDispose($hPen) _GDIPlus_BrushDispose($hBrush) _GDIPlus_FontFamilyDispose($hFamily) _GDIPlus_StringFormatDispose($hFormat) _GDIPlus_GraphicsDispose($hBackbuffer) _GDIPlus_BitmapDispose ($hBitmap) _GDIPlus_GraphicsDispose($hGraphic) _GDIPlus_Shutdown() Do Until GUIGetMsg() = -3 GUIDelete() Exit Br, UEZ1 point
-
AutoIt v3.3.12.0 has been released. Thanks to everyone involved - there's been a lot of effort in the help file, UDF library and build scripts by many under-appreciated individuals. Download it here. Complete list of changes: History1 point
-
StringRegExp() Question
diandiand163 reacted to buymeapc for a topic
Hi all, So, I have a few regex's that are trying to pull out versions from file paths, but the file paths are not quite the same. Is there a way I can get just the version out of the paths? Is there a way to do it with one regex? Here's my attempt at it. Thank you! Dim $paths[3] = ["\\10.231.254.23\f$\Installs\_SingleEXE\Interfaces\Billing_v0704A\setup.exe", _ "\\10.231.254.23\f$\Installs\_SingleEXE\Interfaces\Billing_v0705A.exe", _ "\\10.231.254.23\f$\Installs\_SingleEXE\Interfaces\Billing_v0706A_(Workstation).exe"] For $i = 0 To 2 $aMatches = StringRegExp($paths[$i], "(?<=_v)[a-zA-Z\\.\\r\\n0-9]*(?=_(Workstation).exe)", 3) If IsArray($aMatches) Then ConsoleWrite($aMatches[0] & @CRLF) Else $aMatches = StringRegExp($paths[$i], "(?<=_v)[a-zA-Z\\.\\r\\n0-9]*(?=\\setup.exe)", 3) If IsArray($aMatches) Then ConsoleWrite($aMatches[0] & @CRLF) Else $aMatches = StringRegExp($paths[$i], "(?<=_v)[a-zA-Z\\.\\r\\n0-9]*(?=.exe)", 3) If IsArray($aMatches) Then ConsoleWrite($aMatches[0] & @CRLF) EndIf EndIf Next1 point -
Easy, 99.9% of the code is the same. Change the edit to a rich edit, change anything using GUICtrlGetHandle($Edit1) to just use the handle, change the message handler to use WM_RBUTTONUP because richedits don't send WM_CONTEXTMENU messages I seem to remember. Because you change the message you can't use $wParam like you are above, you probably want $hWnd instead. Give this a try: #include <GuiConstantsEx.au3> #include <WindowsConstants.au3> #include <EditConstants.au3> #include <GuiMenu.au3> #include <Constants.au3> #include <WinAPI.au3> #include <GUIRichEdit.au3> Global Enum $idOpen = 1000, $idSave, $idInfo $hGUI = GUICreate("Test", 300, 200) $Edit1 = _GUICtrlRichEdit_Create($hGUI, "", 10, 10, 280, 150, BitOR($WS_HSCROLL, $WS_VSCROLL, $ES_MULTILINE)) $hMenu = _GUICtrlMenu_CreatePopup() _GUICtrlMenu_AddMenuItem($hMenu, "Open", $idOpen) _GUICtrlMenu_AddMenuItem($hMenu, "Save", $idSave) _GUICtrlMenu_AddMenuItem($hMenu, "Info", $idInfo) GUISetState() $wProcHandle = DllCallbackRegister("_WindowProc", "ptr", "hwnd;uint;wparam;lparam") $wProcOld = _WinAPI_SetWindowLong($Edit1, $GWL_WNDPROC, DllCallbackGetPtr($wProcHandle)) While 1 $Msg = GUIGetMsg() Switch $Msg Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd GUIDelete($hGUI) DllCallbackFree($wProcHandle) Func _WindowProc($hWnd, $Msg, $wParam, $lParam) Switch $hWnd Case $Edit1 Switch $Msg Case $WM_RBUTTONUP _GUICtrlMenu_TrackPopupMenu($hMenu, $hWnd) Return 0 Case $WM_COMMAND Switch $wParam Case $idOpen ConsoleWrite("-> Open" & @LF) Case $idSave ConsoleWrite("-> Save" & @LF) Case $idInfo ConsoleWrite("-> Info" & @LF) EndSwitch EndSwitch EndSwitch Local $aRet = DllCall("user32.dll", "int", "CallWindowProc", "ptr", $wProcOld, _ "hwnd", $hWnd, "uint", $Msg, "wparam", $wParam, "lparam", $lParam) Return $aRet[0] EndFunc ;==>_WindowProc1 point
-
$objWMIService = ObjGet("winmgmts:\\.\root\cimv2") If Not IsObj($objWMIService) Then MsgBox(0,"Error","$objWMIService Not Object") Exit EndIf $sQuery = "Select * from Win32_NetworkAdapter" $colItems = $objWMIService.ExecQuery ($sQuery) If Not IsObj($colItems) Then MsgBox(0,"Error","$objWMIService Not Object") Exit EndIf ;MsgBox(0,0,VarGetType($colItems)) $sResult = "" $count = 0 For $objItem In $colItems $count += 1 ;$sResult &= "Index: " & $objItem.WINSScopeID & @CRLF ;$sResult &= "Caption: " & $objItem.Caption & @CRLF ;ConsoleWrite("> " & $sResult) $sResult &= "Name: " & $objItem.Name & @CRLF $sResult &= "Description: " & $objItem.Description & @CRLF ;ConsoleWrite("> " & $sResult) $sResult &= "MACAddress: " & $objItem.MACAddress & @CRLF ;ConsoleWrite("> " & $sResult) $sResult &= "NetConnectionStatus: " & $objItem.NetConnectionStatus & @CRLF ;ConsoleWrite("> " & $sResult) $sResult &= "GUID: " & $objItem.GUID & @CRLF ;For $strIPAddress In $objItem.IPAddress ; $sResult &= "IPAddress: " & $strIPAddress & @CRLF ;Next $sResult &= @CRLF Next ConsoleWrite("There are " & $count & " devices available" & @LF & @LF) ConsoleWrite($sResult & @LF)1 point