Pressing alt key

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
ksimmons
Newbie
Posts: 6
Joined: Wed Aug 06, 2003 9:37 pm
Location: Lockheed Martin

Pressing alt key

Post by ksimmons » Tue Aug 19, 2003 1:06 pm

I am writing a script that requires filling in many tabs in a Properties window. When I get to a the Stack Tab, I have the following code written:

SRT>FillStackTab
SetFocus>Properties*
Press Alt
Send>i
Release Alt
END>FillStackTab

This code is going to move over to the Stack Tab and then select the radio button called IP address, however it never selects the radio button it just stops. Now I have a large program and this is only a piece of the code. I have actually taken this piece of code out and ran it by itself and it seems to work. However, it doesn't work when its in my large program. I always remove the trailing white spaces also. What could be some possible problems?


:cry:
Kina

User avatar
support
Automation Wizard
Posts: 1450
Joined: Sat Oct 19, 2002 4:38 pm
Location: London
Contact:

Post by support » Tue Aug 19, 2003 1:22 pm

Hi,

It's impossible to answer your question without seeing the entire script. If it does indeed work on it's own but not in your main script then there has to be something not quite right about your main script.

You should enable logging, see if the log file identifies anything and also step through your script with the debugger with the watch list on.
MJT Net Support
[email protected]

ksimmons
Newbie
Posts: 6
Joined: Wed Aug 06, 2003 9:37 pm
Location: Lockheed Martin

Pressing alt key

Post by ksimmons » Tue Aug 19, 2003 1:39 pm

I have ran the debugger with watch list and enabled the logging. It still does not give help me fix this problem. Here is my program:



// Variables
Let>file=%WIN_DIR%
//get the drive letter
MidStr>%file%,1,2,driveletter
//MessageModal>%driveletter%
Let>logFileName=%driveletter%\dms\ServerInstaller\TSIU.log
Let>svrDataFile=%driveletter%\dms\ServerInstaller\ServerInstall.ini
Let>fileLoc=%driveletter%\dms\ServerInstaller\
// Read a string from the ini file
Let>iniFile=%driveletter%\dms\ServerInstaller\ServerInstall.ini

// get each part of the date separately
Day>the_day
Month>the_month
Year>the_year

// get each part of the time
Sec>Seconds
Min>Minutes
Hour>Hour

//--------- Make sure Pre-requisite files are present --------------------
// First make sure the log file doesn't exist, if so, delete it
IfFileExists>%logFileName%,DeleteLogFile
Goto>OpenLog
Label>DeleteLogFile
DeleteFile>%logFileName%

// Now create a log file
Label>OpenLog
// This code was created to open a log file and log messages throughtout the install
// example) 01-15-2003 12:53:20 3000 Macro completed successfully
// The log file format for date and time append to each line entry
Let>the_time=%Hour%:%Minutes%:%Seconds%
Let>logFileDate=%the_month%-%the_day%-%the_year% %the_time%

Label>FindFiles
// Check for the require files that store the X.400 Connectors information
// Check for ServerInstall.ini
IfFileExists>%svrDataFile%,Main
Goto>checkFileError
Label>checkFileError
Ask>The program cannot find the ServerInstall.ini file.%CRLF%Please verify the file exists in the following location: %svrDataFile%. %CRLF%Click Yes to proceed or NO to quit the program,continue
If>%continue%=NO,msg1,msg2
Label>msg1
MessageModal>Program was unable to complete.
WriteLn>%logFileName%,result,%logFileDate% 4999 The ServerInstall.ini file was not present to complete the install.
Goto>end
Label>msg2
Goto>FindFiles

//--------------- Main Part of the script ----------------------------------
Label>Main
// Write a message
WriteLn>%logFileName%,result,%logFileDate% 4000 Entering the script to create X.400 connectors
Gosub>FindExchSrvr
Wait>4
// This result lets us know when to end the loop
ReadIniFile>%iniFile%,X.400 Connectors,numberofx400Connectors,result
MessageModal>The number of connectors being created are: %result%
// Check to make sure there are connectors in this ini file
If>%result%readfile
Label>errorMsg
MessageModal>Unable to create connectors because numberofConnectors= %result% .%CRLF%You must specify at least one connector.
WriteLn>%logFileName%,result,%logFileDate% 4999 There numberofConnectors specified in the ServerInstall.ini file was set to 0.
Goto>end

Label>readfile
Let>k=0
Repeat>k
Let>connect=Connector
Let>i=k+1
//MessageModal>%i%
Concat>%connect%,%i%
WriteLn>%logFileName%,result,%logFileDate% 4000 Setup %connect% :

ReadIniFile>%iniFile%,%connect%,displayName,result1
WriteLn>%logFileName%,result,%logFileDate% 4000 display Name: %result1%
If>%result1%=,errormsg1,cont
Label>errormsg1
WriteLn>%logFileName%,result,%logFileDate% 4999 See the ServerInstall.ini file and check displayName=%result1%
MessageModal>Did not fill in the display name: %result1% in the ServerInstaller.ini file
Goto>end

