cew27 Posted October 13, 2007 Share Posted October 13, 2007 hi when using the mouse clock function ... like clicking on a button is there anyway to make it so that it will work on all size screens/pixels/resolutions? thanks Link to comment Share on other sites More sharing options...
Nahuel Posted October 13, 2007 Share Posted October 13, 2007 Look in help file for ControlClick() Link to comment Share on other sites More sharing options...
Achilles Posted October 13, 2007 Share Posted October 13, 2007 You might want to look in the helpfile for @DesktopWidth and @Desktopheight or maybe WinGetPos(). This could be helpful if you want to click on the bottom right corner of the screen because then you could just do MouseClick('left', @Desktopwidth, @Desktopheight) My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list] Link to comment Share on other sites More sharing options...
cew27 Posted October 14, 2007 Author Share Posted October 14, 2007 ok is there any code to disabling the keyboard and mouse? ... i know there is blockinput (1) but that doesnt work o vista? Link to comment Share on other sites More sharing options...
Achilles Posted October 14, 2007 Share Posted October 14, 2007 ok is there any code to disabling the keyboard and mouse? ... i know there is blockinput (1) but that doesnt work o vista?There's _MouseTrap() but I haven't found that to work very well. Since BlockInput is not working you could try just blocking the keys you want to. You would do this using HotKeySet('a', '_Block') While 1 Sleep(2000) Wend Func _Block() EndFuncI haven't tested that but I'm pretty sure it would make typing a do nothing. You can only have around 65 hotkeys so don't bother trying to use that for everything, unless you're really desperate, then just use different .au3 files. My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list] Link to comment Share on other sites More sharing options...
Nahuel Posted October 14, 2007 Share Posted October 14, 2007 It doesn't?? how about this? _BlockInput(1) Sleep(2000) _BlockInput() Func _BlockInput($flag=0) DllCall("user32.dll","int","BlockInput","int",$flag) EndFunc Shouldn't work either, since it works the same way as BlockInput() Link to comment Share on other sites More sharing options...
cew27 Posted October 14, 2007 Author Share Posted October 14, 2007 could someone please explain what each of these commands are doing in this script? While 1 Sleep(2000) Wend Func _Block() EndFunc im trying to learn the script as i dont like just to copy thanks Link to comment Share on other sites More sharing options...
Achilles Posted October 14, 2007 Share Posted October 14, 2007 (edited) could someone please explain what each of these commands are doing in this script? While 1 Sleep(2000) Wend Func _Block() EndFunc im trying to learn the script as i dont like just to copy thanksWithout the While 1.... part your script would just exit. This is called a loop. While 1;which means forever sleeps(2000);which just makes it do nothing for two seconds WEnd ;end of loop, repeat to top of loop (the while 1 statement) So, basically is waits two seconds, then is told to wait another two seconds, and another two seconds, and another two seconds.... Until the script is exited which is done by the user rightclicking the tray item and clicking exit. The Func _Block() EndFunc is a fucntion. Or something that performs a well defined task. In this example the _Block() function does nothing, which means it blocks the key from being pressed. However this function is necessary so that the key is blocked. Edited October 14, 2007 by Piano_Man My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list] Link to comment Share on other sites More sharing options...
cew27 Posted October 14, 2007 Author Share Posted October 14, 2007 HotKeySet('a', '_Block') - selects the key? While 1 - Sleep(2000) - that makes the code repeat? Wend - Func _Block() still not sure does this tell the hot key which is a to be blocked? asi thaught that thats what the _block in the top line did ? EndFunc sorry for being stupid but i hate having ocd and need to know what these are!! thanks Link to comment Share on other sites More sharing options...
Nahuel Posted October 14, 2007 Share Posted October 14, 2007 HotKeySet('a', '_Block') - selects the key? While 1 - Sleep(2000) - that makes the code repeat? Wend - Func _Block() still not sure does this tell the hot key which is a to be blocked? asi thaught that thats what the _block in the top line did ? EndFunc sorry for being stupid but i hate having ocd and need to know what these are!! thanksHotKeySet('a', '_Block') Sets a hot key. What's this? A key that when you press it, it calls a function. In this case, "_Block()" While 1 Sleep(2000) Wend This is a loop. It does something while a certain contition is true. Putting "1" as condition, means it has to loop for ever. For example, I want to show a message WHILE 1=1: While 1=1 MsgBox(0,"","Hey! One equals one!") Wend Func _Block() ;Do something here EndFunc This is a User Defined Function. You can call it Fred() if yuo wish. It's also known (at least in Spanish) as 'Sub-program'. It won't do anything by itself, it needs to be 'called'. A full example: ;Set the hot key: HotKeySet("a","Fred") ;Loop for ever: While 1 Sleep(25) Wend ;My User Defined Function: ;This function is called when you press the "a" key Func Fred() MsgBox(0,"","Hey! You pressed the a key") EndFunc Link to comment Share on other sites More sharing options...
cew27 Posted October 14, 2007 Author Share Posted October 14, 2007 thanks for that i got it now im having trouble .... say i wanted the script to open your default browser and open a webpage but i want it to block out the mouse and the cntr and delete keys this is what i have so far #include <Process.au3>$rc = _RunDos("start http://www.google.co.uk")HotKeySet('a', '_Block')While 1Sleep(2000)WendFunc _Block()EndFuncbut i dont know the code for the ctrl keys and the delete key to block and the mouse thanks Link to comment Share on other sites More sharing options...
cew27 Posted October 14, 2007 Author Share Posted October 14, 2007 and the f4 key aswell thanks Link to comment Share on other sites More sharing options...
Nahuel Posted October 14, 2007 Share Posted October 14, 2007 The help file has all your answers. Here's a start: #include <IE.au3> HotKeySet("f4","Block") _IECreate("www.google.co.uk") While 1 Sleep(25) WEnd Func Block() ;Do nothing EndFunc Link to comment Share on other sites More sharing options...
cew27 Posted October 14, 2007 Author Share Posted October 14, 2007 but that only dies it for internet explorer ...i would like it to open in the deafault browser so that it works with ie and ff also what are the keys for alt and ctrl ? is there a list of all the keys? Link to comment Share on other sites More sharing options...
Nahuel Posted October 14, 2007 Share Posted October 14, 2007 It's easier to work with IE since there's a whole library to work with. For the key list, look for Send in the help file. Link to comment Share on other sites More sharing options...
cew27 Posted October 14, 2007 Author Share Posted October 14, 2007 ok thanks .... is there any alternat ecodes other than the include proces.au3 $rc _rundos(start"www.google.com") that will open a webpage in the default browser? Link to comment Share on other sites More sharing options...
cew27 Posted October 14, 2007 Author Share Posted October 14, 2007 ok now im stuck HotKeySet("??","Block") While 1=1 Sleep(25) Wend Func Block() EndFunc what goes in the ?? area to block the control key ... i tried {lctrl} and i tried ^ctrl ??/ any ideas ? also do i need to change something if i want to block more than one key? Link to comment Share on other sites More sharing options...
Nahuel Posted October 14, 2007 Share Posted October 14, 2007 You can't set control, alt or shift as hotkeys since they are modifiers! Read the help file.. I don't know how to block them. Link to comment Share on other sites More sharing options...
cew27 Posted October 14, 2007 Author Share Posted October 14, 2007 i just read that doh! ... it doesnt say anything about blocking f4 however i cant get this to work ... is it because my code is wrong or because it is letting it work due to the fact im holding alt aswell thanks for all the help!! greatly appreciated 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