Jump to content
Sign in to follow this  
cew27

mouse click?

Recommended Posts

cew27

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

Share this post


Link to post
Share on other sites
Nahuel

Look in help file for ControlClick() :)

Share this post


Link to post
Share on other sites
Achilles

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]

Share this post


Link to post
Share on other sites
cew27

ok is there any code to disabling the keyboard and mouse? ... i know there is blockinput (1) but that doesnt work o vista?

Share this post


Link to post
Share on other sites
Achilles

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]

Share this post


Link to post
Share on other sites
Nahuel

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() :)

Share this post


Link to post
Share on other sites
cew27

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

Share this post


Link to post
Share on other sites
Achilles

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]

Share this post


Link to post
Share on other sites
cew27

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

Share this post


Link to post
Share on other sites
Nahuel

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

Share this post


Link to post
Share on other sites
cew27

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

Share this post


Link to post
Share on other sites
cew27

and the f4 key aswell

thanks

Share this post


Link to post
Share on other sites
cew27

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?

Share this post


Link to post
Share on other sites
Nahuel

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.

Share this post


Link to post
Share on other sites
cew27

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?

Share this post


Link to post
Share on other sites
cew27

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?

Share this post


Link to post
Share on other sites
Nahuel

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.

Share this post


Link to post
Share on other sites
cew27

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

Share this post


Link to post
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
Sign in to follow this  

×