Label>cont
ReadIniFile>%iniFile%,%connect%,directoryName,dirname
WriteLn>%logFileName%,result,%logFileDate% 4000 directoryName: %dirname%
If>%dirname%=,errormsg2,getmta
Label>errormsg2
WriteLn>%logFileName%,result,%logFileDate% 4999 See the ServerInstall.ini file and check directoryName=%dirname%
MessageModal>Did not fill in the directory name: %dirname% in the ServerInstaller.ini file
Goto>end

Label>getmta
ReadIniFile>%iniFile%,%connect%,remoteMTAName,result2
WriteLn>%logFileName%,result,%logFileDate% 4000 remoteMTAName: %result2%
If>%result2%=,errormsg3,getpasswd
Label>errormsg3
WriteLn>%logFileName%,result,%logFileDate% 4999 See the ServerInstall.ini file and check remoteMTAName=%result2%
MessageModal>Did not fill in the remote MTA name: %result2% in the ServerInstaller.ini file
Goto>end

Label>getpasswd
ReadIniFile>%iniFile%,%connect%,remoteMTAPassword,passwd
If>%passwd%=,errormsg,getIP
Label>errormsg
WriteLn>%logFileName%,result,%logFileDate% 4999 See the ServerInstall.ini file and check remoteMTAPassword=%passwd%
MessageModal>Did not fill in the remoteMTAPassword: %passwd% in the ServerInstaller.ini file
Goto>end

Label>getIP
// may not need this parameter
ReadIniFile>%iniFile%,%connect%,addressIsHostOrIP,result4
WriteLn>%logFileName%,result,%logFileDate% 4000 IP Address: %result4%

ReadIniFile>%iniFile%,%connect%,remoteAddress,result5
WriteLn>%logFileName%,result,%logFileDate% 4000 remoteAddress: %result5%

ReadIniFile>%iniFile%,%connect%,checkpointSize,result6
WriteLn>%logFileName%,result,%logFileDate% 4000 checkpointsize: %result6%

ReadIniFile>%iniFile%,%connect%,windowSize,result7
WriteLn>%logFileName%,result,%logFileDate% 4000 windowsize: %result7%

ReadIniFile>%iniFile%,%connect%,primaryMTA_Country,result8
WriteLn>%logFileName%,result,%logFileDate% 4000 MTA Country: %result8%

ReadIniFile>%iniFile%,%connect%,primaryMTA_ADMD,result9
WriteLn>%logFileName%,result,%logFileDate% 4000 MTA_ADMD: %result9%

ReadIniFile>%iniFile%,%connect%,primaryMTA_PRMD,res10
WriteLn>%logFileName%,result,%logFileDate% 4000 MTA_PRMD: %res10%

ReadIniFile>%iniFile%,%connect%,primaryMTA_Org,res11
WriteLn>%logFileName%,result,%logFileDate% 4000 MTA_Org: %res11%

ReadIniFile>%iniFile%,%connect%,primaryMTA_Unit,res12
WriteLn>%logFileName%,result,%logFileDate% 4000 MTA_Unit: %res12%

ReadIniFile>%iniFile%,%connect%,primaryMTA_Weight,res13
WriteLn>%logFileName%,result,%logFileDate% 4000 MTA_Weight: %res13%
Let>k=k+1
Wait>8
//go to fill tabs subrountines
Gosub>OpenPropertiesWindow
Gosub>FillGeneralTab
Gosub>FillStackTab

// repeat until k=result
Until>k,%result%

//--------------- End of Main ----------------------------------

//////////////// Subroutines Beginning /////////////////////////////////////////
SRT>FindExchSrvr
// Locate the exchange server's
WriteLn>%logFileName%,result,%logFileDate% 4000 Entering FindExchSrvr ....
WriteLn>%logFileName%,result,%logFileDate% 4000 Locate the exchange server location
RegistryReadKey>HKEY_LOCAL_MACHINE,Software\Microsoft\Exchange\Setup,Services,exchsrvrLoc
//MessageModal>%exchsrvrLoc% //Debug: displays drive letter of the exchange server
IfFileExists>%exchsrvrLoc%\bin\Admin.exe,StartExchange
WriteLn>%logFileName%,result,%logFileDate% 4000 Found exchange svr at: %exchsrvrLoc%\bin\

// add later: if file does not exists ask user to start up exchange server and maximize the windows

Label>StartExchange
// Start Exchange Server
Let>svrFileName=%exchsrvrLoc%\bin\Admin.exe

// suppress the windows error messages
// Let>RP_DISPLAYERROR=0
Run Program>%svrFileName%
WriteLn>%logFileName%,result,%logFileDate% 4000 Return value after launching server %RP_Result%
If>RP_Result>31,maxWin
WriteLn>%logFileName%,result,%logFileDate% 4999 Exchange Server did not launch correctly
Goto>end
Label>maxWin
WaitWindowOpen>Microsoft Exchange Administrator*
WaitReady>10
WindowAction>1,Microsoft Exchange Administrator*
WriteLn>%logFileName%,result,%logFileDate% 4000 Maximized exchange server window

