seandisanti Posted February 6, 2006 Posted February 6, 2006 I changed the code in the post above a bit to allow Atl-F4 to work on other windows/apps... ...but I have a somewhat related question: Is this loop better than using one If/Else/EndIf? While 1 If WinActive($calcHwnd) Then HotKeySet("!{F4}", "trap") If Not WinActive($calcHwnd) Then HotKeySet("!{F4}") Sleep(30) WEndThe help files states: @Mega: "schadenfreude" - I had to go look that one up. Yes, it seems to be the same the world over. :-)well if you looked it up, what does it mean? i can't go on internet too much here to search for myself.
Xenobiologist Posted February 6, 2006 Posted February 6, 2006 (edited) well if you looked it up, what does it mean? i can't go on internet too much here to search for myself.schadenfreude --> die Schadenfreude gloating --> die Schadenfreude mischievousness --> die Schadenfreude spitefulness --> die Schadenfreude malicious joy -->die SchadenfreudeThe first translation of www.leo.org suggests that there is the same word in both languages. I don´t know which of them is the right. Laughing about someone else "mistake"HotKeySet("!{F4}") might be the same as HotKeySet() I thnik.So long,Mega Edited February 6, 2006 by th.meger Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times
herewasplato Posted February 6, 2006 Posted February 6, 2006 (edited) well if you looked it up, what does it mean? i can't go on internet too much here to search for myself.th.meger = location = GermanyAccording to freetranslation.comGerman to Englishschadenfreude = gloatingEdit1: Poor Iwan. What a thread to come back to...Edit2: "malicious joy" --- What a concept! Edited February 6, 2006 by herewasplato [size="1"][font="Arial"].[u].[/u][/font][/size]
herewasplato Posted February 6, 2006 Posted February 6, 2006 ...HotKeySet("!{F4}") might be the same as HotKeySet()...Nope. That errors out... and HotKeySet("") does not work either. From the help file for HotKeySet:; capture and pass along a keypress HotKeySet("{Esc}", "captureEsc") Func captureEsc() ; ... can do stuff here HotKeySet("{Esc}") Send("{Esc}") HotKeySet("{Esc}", "captureEsc") EndFunc [size="1"][font="Arial"].[u].[/u][/font][/size]
Xenobiologist Posted February 6, 2006 Posted February 6, 2006 awesome, i like that word. there are more like that. e.g.: http://www.ulib.iupui.edu/kade/nameword/apend-d.html Nope. That errors out... and HotKeySet("") does not work either.I knew it I just read the topic destroy a HotKeySet. It is late in Germany I should go to bed. So long,Mega Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times
Iwan Posted February 6, 2006 Author Posted February 6, 2006 Haha thanks ya'll I will try them all in te mornin!!
jaenster Posted February 7, 2006 Posted February 7, 2006 if mouse pos is on "close button xy" then Mousemove(1,1,0) endif Maby some like this? -jaenster
herewasplato Posted February 7, 2006 Posted February 7, 2006 if mouse pos is on "close button xy" then Mousemove(1,1,0)endifMaby some like this?In case the code posted here:http://www.autoitscript.com/forum/index.ph...ndpost&p=147246or the sample code posted here:http://www.autoitscript.com/forum/index.ph...ndpost&p=147258does not work for Iwan... Could you post a working example of your suggestion? Maybe you could use the Calculator program like CyberSlug did to let us copy/paste/run your sample code for evaluation.I know how I would code your suggestion, but you code so differently than I... I would be interested to see your creative solutions to some of the problems that I foresee in implementing your suggestion to keep the mouse off of the "X" in the window of interest. [size="1"][font="Arial"].[u].[/u][/font][/size]
herewasplato Posted February 7, 2006 Posted February 7, 2006 @Iwan, jaenster has declined (via PM) to flesh out his suggested method of having the "mouse avoid the X". It is a viable option in case you find the other option(s) posted in this thread do not meet your needs. Post back if you decide to go that route and need help doing so. later... [size="1"][font="Arial"].[u].[/u][/font][/size]
seandisanti Posted February 7, 2006 Posted February 7, 2006 @Iwan,jaenster has declined (via PM) to flesh out his suggested method of having the "mouse avoid the X". It is a viable option in case you find the other option(s) posted in this thread do not meet your needs. Post back if you decide to go that route and need help doing so.later...that sounds like just using MouseTrap() to confine the cursor to the workable area of the window in question.
herewasplato Posted February 7, 2006 Posted February 7, 2006 that sounds like just using MouseTrap() to confine the cursor to the workable area of the window in question.I was thinking of something a bit more transparent to the user... sort of the inverse of mousetrap. The mouse can go anywhere and do anything except click on the "X" when the window of interest is active anywhere on the screen.Another option: I'm not sure if we ever found code to absorb a mouse click (absorb = not pass the click on to the app) like the HotKeySet absorbs keys - but if that code is known, then you wouldn't even need to force the mouse to stay out of the area... you would just "absorb the click" if and when the mouse if over the "X of interest".I see no reason why the other methods posted would not work (and with far less coding), but not allowing a click on the "X" either by an inverse mousetrap or via "click absorb" is an interesting thought. That is why I wanted jaenster to flesh it out a bit. [size="1"][font="Arial"].[u].[/u][/font][/size]
D4rk^S0ul Posted February 7, 2006 Posted February 7, 2006 If you have a problem with them closing it with task manager you could use a way to log it like was said before you can write it to a file e.g. If Not ProcessExists("<Citrix Process>") Then FileWrite("<Dir Path>", @UserName " has been logged with out Citrix on there machine!") EndIf
seandisanti Posted February 7, 2006 Posted February 7, 2006 I was thinking of something a bit more transparent to the user... sort of the inverse of mousetrap. The mouse can go anywhere and do anything except click on the "X" when the window of interest is active anywhere on the screen. Another option: I'm not sure if we ever found code to absorb a mouse click (absorb = not pass the click on to the app) like the HotKeySet absorbs keys - but if that code is known, then you wouldn't even need to force the mouse to stay out of the area... you would just "absorb the click" if and when the mouse if over the "X of interest". I see no reason why the other methods posted would not work (and with far less coding), but not allowing a click on the "X" either by an inverse mousetrap or via "click absorb" is an interesting thought. That is why I wanted jaenster to flesh it out a bit. something like this to absorb the mouse click? all you have to do is remove the message box, and check the position (using MouseGetPos) to see if it's on the X. the sample below (while running) won't allow you to close anything by clicking, but without putting in a position check it stops all left clicking... #include<misc.au3> while 1 If _IsPressed(1) then MsgBox(0,"click","click") WEnd
herewasplato Posted February 7, 2006 Posted February 7, 2006 Check out this post and thread:http://www.autoitscript.com/forum/index.ph...ndpost&p=142075Remark out the MsgBox and the click gets thru:#include<misc.au3> While 1 If _IsPressed (1) Then;MsgBox(0,"click","click") EndIf WEndIf you can find code to have IsPressed absorb the click and be transparent to the user, then you'll make crushinator happy.However, for Iwan - with the right code to only watch for (and absorb?) the clicks when over the "X" of interest, a MsgBox telling the user to log out and not close the window via the "X" might not be a bad idea. [size="1"][font="Arial"].[u].[/u][/font][/size]
=sinister= Posted February 7, 2006 Posted February 7, 2006 There is a way of doing this if you code the window in autoit. But it will also disable the minimize and maximize button.....
seandisanti Posted February 8, 2006 Posted February 8, 2006 There is a way of doing this if you code the window in autoit. But it will also disable the minimize and maximize button.....he's tryign to interact with another app, namely a citrix app i believe. one thing i was thinking about though, i believe that there are some COM objects for citrix...
herewasplato Posted February 8, 2006 Posted February 8, 2006 AutoItSetOption("WinTitleMatchMode", 4) Run("calc") WinWait("Calculator") $calcHwnd = WinGetHandle("Calculator") $menu = DllCall("user32.dll", "hwnd", _ "GetSystemMenu", "hwnd", _ $calcHwnd, "int", 0) DllCall("user32.dll", "int", _ "RemoveMenu", "hwnd", _ $menu[0], "int", _ 0xF060, "int", 0x0);SC_CLOSE While 1 If WinActive($calcHwnd) Then HotKeySet("!{F4}", "trap") Else HotKeySet("!{F4}") While WinActive("Windows Task Manager") Or WinActive("Task Manager") If Not ProcessExists("calc.exe") Then ;FileWrite to a log MsgBox(0, "Logged", "Closed via Task Manager.") ExitLoop 2 EndIf Sleep(30) WEnd EndIf Sleep(30) If Not ProcessExists("calc.exe") Then ExitLoop WEnd Func trap() EndFunc ;==>trapTest this... [size="1"][font="Arial"].[u].[/u][/font][/size]
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