Jump to content

mouse click?


cew27
 Share

Recommended Posts

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

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() 
EndFunc
I 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

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

Without 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 by Piano_Man
My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list]
Link to comment
Share on other sites

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

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

HotKeySet('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

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 1

Sleep(2000)

Wend

Func _Block()

EndFunc

but 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

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

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...