WriteLn>%logFileName%,result,%logFileDate% 4000 Exiting FindExchSrvr ....
END>FindExchSrvr

SRT>OpenPropertiesWindow
// This subrountine will fill in each the General Tab's requirements
WriteLn>%logFileName%,result,%logFileDate% 4000 Entering OpenPropertiesWindow ....
//MessageModal>Entering FillTabs subroutine ....
// If find x.400 connectors line in the file then
// start reading the lines
SetFocus>Microsoft Exchange Administrator*
Press ALT
Send>fnx
Release ALT
// open the window
WaitWindowOpen>New X.400 Connector*
PushButton>New X.400 Connector,OK
//Press Enter //may need to add if PushButton does not work
WriteLn>%logFileName%,result,%logFileDate% 4000 Open X.400 Connector window

// there maybe a pop-up window, click OK to this window
IfWindowOpen>Microsoft Exchange Administrator*,clickOK1
Goto>Done
Label>clickOK1
PushButton>Microsoft Exchange Administrator*,OK
// Now read the data from the ServerInstall.ini fill to fill in the required information
Label>Done
WaitWindowOpen>Properties*
WriteLn>%logFileName%,result,%logFileDate% 4000 Exiting OpenPropertiesWindow ....
END>OpenPropertiesWindow

SRT>FillGeneralTab
// Fill in Display name field
Send>%result1%
Wait>2
// Fill in directory name field
Press Tab
Send>%dirname%
Wait>2
// Fill in RemoteMTA name field
//Press ALT
//Send>m
Press Tab
Send>%result2%
Wait>2
// Fill in Remote MTA password - used default "password"
//Press ALT
//Send>p
Press Tab
Send>%passwd%
END>FillGeneralTab

SRT>FillStackTab
**BREAKPOINT**
Wait>8
Press LCTRL
Press Tab*3
Release LCTRL
Wait>6
// select IP address radio button
SetFocus>Properties*
Wait>10
MessageModal>pressing alt key...
Press ALT
Wait>4
MessageModal>pressing i key ...
Send>I
Release ALT
// input the IP address number
Goto>end
Wait>2
Press Tab
Send>%result5%
Wait>2
// Fill in the Outgoing OSI address information
Press Tab
Send>A300
Wait>2
Press Tab
Send>A200
Wait>2
Press Tab
Send>A100
Wait>2
// Fill in the Outgoing OSI address information
Press Tab
Send>A300
Wait>2
Press Tab
Send>A200
Wait>2
Press Tab
Send>A100
END>FillStackTab
//////////////// Subroutines End /////////////////////////////////////////

//////////////////// Labels here /////////////////////////////////////////

Label>end


Kina

User avatar
support
Automation Wizard
Posts: 1450
Joined: Sat Oct 19, 2002 4:38 pm
Location: London
Contact:

Post by support » Tue Aug 19, 2003 1:45 pm

Hi,

There is one obvious difference. In the small bit of code that you say works you send a lower case 'i'. In the code that doesn't work you send an upper case 'I'.

I always send lower case chars to make sure the key gets sent correctly. Try changing the upper case I to a lower case i and see if that works.
MJT Net Support
[email protected]

ksimmons
Newbie
Posts: 6
Joined: Wed Aug 06, 2003 9:37 pm
Location: Lockheed Martin

pressing alt key

Post by ksimmons » Tue Aug 19, 2003 2:05 pm

I did what you said by sending a lower case " i " and this still does not work. Do you have any other suggestions?

Kina :cry:

Lumumba

Post by Lumumba » Tue Aug 19, 2003 2:07 pm

As options available on a properties dialog often have an equivalent in the registry, how about configuring it directly with RegistryWriteKey> ?

Of cause you've to identify which seetings belongs to which key, but it looks like worth it! Total Uninstall 2.30 could make it a 'lill easier ...

This free utility tracks all changes (including the registry) made on your system [great when installing/check any new software, driver, and security patch].

"... The program will then create a snapshot of your system before it installs the new software and an additional snapshot after install completes. it then compares the two snapshots and displays all changes in a nice, graphical tree view, marking all values and/or files that have been added or changed as well as some before/after details. ..."

Download

User avatar
support
Automation Wizard
Posts: 1450
Joined: Sat Oct 19, 2002 4:38 pm
Location: London
Contact:

Post by support » Tue Aug 19, 2003 2:07 pm

Hi,

I have just realised what the problem is. You have a messagemodal command just after setting focus to the window that should get the ALT-key combination. Clearly this will take focus away from the correct screen (giving focus to Macro Scheduler). You should remove the MessageModal or at least put SetFocus>Properties* before the Press ALT. Also make the I lower case.

SetFocus>Properties*
Wait>10
MessageModal>pressing alt key...
Press ALT
Wait>4
MessageModal>pressing i key ...
Send>I
Release ALT
MJT Net Support
[email protected]

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts