rasim Posted March 11, 2008 Share Posted March 11, 2008 How can i prevent a script from paused state when i call context menu? expandcollapse popup#include <GuiConstants.au3> #include <GuiListView.au3> #include <GuiMenu.au3> Global Enum $idMenuOpen, $idMenuSave Dim $pos = 10 $hGui = GUICreate("Test", 300, 200) $label = GUICtrlCreateLabel("label", 10, 180, 25, 15) ;GUICtrlSetBkColor(-1, 0xFF0000) $hListView = _GUICtrlListView_Create($hGui, "Items|SubItems", 10, 10, 280, 160, -1, $WS_EX_CLIENTEDGE) _GUICtrlListView_SetExtendedListViewStyle($hListView, BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_GRIDLINES)) GUIRegisterMsg($WM_CONTEXTMENU, "WM_CONTEXTMENU") GUISetState() Do If $pos >= 300 Then $pos = 0 $pos += 1 GUICtrlSetPos($label, $pos, 180) Sleep(10) Until GUIGetMsg() = -3 Func WM_CONTEXTMENU($hWnd, $Msg, $wParam, $lParam) Local $hMenu $hMenu = _GUICtrlMenu_CreatePopup() _GUICtrlMenu_InsertMenuItem($hMenu, 0, "Open", $idMenuOpen) _GUICtrlMenu_InsertMenuItem($hMenu, 1, "Save", $idMenuOpen) _GUICtrlMenu_TrackPopupMenu($hMenu, $wParam) _GUICtrlMenu_DestroyMenu($hMenu) Return $GUI_RUNDEFMSG EndFunc Link to comment Share on other sites More sharing options...
rudi Posted March 11, 2008 Share Posted March 11, 2008 How can i prevent a script from paused state when i call context menu?Maybe you are looking for this one?AutoitSetState("TrayAutoPause",0)Regards, Rudi. Earth is flat, pigs can fly, and Nuclear Power is SAFE! Link to comment Share on other sites More sharing options...
rasim Posted March 12, 2008 Author Share Posted March 12, 2008 Maybe you are looking for this one?AutoitSetState("TrayAutoPause",0)Regards, Rudi.LOL! If you don`t have a really idea or solution don`t post your comment! Link to comment Share on other sites More sharing options...
rudi Posted March 12, 2008 Share Posted March 12, 2008 LOL! If you don`t have a really idea or solution don`t post your comment! So I miss what you are asking for, obviously Regards, Rudi. Earth is flat, pigs can fly, and Nuclear Power is SAFE! Link to comment Share on other sites More sharing options...
DW1 Posted March 12, 2008 Share Posted March 12, 2008 I figured you were looking for "Opt("TrayAutoPause",0)" also. So don't be rude when it is your fault for phrasing the question wrong, or not being detailed enough. AutoIt3 Online Help Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted March 12, 2008 Moderators Share Posted March 12, 2008 There's no MultiThreading so make use of AdlibEnable or run 2 scripts. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
The Kandie Man Posted March 12, 2008 Share Posted March 12, 2008 There's no MultiThreading so make use of AdlibEnable or run 2 scripts.Already tried AdlibEnable. That still utilizes the main AutoIt thread. The _GUICtrlMenu_TrackPopupMenu() makes a call to a function in the OS shell that suspends the thread that is doing the call until a value can be returned. As a result, the main AutoIt thread is halted until this function returns, similar to the way the Msgbox() function halts AutoIt.You could write a work-around in another language that supports multithreading and call the work-around function from a compiled dll, but that would be quite complicated. In this case, using two scripts would probably be the way to go.- The Kandie Man ;-) "So man has sown the wind and reaped the world. Perhaps in the next few hours there will no remembrance of the past and no hope for the future that might have been." & _"All the works of man will be consumed in the great fire after which he was created." & _"And if there is a future for man, insensitive as he is, proud and defiant in his pursuit of power, let him resolve to live it lovingly, for he knows well how to do so." & _"Then he may say once more, 'Truly the light is sweet, and what a pleasant thing it is for the eyes to see the sun.'" - The Day the Earth Caught Fire Link to comment Share on other sites More sharing options...
rasim Posted March 13, 2008 Author Share Posted March 13, 2008 So don't be rude when it is your fault for phrasing the question wrong, or not being detailed enough.Sorry guys. Already tried AdlibEnableNo. Still paused. Has done so: expandcollapse popup#include <GuiConstants.au3> #include <GuiListView.au3> #include <GuiMenu.au3> Global Enum $idMenuOpen, $idMenuSave Global $EventId = 1, $Elapse = 80 Dim $pos = 10 $hGui = GUICreate("Test", 300, 200) $label = GUICtrlCreateLabel("label", 10, 180, 25, 15) ;GUICtrlSetBkColor(-1, 0xFF0000) $hListView = _GUICtrlListView_Create($hGui, "Items|SubItems", 10, 10, 280, 160, -1, $WS_EX_CLIENTEDGE) _GUICtrlListView_SetExtendedListViewStyle($hListView, BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_GRIDLINES)) GUIRegisterMsg($WM_CONTEXTMENU, "WM_CONTEXTMENU") GUIRegisterMsg($WM_TIMER, "WM_TIMER") DllCall("User32.dll", "int", "SetTimer", "hwnd", $hGui, "int", $EventId, "int", $Elapse, "int", 0) GUISetState() Do Until GUIGetMsg() = -3 DllCall("user32.dll", "int", "KillTimer", "hwnd", $hGui, "int", $EventId) Func WM_CONTEXTMENU($hWnd, $Msg, $wParam, $lParam) Local $hMenu $hMenu = _GUICtrlMenu_CreatePopup() _GUICtrlMenu_InsertMenuItem($hMenu, 0, "Open", $idMenuOpen) _GUICtrlMenu_InsertMenuItem($hMenu, 1, "Save", $idMenuOpen) _GUICtrlMenu_TrackPopupMenu($hMenu, $wParam) _GUICtrlMenu_DestroyMenu($hMenu) Return $GUI_RUNDEFMSG EndFunc Func WM_TIMER($hWnd, $Msg, $wParam, $lParam) If $pos >= 300 Then $pos = 0 $pos += 2 GUICtrlSetPos($label, $pos, 180) EndFunc Link to comment Share on other sites More sharing options...
The Kandie Man Posted March 15, 2008 Share Posted March 15, 2008 This is one way to do it:expandcollapse popup#include <GuiConstants.au3> #include <GuiListView.au3> #include <GuiMenu.au3> Global Const $WS_EX_CLIENTEDGE = 0x00000200 Global Const $WM_CONTEXTMENU = 0x007B Global Enum $idMenuOpen, $idMenuSave Global $sDllTmp = @TempDir & "\MoveControl.dll" FileInstall("MoveControl.dll",$sDllTmp,1) Global $hdll_MoveControl = DllOpen($sDllTmp) IF @error Then ConsoleWrite("!> Error. Unable to open MoveControl.dll. @error="&@error&@LF) Exit 1 EndIf $hGui = GUICreate("Test", 300, 200) $label = GUICtrlCreateLabel("label", 10, 180, 25, 15) ;GUICtrlSetBkColor(-1, 0xFF0000) $hListView = _GUICtrlListView_Create($hGui, "Items|SubItems", 10, 10, 280, 160, -1, $WS_EX_CLIENTEDGE) _GUICtrlListView_SetExtendedListViewStyle($hListView, BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_GRIDLINES)) GUIRegisterMsg($WM_CONTEXTMENU, "WM_CONTEXTMENU") GUISetState() DllCall($hdll_MoveControl,"int:cdecl","ScrollText","hwnd",GUICtrlGetHandle($label)) Do Sleep(10) Until GUIGetMsg() = -3 Func WM_CONTEXTMENU($hWnd, $Msg, $wParam, $lParam) Local $hMenu $hMenu = _GUICtrlMenu_CreatePopup() _GUICtrlMenu_InsertMenuItem($hMenu, 0, "Open", $idMenuOpen) _GUICtrlMenu_InsertMenuItem($hMenu, 1, "Save", $idMenuOpen) _GUICtrlMenu_TrackPopupMenu($hMenu, WinGetHandle($hGui)) _GUICtrlMenu_DestroyMenu($hMenu) Return $GUI_RUNDEFMSG EndFunc Func OnAutoItExit() Local $iRet If Not @exitCode Then ConsoleWrite("-> Stopping Scrolling Thread"&@LF) $iRet = DllCall($hdll_MoveControl,"int:cdecl","StopThread") If Ubound($iRet) = 1 Then ConsoleWrite("+> StopThread()="&$iRet[0]&@LF) ConsoleWrite("+> Thread Stopped Successfully"&@LF) Else ConsoleWrite("!> StopThread() Dll Call Errored"&@LF) EndIf DllClose($hdll_MoveControl) EndIf GUIDelete($hGui) FileDelete($sDllTmp) EndFunc The required Dll: MoveControl.dll - The Kandie Man ;-) "So man has sown the wind and reaped the world. Perhaps in the next few hours there will no remembrance of the past and no hope for the future that might have been." & _"All the works of man will be consumed in the great fire after which he was created." & _"And if there is a future for man, insensitive as he is, proud and defiant in his pursuit of power, let him resolve to live it lovingly, for he knows well how to do so." & _"Then he may say once more, 'Truly the light is sweet, and what a pleasant thing it is for the eyes to see the sun.'" - The Day the Earth Caught Fire Link to comment Share on other sites More sharing options...
martin Posted March 15, 2008 Share Posted March 15, 2008 Sorry guys. No. Still paused. Has done so: expandcollapse popup#include <GuiConstants.au3> #include <GuiListView.au3> #include <GuiMenu.au3> Global Enum $idMenuOpen, $idMenuSave Global $EventId = 1, $Elapse = 80 Dim $pos = 10 $hGui = GUICreate("Test", 300, 200) $label = GUICtrlCreateLabel("label", 10, 180, 25, 15) ;GUICtrlSetBkColor(-1, 0xFF0000) $hListView = _GUICtrlListView_Create($hGui, "Items|SubItems", 10, 10, 280, 160, -1, $WS_EX_CLIENTEDGE) _GUICtrlListView_SetExtendedListViewStyle($hListView, BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_GRIDLINES)) GUIRegisterMsg($WM_CONTEXTMENU, "WM_CONTEXTMENU") GUIRegisterMsg($WM_TIMER, "WM_TIMER") DllCall("User32.dll", "int", "SetTimer", "hwnd", $hGui, "int", $EventId, "int", $Elapse, "int", 0) GUISetState() Do Until GUIGetMsg() = -3 DllCall("user32.dll", "int", "KillTimer", "hwnd", $hGui, "int", $EventId) Func WM_CONTEXTMENU($hWnd, $Msg, $wParam, $lParam) Local $hMenu $hMenu = _GUICtrlMenu_CreatePopup() _GUICtrlMenu_InsertMenuItem($hMenu, 0, "Open", $idMenuOpen) _GUICtrlMenu_InsertMenuItem($hMenu, 1, "Save", $idMenuOpen) _GUICtrlMenu_TrackPopupMenu($hMenu, $wParam) _GUICtrlMenu_DestroyMenu($hMenu) Return $GUI_RUNDEFMSG EndFunc Func WM_TIMER($hWnd, $Msg, $wParam, $lParam) If $pos >= 300 Then $pos = 0 $pos += 2 GUICtrlSetPos($label, $pos, 180) EndFuncWorks fine but why create and destroy the menu every time? expandcollapse popup#include <GuiConstants.au3> #include <GuiListView.au3> #include <GuiMenu.au3> Global Enum $idMenuOpen, $idMenuSave Global $EventId = 1, $Elapse = 80 Dim $pos = 10 $hGui = GUICreate("Test", 300, 200) $label = GUICtrlCreateLabel("label", 10, 180, 25, 15) ;GUICtrlSetBkColor(-1, 0xFF0000) $hListView = _GUICtrlListView_Create($hGui, "Items|SubItems", 10, 10, 280, 160, -1, $WS_EX_CLIENTEDGE) _GUICtrlListView_SetExtendedListViewStyle($hListView, BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_GRIDLINES)) GUIRegisterMsg($WM_CONTEXTMENU, "WM_CONTEXTMENU") GUIRegisterMsg($WM_TIMER, "WM_TIMER") DllCall("User32.dll", "int", "SetTimer", "hwnd", $hGui, "int", $EventId, "int", $Elapse, "int", 0) $hMenu = _GUICtrlMenu_CreatePopup() _GUICtrlMenu_InsertMenuItem($hMenu, 0, "Open", $idMenuOpen) _GUICtrlMenu_InsertMenuItem($hMenu, 1, "Save", $idMenuOpen) GUISetState() Do Until GUIGetMsg() = -3 _GUICtrlMenu_DestroyMenu($hMenu) DllCall("user32.dll", "int", "KillTimer", "hwnd", $hGui, "int", $EventId) Func WM_CONTEXTMENU($hWnd, $Msg, $wParam, $lParam) _GUICtrlMenu_TrackPopupMenu($hMenu, $wParam) Return $GUI_RUNDEFMSG EndFunc Func WM_TIMER($hWnd, $Msg, $wParam, $lParam) If $pos >= 300 Then $pos = 0 $pos += 2 GUICtrlSetPos($label, $pos, 180) EndFunc Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
rasim Posted March 15, 2008 Author Share Posted March 15, 2008 The Kandie ManNice example! I like this fluent label move This example be need to me in future time. Thank you!martinwhy create and destroy the menu every time?Ha ha. Yes! You are right. Thanks! Link to comment Share on other sites More sharing options...
Linux Posted April 9, 2008 Share Posted April 9, 2008 Well, I was testing this example, and i think i found a bug. If you doble click the sistray icon, the script will pause. thats not what we want. right? You can help! Donate to AutoIt! or, visit ClimatePREDICTION.netMy posts:Travian Bot Example (100+ servers) BETAHow to Host you code/app for free! (unlimited team number) (Public or Private)"Sir, we're surrounded!" "Excellent. We can attack in any direction!" Link to comment Share on other sites More sharing options...
rasim Posted April 9, 2008 Author Share Posted April 9, 2008 Well, I was testing this example, and i think i found a bug.If you doble click the sistray icon, the script will pause. thats not what we want. right?Just add a Opt("TrayAutoPause", 0) in a script begin. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now