Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 05/08/2017 in all areas

  1. So to return the second column value you would use $aRetArray[$row][1]
    1 point
  2. The case 2 could be done like this StringRegExpReplace($str, '\$%\$\?\$%.+?(?=n\d|\$)', "") For case 1 this is possible StringRegExpReplace($str, '(?<=:)(?=\$T\$=B)', @CRLF) But it becomes a little difficult for me as I don't know exactly which "$x" things you want to keep and which ones you want to remove Maybe all this could be done simpler depending on what should be the final result after complete treatment of the initial file
    1 point
  3. Subz

    Any way to shorten this?

    As Xandy mentioned you could use 2D Array for example: #include <Array.au3> ;~ Only required for _ArrayDisplay Global $aDrag[3][3] = [[1114, 220, "0xFFFFFF"], [1176, 275, "0xFFFFFF"], [566, 194, "0xFFFFFF"]] For $i = 0 To UBound($aDrag) - 1 MsgBox(48, "Array Info", "Drag" & $i & " : " & $aDrag[$i][0] + 1 & " - " & $aDrag[$i][1] + 1) Next _ArrayDisplay($aDrag)
    1 point
  4. ^^ "Optional" doesn't mean optional in such way. What it really means is that (C/C++) compiler will generate the argument for programmer if omitted - as per definition. Obviously, AutoIt is not C compiler, therefore "optional" means nothing here. It should be: DllCall("C:\temp\test.dll", "int", "test_sender_send_values", _     "str", "192.168.1.2", _     "ushort", 80, _     "str", "192.168.1.3", _     "ptr", DllStructGetPtr($struct), _     "int", 1, _ "ptr*", 0) If that fails for some reason, then calling convention should be changed to cdecl ("int:cdecl"), because it's not obvious from the OP what TEST_API is.
    1 point
  5. OK, I think I made some progress here. Please run this and tell me if it returns anything useful. #include <Array.au3> Global $aDrives = DriveGetDrive("ALL") Global $hWnd = GUICreate("USB-Handler") Global Const $WM_DEVICECHANGE = 0x0219 GUIRegisterMsg($WM_DEVICECHANGE, "MY_WM_DEVICECHANGE") ;ToDo -> RegisterDeviceNotification Global Const $DEVICE_NOTIFY_WINDOW_HANDLE = 0x00000000 Global Const $DEVICE_NOTIFY_SERVICE_HANDLE = 0x00000001 Global Const $DEVICE_NOTIFY_ALL_INTERFACE_CLASSES = 0x00000004 Global Const $DBT_DEVTYP_DEVICEINTERFACE = 0x00000005 Global Const $Flags = BitOR($DEVICE_NOTIFY_ALL_INTERFACE_CLASSES, $DEVICE_NOTIFY_WINDOW_HANDLE) Global $DEV_BROADCAST_DEVICEINTERFACE = DllStructCreate("dword dbcc_size; dword dbcc_devicetype; dword dbcc_reserved; char dbcc_classguid[128]; char dbcc_name[1]") ;~ ConsoleWrite("$DEV_BROADCAST_DEVICEINTERFACE @ERROR: " & @error & @CR) DllStructSetData($DEV_BROADCAST_DEVICEINTERFACE, "dbcc_size", DllStructGetSize($DEV_BROADCAST_DEVICEINTERFACE)) DllStructSetData($DEV_BROADCAST_DEVICEINTERFACE, "dbcc_devicetype", $DBT_DEVTYP_DEVICEINTERFACE) Global $PtrDEV_BROADCAST_DEVICEINTERFACE = DllStructGetPtr($DEV_BROADCAST_DEVICEINTERFACE) Global $hDevNotify = DllCall("user32.dll", "handle", "RegisterDeviceNotification", "handle", $hWnd, "ptr", $PtrDEV_BROADCAST_DEVICEINTERFACE, "dword", $Flags) ConsoleWrite("USB-Handler hwnd: " & $hWnd & @CR) ConsoleWrite("$PtrDEV_BROADCAST_DEVICEINTERFACE: " & $PtrDEV_BROADCAST_DEVICEINTERFACE & @CR) ConsoleWrite("$Flags: " & $Flags & @CR) ConsoleWrite("$hDevNotify: " & $hDevNotify[0] & @CR) _ArrayDisplay($hDevNotify) While 1 Sleep(100) WEnd Func MY_WM_DEVICECHANGE($hWnd, $Msg, $wParam, $lParam) ;ToDo ... ConsoleWrite("Something" & @CR) EndFunc ;==>MY_WM_DEVICECHANGE Oh and when you run the script, insert or disconnect a usb device.
    1 point
  6. lemony It`s no heavy #include <GuiConstantsEx.au3> #include <WindowsConstants.au3> #include <GuiListView.au3> $hGUI = GUICreate("Test GUI", 300, 200) $hListView = GUICtrlCreateListView("Items|SubItems", 10, 10, 280, 180, $LVS_REPORT, $WS_EX_CLIENTEDGE) For $i = 1 To 10 _GUICtrlListView_AddItem($hListView, "Item " & $i) _GUICtrlListView_AddSubItem($hListView, $i - 1, "SubItem " & $i, 1) Next GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY") GUISetState() Do Until GUIGetMsg() = $GUI_EVENT_CLOSE Func WM_NOTIFY($hWnd, $Msg, $wParam, $lParam) Local $tNMHDR, $IdFrom, $iCode $tNMHDR = DllStructCreate($tagNMHDR, $lParam) $IdFrom = DllStructGetData($tNMHDR, "IdFrom") $iCode = DllStructGetData($tNMHDR, "Code") Switch $IdFrom Case $hListView Switch $iCode Case $LVN_ITEMCHANGING Return 1 EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_NOTIFY
    1 point
×
×
  • Create New...