Reply to topic

Starting Audio
Robby
Guest

Reply with quote
i have a nice mobo, i can't quite think of the name of it right now, but it has 8.1 audio which is nice but it also jack sneses, so that you can plugin whatever you need to into the jacks and it is supposed to sense what it is and how it should trat it. this part is all good and holy, what i need to know is how to make mouse scripts work so that i can make a script that automatically clicks the jack sensing buttons.

static void Click(int nX,int nY,int nButton [Left,Middle,Right] = [Left],int nRelativity [Screen,App,Focus] = [Screen]);
tell me how to use this please
Logan Mueller
Support

Joined: 16 Nov 2003
Posts: 565
Reply with quote
There are a couple of ways to approach this. Here's the easiest way:

Assuming this button is located at screen coordinate 10,10 (based in pixels) and you want to do a left-mouse-click, this would be your code:

Mouse.Click(10,10);

You don't need to worry about passing in the final two parameters, because they are defaulted to specific values, and therefore, optional. (nButton is defaulted to [Left] and nRelativity is defaulted to [Screen])

If you wanted to do a right-mouse-click instead, you would need to pass in the third parameter, like so:

Mouse.Click(10,10,[Right]);

If you wanted your coordinates to be relative to the window with current focus (foreground window) then use the 4th parameter, like this:

Mouse.Click(10,10,[Left],[Focus]);

This is helpful if the window your are trying to automate gets moved around a lot. (You probably don't want to keep updating the coordinates all the time)

I don't know if you've seen this already, but Gizmo can assist with getting screen coordinates. If you right-click on the life preserver, select "Window Analyzer". This will bring up a window with a bunch of information, including the current screen coordinate of your mouse pointer.

After moving the mouse pointer over to your button, check the values in the "Wait & Click Codes" area. In the right portion of that group are screen coordinates. Top line is relative to [Focus], second line is relative to [App], and the last line is relative to [Screen]

Let me know if you have any other questions.

_________________
Support is provided as a convenience to our users. We make no guarantees in the timeliness and accuracy in our responses. We reserve the right to refuse service to anyone.
View user's profileSend private messageVisit poster's website
Robby
Guest

Reply with quote
Thanks for the help, also, how do I open an exe, it keeps telling me this is wrong: (of course when I finish the coodordinates for the mouse will be filled.

Open(C:\windows\system32\RTLCPL.exe);
ForceToTop(012d00a00630002) ;
Mouse.Click(10,10,[Left],[Focus]);
Sleep(3000);
Mouse.Click(10,10,[Left],[Focus]);
Sleep(6000);
Mouse.Click(10,10,[Left],[Focus]);
Sleep(1000);
Mouse.Click(10,10,[Left],[Focus]);
Sleep(1000);
Mouse.Click(10,10,[Left],[Focus]);
Sleep(1000);
Mouse.Click(10,10,[Left],[Focus]);
Logan Mueller
Support

Joined: 16 Nov 2003
Posts: 565
Reply with quote
To execute an EXE, just use Execute() from the Shell class, like this:

Shell.Execute("C:\windows\system32\RTLCPL.exe");

To use ForceToTop() (from the Window class) you need to get a "Window object" first. This can be done by calling: FindByClass(), FindByName(), or FindByPos()

The following example searches for a window with the title "Sample Window Title", creates a "Window Object" for it, and calls ForceToTop()

Window MyWindow = Window.FindByName("Sample Window Title");
MyWindow.ForceToTop();

Your calls to Mouse.Click() look good, but the Sleep() function is actually part of the Script class, so you should call it like this:

Script.Sleep(1000);

Other than that, your approach for writing the script looks good.

_________________
Support is provided as a convenience to our users. We make no guarantees in the timeliness and accuracy in our responses. We reserve the right to refuse service to anyone.
View user's profileSend private messageVisit poster's website
jack montgomery
Guest

Reply with quote
not sure if i'm still headed in right direction
Starting Audio
All times are GMT - 8 Hours  
Page 1 of 1  

  
  

 Reply to topic