Dieuz Posted June 30, 2007 Posted June 30, 2007 Hi, Im trying to make an event happen whenever the user click on the screen except on the gui windows. How can I do that ? I mean if the user click on the gui window, nothing should happen but if he click anywhere else on the screen, an event will happen Thx
kp3 Posted June 30, 2007 Posted June 30, 2007 How do u mean? What ui windows? Do u mean everything except the window for ur script or like the desktop? [s]My scripts =)Password protect process (with tray menu lol)Clickous meousDisable ctrl+alt+del and password protect folder...Andous herous lolKp3s security center v.1Click me[/s]Ok... You shouldnt use annyone of them cuz they use alot of memory and contain alot of errors and stuff.. I was a n00b :P Ignore it... And if u for some reason want to use them... Watch out for my realy bad spelling :I
Dieuz Posted June 30, 2007 Author Posted June 30, 2007 (edited) I mean How can I detect a click somewhere on the screen then analyse it and if the click was done on the gui window do nothing but if the click was made on the screen then do something. For Gui only, there's Guigetcursorinfo but is there something similar for all the screen? Edited June 30, 2007 by Dieuz
kp3 Posted June 30, 2007 Posted June 30, 2007 (edited) Working on it rightnow:P BRB... 10 min max :/ Oh shit That was hard Im trying to figure out how im gonna do the math Edited June 30, 2007 by kp3 [s]My scripts =)Password protect process (with tray menu lol)Clickous meousDisable ctrl+alt+del and password protect folder...Andous herous lolKp3s security center v.1Click me[/s]Ok... You shouldnt use annyone of them cuz they use alot of memory and contain alot of errors and stuff.. I was a n00b :P Ignore it... And if u for some reason want to use them... Watch out for my realy bad spelling :I
Dieuz Posted June 30, 2007 Author Posted June 30, 2007 Working on it rightnow:P BRB... 10 min max :/Oh shit That was hard Im trying to figure out how im gonna do the math So ?
kp3 Posted June 30, 2007 Posted June 30, 2007 (edited) Hey No problem. U dont got to thank me I think i got it know. Edited June 30, 2007 by kp3 [s]My scripts =)Password protect process (with tray menu lol)Clickous meousDisable ctrl+alt+del and password protect folder...Andous herous lolKp3s security center v.1Click me[/s]Ok... You shouldnt use annyone of them cuz they use alot of memory and contain alot of errors and stuff.. I was a n00b :P Ignore it... And if u for some reason want to use them... Watch out for my realy bad spelling :I
Dieuz Posted June 30, 2007 Author Posted June 30, 2007 (edited) Someone know how to achieve what Im trying to do? In shot, I want to detect a mouse click and the analyze it. Edited June 30, 2007 by Dieuz
kp3 Posted June 30, 2007 Posted June 30, 2007 (edited) ***Uber Epic pwn edit Ok... Im done now Here is ur script... If u press space outside the gui (i know u wanted mouse click... But u can easily just put if _ispressed in the loop if u want that instead)...two msgboxes appears. #Region;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_outfile=..\..\..\..\Documents and Settings\Robert Nilsson\Mina dokument\ledamp #EndRegion;**** Directives created by AutoIt3Wrapper_GUI **** #include <GUIConstants.au3> #Include <Misc.au3> hotkeyset("{space}","one") Opt("GUIOnEventMode", 1) $Form1 = GUICreate("Test", 633, 449, 193, 115) $Label1 = GUICtrlCreateLabel("OMG! IT IS A GUI!!!!!!!!!!!!!!! WONDER WHAT HAPPENS IF I CLICK IT!!!!", 8, 32, 601, 28) GUICtrlSetFont(-1, 16, 400, 0, "MS Sans Serif") $Label2 = GUICtrlCreateLabel("nothing!", 56, 72, 44, 17) GUISetState(@SW_SHOW) ;values that i dunno why they got to be here; ;end of those crappy values While 1 Sleep(100) WEnd ;press space func one() if winactive("Test") then ;change winactive to whatever u want...If u want it even if the iwndow is hidden just remove it. $Pos = wingetpos("Test"); Get width, position, height and all that stuff of the windo $loc = mousegetpos(); get mouse position if $loc[1] <= $pos[1] or $loc[1] >= $pos[3]+$pos[1] or $loc[0] <= $pos[0] or $loc[0] >= $pos[2]+$pos[0] then;To make if thing so it continnues if u press inside the gui u should just invert the >:s msgbox("","YAY!","u pressed outside the gui") msgbox("","info","u pressed on x:"&$loc[0]&" y:"&$loc[1]) endif endif endfunc Now my sould can have its rest Im tired now Realy tired. Goodnight Edited June 30, 2007 by kp3 [s]My scripts =)Password protect process (with tray menu lol)Clickous meousDisable ctrl+alt+del and password protect folder...Andous herous lolKp3s security center v.1Click me[/s]Ok... You shouldnt use annyone of them cuz they use alot of memory and contain alot of errors and stuff.. I was a n00b :P Ignore it... And if u for some reason want to use them... Watch out for my realy bad spelling :I
martin Posted June 30, 2007 Posted June 30, 2007 (edited) This is kp3's post translated to something which makes more sense to me. #include <GUIConstants.au3> #include <misc.au3> GUICreate("small gui",200,200,200,200) GUISetState() Dim $lastxy[2] = [0,0] While 1 $msg = GUIGetMsg(1) If $msg[0] = $gui_event_close Then ExitLoop If _IsPressed ( 1) Then $mp = MouseGetPos() $formpos = WinGetPos("small gui") If outside($mp,$formpos) Then If $lastxy[0] <> $mp[0] Or $lastxy[1] <> $mp[1] Then ConsoleWrite('out of form mouse click' & @CRLF) $lastxy[0] = $mp[0] $lastxy[1] = $mp[1] EndIf EndIf EndIf WEnd Func outside($a,$B) If $a[0] < $b[0] Or $a[1] < $b[1] Then Return True; If $a[0] > $b[0] + $b[2] Then Return True If $a[1] > $b[1] + $b[3] Then Return True Return False EndFunc Edited June 30, 2007 by martin 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.
kp3 Posted July 1, 2007 Posted July 1, 2007 The porblem with yours is that its not reversable(i think :S) Am i wrong? [s]My scripts =)Password protect process (with tray menu lol)Clickous meousDisable ctrl+alt+del and password protect folder...Andous herous lolKp3s security center v.1Click me[/s]Ok... You shouldnt use annyone of them cuz they use alot of memory and contain alot of errors and stuff.. I was a n00b :P Ignore it... And if u for some reason want to use them... Watch out for my realy bad spelling :I
martin Posted July 1, 2007 Posted July 1, 2007 (edited) The porblem with yours is that its not reversable(i think :S) Am i wrong?Yes you are wrong - >3ua.stnatsnoCIUG< edulcni# >3ua.csim< edulcni# )002,002,002,002,"iug llams"(etaerCIUG )(etatSteSIUG ]0,0[ = ]2[yxtsal$ miD 1 elihW )1(gsMteGIUG = gsm$ pooLtixE nehT esolc_tneve_iug$ = ]0[gsm$ fI nehT )1 ( desserPsI_ fI )(soPteGesuoM = pm$ )"iug llams"(soPteGniW = sopmrof$ nehT )sopmrof$,pm$(edistuo fI nehT ]1[pm$ >< ]1[yxtsal$ rO ]0[pm$ >< ]0[yxtsal$ fI )FLRC@ & 'kcilc esuom mrof fo tuo'(etirWelosnoC ]0[pm$ = ]0[yxtsal$ ]1[pm$ = ]1[yxtsal$ fIdnE fIdnE fIdnE dnEW )b$,a$(edistuo cnuF ;eurT nruteR nehT ]1[b$ < ]1[a$ rO ]0[b$ < ]0[a$ fI eurT nruteR nehT ]2[b$ + ]0[b$ > ]0[a$ fI eurT nruteR nehT ]3[b$ + ]1[b$ > ]1[a$ fI eslaF nruteR cnuFdnE Edit: I forgot to mention that to use this script you need the esrever.dll from www.erehwon.oc.ku Edited July 1, 2007 by martin 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.
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