Jump to content

How Do I?


Recommended Posts

I'm trying to change the following code (

Run("control timedate.cpl")
WaitForWindow_ThenActivate("Date and Time Properties", "Date && Time", 0)
   Send("+{TAB}{RIGHT}")
WaitForWindow_ThenActivate("Date and Time Properties", "Time Zone", 0)
   Send("{TAB}{END}{UP 8}+{TAB}{RIGHT}")
WaitForWindow_ThenActivate("Date and Time Properties", "Internet Time", 0)
   Send("!s{-}{ENTER}")
WinWaitClose("Date and Time Properties")

) so that I can hide the window but still operate it. The problem is eventhough I changed it to (

Run("control timedate.cpl", "", QSW_HIDE)
WinWait("Date and Time Properties", "Date && Time", 0)
   Send("+{TAB}{RIGHT}")
WinWait("Date and Time Properties", "Time Zone", 0)
   Send("{TAB}{END}{UP 8}+{TAB}{RIGHT}")
WinWait("Date and Time Properties", "Internet Time", 0)
   Send("!s{-}{ENTER}")
WinWaitClose("Date and Time Properties")

) I'm not sure what to change the Send commands to as if I use ControlSend it seems to bring the window back to active.

Any help would be much appreciated as this is driving me up the proverbial wall. :whistle:

Link to comment
Share on other sites

Greets, I wanted to do the same thing, and had the same problem

Opt( "WinWaitDelay", 1 )
Opt( "WinDetectHiddenText" , 1 )

RunAsSet( "xxxx", "xxxx", "xxxxx" )
Run( "\\xxxx\apps$\chainstoreguide2004\setup.exe" )
RunAsSet()

click( "Setup - National Association of Chain Drug Stores", "Welcome", "TButton2" )
click( "Setup - National Association of Chain Drug Stores", "I &do not accept the agreement", "TRadioButton2" )
click( "Setup - National Association of Chain Drug Stores", "I &do not accept the agreement", "TButton2" )
click( "Setup - National Association of Chain Drug Stores", "C:\Program Files\MVReader\CDS-0001\", "TButton2" )
click( "Setup - National Association of Chain Drug Stores", "SelectProgramGroup", "TButton2" )
click( "Setup - National Association of Chain Drug Stores", "Destination directory:", "TButton2" )
click( "Setup - National Association of Chain Drug Stores", "Finished", "TNewCheckListBox1" )
click( "Setup - National Association of Chain Drug Stores", "Finished", "TButton2" )

Func click( $title, $text, $button)
WinWait( $title, $text )
WinSetState( $title, $text, @SW_HIDE )
ControlSend( $title, $text, $button, "{SPACE}" )
EndFunc

This is for installing a program. As you can see the function waits for the window to exist and as soon as it does, it sets its state to hidden. The ControlSend functions will work with a hidden window. If you are looking for text, you have to set the Opt( "WinDetectHiddenText" , 1 ) at the top. With a WinWaitDelay of 1 ms, it's as close to perfect as you're going to get. You should be able to execute this on a machine with a user doing something else and they never even know what happens. The only thing I find is an intial flicker of the first window appearing and these disappearing, after that I see nothing at all.

Link to comment
Share on other sites

Thank you Batch for that code, it helped some. The Date & Time Properties window has a SysTabControl321 tab which I must operate. I will need code to TabRight or TabLeft to be able to be sent to a hidden window.

EDIT:

Nevermind, I've worked it like this:

click( "Date and Time Properties", "Date && Time", "", "")
ControlCommand("Date and Time Properties", "Date && Time", "SysTabControl321", "TabRight", "")

Func click( $title, $text, $button, $TextToSend)
WinWait( $title, $text )
WinSetState( $title, $text, @SW_HIDE )
ControlSend( $title, $text, $button, $TextToSend )
EndFunc
Edited by w_sp8er
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...