Jump to content

Editing System Properties


MaxU77
 Share

Recommended Posts

Hi,

I'm writing script that should install some software.

The software installation requires system variable to be created.

I want Autoit to emulate "Win+Break" then goto "Advanced" tab and then emulate "Alt+n" etc...

Thus I tried the code like:

Send ("#{BREAK}")

WinWaitActive ("System Properties","General")

Send ("{LEFT}")

Send ("{LEFT}")

Send ("{LEFT}")

Send ("!n")

But <Send ("#{BREAK}")> seems not working.

What is my mistake?

Thank in advance.

PS: OS is WinXP 64bit SP2

Edited by MaxU77
Link to comment
Share on other sites

Better to not use Send command.

get the Control names from AutoIt's window info tool and try with ControlClick or ControlCommand, ControlSetText

you could start like this:

ShellExecute('rundll32.exe', 'shell32.dll,Control_RunDLL sysdm.cpl,,3'); Should open the Advance tab
WinWait('System Properties')
ControlClick('System Properties', '', 'Button7')
Edited by JFX
Link to comment
Share on other sites

Great! Thanks!

Its much smarter.

Could you also recommend the way to fill Name and Value.

I guess

Send ("NAME")

Send ("{TAB}")

Send ("VALUE")

Is not the best bet

But

ControlCommand("Environment Variables", "", "Edit1", "EditPaste", "NAME")

ControlCommand("Environment Variables", "", "Edit2", "EditPaste", "VALUE")

ControlClick('Environment Variables', '', 'Button1')

Doesn' work.

Link to comment
Share on other sites

Yeah - that works! Thanks again

I think I tried something alike but I guess I've mistaken "Window title" value thus failed to get it working.

The script now works perfectly on English Windows but it don't work on Localized Win.

Of course I can create script for each OS, but probably there is a better way?

I even guess that I can combine two scripts into one using some "if" in the begining.

IF OS UI Language =EN do first set if =RU - second and so on.

But I wonder if it is possible to create uni script that would work regardless of OS UI language.

I thought it could be done if use "Window class" rather then "Window title" when referencing window controls ... but

I've found Class stays the same for different window titles.

For example both windows (title "System Properties" and "Environment Variables") has Class "#32770"

Thus Winwait looses its meaning.

Please comment.

Link to comment
Share on other sites

You're trying to set an user environment variable correct? If so there's a registry setting that stores them. Look in HKCU\Environment, that's where the user env. variables are stored. The system evn. variables are stored in HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment. You can use the AutoIt3 registry functions to set and/or delete those values which would probably be a single line rather than a long keystroke sequence.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

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...