Jump to content

Small newbie help


masken
 Share

Recommended Posts

Okay, I'm totally new in AutoIt.

As a first project, I'd like to make a script that enters the control panel's "mouse" alternatives - or simply the applet "main.cpl", browses to the tab "Wheel", sets 4 rows for scrolling, and presses Enter. Is this possible?

I managed to do this:

Run("control.exe main.cpl")

Then I guess I should use ControlCommand ( ) in some fashion?

Link to comment
Share on other sites

Try this, pretty crude but works!

Run("control.exe main.cpl")
WinWaitActive("Mouse Properties","")
Send("^{TAB}^{TAB}^{TAB}")
ControlSetText("Mouse Properties","","Edit1","4")
Send("{ENTER}")

Edit: Added code block around code

Edited by sandyd
----[ SandyD ]---
Link to comment
Share on other sites

Tested on WinXP Pro sp1... might not work on all computers (especially laptops).

Run("control.exe main.cpl")
WinWait("Mouse Properties")
WinSetState("Mouse Properties","",@SW_HIDE)
ControlCommand("Mouse Properties","","SysTabControl321","TabRight","")
ControlCommand("Mouse Properties","","SysTabControl321","TabRight","")
ControlCommand("Mouse Properties","","SysTabControl321","TabRight","")
ControlSetText("Mouse Properties","","Edit1","3")
ControlClick("Mouse Properties","","OK")

You should be able to do this more directly by writing the appropriate registry key, but I don't know how to tell Windows to refresh and use the new value...

RegWrite("HKEY_CURRENT_USER\Control Panel\Desktop","WheelScrollLines","REG_SZ", "3")

Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!
Link to comment
Share on other sites

Thanks alot for the tips :D

Two different ways of achieving the goal, nice :lol:

@CyberSlug, yeah I've used regmon to see what's going on, but I couldn't get anything out of it. I don't know how Win refreshes hives either.

@CyberSlug, could you please explain shortly what the ControlCommand() does here? :idiot:

Link to comment
Share on other sites

@CyberSlug, could you please explain shortly what the ControlCommand() does here?  :idiot:

<{POST_SNAPBACK}>

Control command is more reliable than sending key strokes becuase the window can does not have to be active or even visible.

1) Using the AutoIt Window Spy/Info tool, I checked the "name" of the tab control: SysTabControl321

I call "TabRight" three times which, as documented in the help file, activates the next tab

2) The other two lines

ControlSetText("Mouse Properties","","Edit1","3")

ControlClick("Mouse Properties","","OK")

should be pretty self explanatory. NOTE: In your case, you would want to change 3 to 4.

3) The reason I hide the mouse window after it appears is because my computer seeems to hang for a half-second when the OK button on the mouse properties window is clicked.

By the way, here's an improvement based on this information

Run("control.exe main.cpl,@0,2") ;Launch mouse properites with third tab open
WinWait("Mouse Properties")
WinSetState("Mouse Properties","",@SW_HIDE)
ControlSetText("Mouse Properties","","Edit1","4")
ControlClick("Mouse Properties","","OK")
Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!
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...