Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 04/20/2013 in all areas

  1. Here we go Function Blocks the Double-ClickIf Double-Click is detected while Control is pressed the block is cancelled-Try double-clicking the Titlebar of any window to see if it maximizes or not #include <WinAPI.au3> #include <WindowsConstants.au3> #include <Misc.au3> HotKeySet("{ESC}", "Terminate") OnAutoItExitRegister("Cleanup") Global $hModule = _WinAPI_GetModuleHandle(0) Global $hMouseProc = DllCallbackRegister("LowLevelMouseProc", "long", "int;wparam;lparam") Global $pMouseProc = DllCallbackGetPtr($hMouseProc) Global $hMouseHook = _WinAPI_SetWindowsHookEx($WH_MOUSE_LL, $pMouseProc, $hModule) Global $iCheck = $WM_LBUTTONDOWN While 1 Sleep(10) WEnd ; http://msdn.microsoft.com/en-us/library/ms644986(v=vs.85).aspx Func LowLevelMouseProc($nCode, $wParam, $lParam) Static $iTimer = -1 ;Make the Var Static If $nCode >= 0 And ($wParam = $iCheck) Then $aRet = DllCall("user32.dll", "uint", "GetDoubleClickTime") $aRet = $aRet[0] ;Double Click and Control not pressed - Block it If TimerDiff($iTimer) <= $aRet And _IsPressed("11") = 0 Then Return 1 $iTimer = TimerInit() EndIf Return _WinAPI_CallNextHookEx($hMouseHook, $nCode, $wParam, $lParam) EndFunc ;==>LowLevelMouseProc Func Cleanup() _WinAPI_UnhookWindowsHookEx($hMouseHook) DllCallbackFree($hMouseProc) EndFunc ;==>Cleanup Func Terminate() Exit EndFunc ;==>TerminateRegards
    2 points
  2. water

    file transfer exemple

    Wouldn't it be easier to do 3 TCP sends? 1) Filename 2) Filesize 3) file content Your Do/Until loop doesn't make sense because you write the same data ($comanda[4]) again and again.
    1 point
  3. I've removed a lot of useless lines, but the main trick is to streamline the progression from A and up (or from any starting letter as long as the last project doesn't exceed Z). The less cryptic way to do that is to chop down the project name first, isolate the letter then run the loop incrementing the letter and concatenating the project's name parts again. I'm a bit lazy so I regularly use this kind of compound instruction as if regular expressions callback feature was available. EDIT: maybe you'd like a breakdown explanation of the regexp and execute part? (?<=-d{2}) is a lookbehind assertion requiring that what comes next is precedeed by a dash and 2 digits ([A-Z]) is the capturing pattern to match the letter we're interessed in (?=-Q) is a lookahead assertion requiring that after the pattern we find another dash and the letter Q The replacement part concatenates the AutoIt instruction to convert the captured letter (as $1) into its ASCII value, increment that by the loop variable $i and convert back the result into an ASCII letter. To execute all that stuff, we need to enclose everything inside parenthesis. This is the though part: distinct pair of quotes ' and " help avoid confusion but I confess it's often hard to code this right the first time... Before the Execute line, run the code with this line inserted: ConsoleWrite("'" & StringRegExpReplace($ProjectNameRead, "(?<=-\d{2})([A-Z])(?=-Q)", "' & Chr(Asc('$1') + $I) & '") & "'" & @LF) You'll then see how the various parts fit together.
    1 point
  4. jchd

    Error Initializing 5D Array

    I just checked and AutoIt will work correctly with 10D arrays and more, unless Au3Check is invoked and the explicitely initialized. So this is a an Au3Check bug. In fact that post drew my attention on a point that escaped me until today, and probably devs themselves. The doc says the maximum dimension of an array is 64 but in fact the actual maximum "non nonsense" dimension is much less: Local $arTestBad[2][2][2][2][2][2][2][2][2][2][2][2][2][2][2][2][2][2][2][2][2][2][2][2] is a valid 23D array declaration but adding one more dimension result in hitting another limit: the maximum size of an array: "C:UsersjcDocumentsAutoMATTestNestedFor.au3" (7) : ==> Array maximum size exceeded.: Local $arTestBad[2][2][2][2][2][2][2][2][2][2][2][2][2][2][2][2][2][2][2][2][2][2][2][2][2] Local $arTestBad[2][2][2][2][2][2][2][2][2][2][2][2][2][2][2][2][2][2][2][2][2][2][2][2][^ ERROR Hence the maximum practical dimension of an array is 24, well, unless you use dummy dimensions like [1][1]... which don't bring you anything useful. I'm openning two distinct trac tickets on these points. As a [mathematically inclined] sidenote, a 24D object is enough to represent the Leech lattice, which makes this singular object appear once more in an area where it was not expected. EDIT: I checked that 64 dimensions are actually the hard limit, albeit useless: Local $arTestGood[1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1] works but is likely to use L.I.S.P. (Lots of Insipide Square Parenthesis) uselessly!
    1 point
  5. Melba23

    DirectDraw Overlay

    UranWild, Be reasonable - if no-one has answered in 5 years do you think they will do so now? Do not resurrect long-dead threads like this again - just start a new one if you want to ask a question. M23
    1 point
  6. Do you go and see the doctor having made the diagnosis yourself and don't answer the doctors questions? We want to help you, but we need more information. If you can't provide this information ... your problem.
    1 point
  7. CreatoX, Would sir like fries with that? You can thank rover for this - all I have done is play around with his code to get a "simple" function to do what you want: #include <WindowsConstants.au3> #include <GUIToolbar.au3> #include <WinAPI.au3> #Include <GuiMenu.au3> Opt("WinTitleMatchMode", 2) Global $hSysTray_Handle, $iSystray_ButtonNumber Global $sToolTipTitle = "" ; Add the text of your tray icon here <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< $iSystray_ButtonNumber = Get_Systray_Index($sToolTipTitle) If $iSystray_ButtonNumber = 0 Then MsgBox(16, "Error", "Is the App running?") Exit Else Sleep(250) _GUICtrlToolbar_ClickButton($hSysTray_Handle, $iSystray_ButtonNumber, "right") Sleep(250) Send("{UP}") ; Move your cursor around on the menu here <<<<<<<<<<<<<<<<<<<<<<<<<<< ConsoleWrite(GetPopUpSelText() & @CRLF) ; This will read the currently selected item <<<<<<<<<<<<<<<<<<<<<<<<<<<< EndIf Func Get_Systray_Index($sToolTipTitle) ; Find systray handle $hSysTray_Handle = ControlGetHandle('[Class:Shell_TrayWnd]', '', '[Class:ToolbarWindow32;Instance:1]') If @error Then MsgBox(16, "Error", "System tray not found") Exit EndIf ; Get systray item count Local $iSystray_ButCount = _GUICtrlToolbar_ButtonCount($hSysTray_Handle) If $iSystray_ButCount = 0 Then MsgBox(16, "Error", "No items found in system tray") Exit EndIf ; Look for wanted tooltip For $iSystray_ButtonNumber = 0 To $iSystray_ButCount - 1 If StringInStr(_GUICtrlToolbar_GetButtonText($hSysTray_Handle, $iSystray_ButtonNumber), $sToolTipTitle) <> 0 Then ExitLoop Next If $iSystray_ButtonNumber = $iSystray_ButCount Then Return 0 ; Not found Else Return $iSystray_ButtonNumber ; Found EndIf EndFunc Func GetPopUpSelText() Local $aPopUp_List = _WinAPI_EnumWindowsPopup() Local $hWnd = $aPopUp_List[1][0] Local $sClass = $aPopUp_List[1][1] If $sClass = "#32768" Then ; This is a "standard" Windows API popup menu $hMenu = _SendMessage($hWnd, $MN_GETHMENU, 0, 0) If _GUICtrlMenu_IsMenu($hMenu) Then $iCount = _GUICtrlMenu_GetItemCount($hMenu) For $j = 0 To $iCount - 1 If _GUICtrlMenu_GetItemHighlighted($hMenu, $j) Then Return _GUICtrlMenu_GetItemText($hMenu, $j) EndIf Next EndIf EndIf Return "" EndFuncThis code only works on "standard" Windows API popup menus - one of the apps in my tray does not respond to this code as it uses owner-drawn elements which cannot be read. I hope your app is one of the well-behaved ones. M23
    1 point
×
×
  • Create New...