Jump to content
Sign in to follow this  
dunk6

Using MouseClick()

Recommended Posts

dunk6

Hi,

Using mouseCLick function, can i script something like this:

  • From right click, select and open shortcut/action of the program in context menu.

MouseClick("menu")

thanks in advance

Edited by dunk6

Share this post


Link to post
Share on other sites
PsaltyDS

Hi,

Using mouseCLick function, can i script something like this:

  • From right click, select and open shortcut/action of the program in context menu.
MouseClick("menu")

thanks in advance

Only if you know the X/Y coordinates of what you want to click on. More likely you could use hotkeys already built in, like:
; Send 'o' for open file
Send("o")

:)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites
dunk6

Only if you know the X/Y coordinates of what you want to click on. More likely you could use hotkeys already built in, like:

; Send 'o' for open file
Send("o")

:)

That's the problem,I dont knw wthr it have hotkeys built in. But I try to code like this, and it run the way i want, but is there simplest way to do??:

;on right click
MouseClick("right")
$count = 1
Do
    Send("{DOWN}")
    $count = $count + 1  
Until $count > 7
Send("{ENTER}")

thanks

Share this post


Link to post
Share on other sites
herewasplato

;on right click
MouseClick("right")
Send("{DOWN 8}")
Send("{ENTER}")
Context menus usually change depending on what you click on. I know that you said in another post that the software that you are wanting to automate is on the context menu when you "right click on all kind of files and folders". But if some other software adds items to the context menu only when files are "right clicked on" , then the menu item that you are interested in could be moved down to 10. (I'm not sure that I was very clear there - so if you don't understand all of that, just ignore it.)

Using a key is better:

(Assumes XP as the OS)

Right click on an empty spot on your desktop

Select Properties

Select the tab named "Appearance"

Click on the button labeled "Effects..."

If need be - uncheck the option to:

"Hide underlined letters for keyboard navigation until I press the Alt key"

"OK" your way out of those two windows.

Now right click on a file and see if there is a letter that is underlined on the menu item of interest.

If yes, then replace

Send("{DOWN 8}")

with

Send("e") ; <<< use the letter of interest.

If that works for you - then you do not need:

Send("{ENTER}")


[size="1"][font="Arial"].[u].[/u][/font][/size]

Share this post


Link to post
Share on other sites
dunk6

Context menus usually change depending on what you click on. I know that you said in another post that the software that you are wanting to automate is on the context menu when you "right click on all kind of files and folders". But if some other software adds items to the context menu only when files are "right clicked on" , then the menu item that you are interested in could be moved down to 10. (I'm not sure that I was very clear there - so if you don't understand all of that, just ignore it.)

Using a key is better:

...

Now right click on a file and see if there is a letter that is underlined on the menu item of interest.

If yes, then replace

Send("{DOWN 8}")

with

Send("e") ; <<< use the letter of interest.

If that works for you - then you do not need:

Send("{ENTER}")

:):) Unfortunately, no key are applied for that program

and yes, i understand bout ur concern on the context menu things, but i only see that is the only solution i have for now!

Share this post


Link to post
Share on other sites
dunk6

I found this method in VBA,InvokeVerbEx("name") which will select from the context menu. It open my program window, doing the prog execution, but if during it running, i cannot move away from it windows or the execution did not work. someone tell me how to fix this, thanks!!

$objShell = ObjCreate("Shell.Application")
    $objFolder = $objShell.Namespace($source)
    $colItems = $objFolder.Items
    For $i = 0 to $colItems.Count - 1
                ;doing right click here
        $colItems.Item($i).InvokeVerbEx("Encrypt")
        Sleep(500)
        ;send password
        ControlSend("SafeNet ProtectPack",  "", "Edit2", $pass)
        Sleep(500)  
        ;confirm password
        ControlSend("SafeNet ProtectPack",  "", "Edit3", $pass)
        Sleep(500)
        ;execute program
        Send("{ENTER}")
        Sleep(500)
        Send("{ENTER}")
    Next

and sometimes doing problem like here:

http://www.autoitscript.com/forum/index.php?showtopic=103325&view=findpost&p=734220

Edited by dunk6

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  

×