Jump to content

How to delete content of control Edit?


Recommended Posts

Hello

I am very new in AutoIt so excuse my ignorance. On user computers, I need to automaically set screen saver Windows XP with the delay 25minutes.

I cannot find a way how to overwrite pre-existing delay value users might have. Here is my attempt script ( the field Wait has an Control ID 1306):

Run("control.exe desk.cpl,,2")

WinWait("Display Properties", "Screen Saver")

ControlCommand("Display Properties", "Screen Saver", "ComboBox1", "SelectString", "Windows XP")

ControlFocus("Display Properties", "Screen Saver", 1306)

ControlSend("Display Properties", "Screen Saver", 1306, "25")

The function ControlFocus, just puts cursor at the first position, and function ControlSent inserts a string 25, so for example if preexisting delay was 30, I get the result 2530 - which is not good.

If I use function Send("{TAB 3}") instead the function ControlFocus it works. However, I do not like sending TABs because after other operations in the window the number of tabs may vary.

Any ideas?

Thanks for replies

Link to post
Share on other sites

you could have the mouse double click on whatever is curretly there, that should make it highlighted and then whatever you enter would overwrite it. Or you could regwrite the key

-HKEY_CURRENT_USER\Control Panel\Desktop\ScreenSaveTimeOut

and set how many seconds to wait.

Thanks, I really like idea of mouse double-click. I have tried the function

ControlClick("Display Properties", "Screen Saver", 1306, "left", 2) but it does not work.

Well, how to double-click a control?

Edited by Sani
Link to post
Share on other sites

Hello Evilertoaster

Giving focus first and then clicking 1 time and then sleep(10) and then click again does not work.

However, your code with sending keystroke works OK. Perhaps some improvement:

ControlSend ( "Display Properties", "Screen Save", 1306, "+{END}15" )

Instead sending several Shift+Left key strokes, you can send one Shift+End stroke.

Thanks for idea.

Sani

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
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...