Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Attachmate IF Statement for beginner 2

Status
Not open for further replies.

NWildblood

Technical User
Nov 12, 2007
113
GB
Hi, help I'm a complete Attachmate basic beginner, I want to code this:

If I get the following message,

TW007 - Required by Date less than End Date; Confirm Y/N

- what IF... code do I need for 'y' and 'enter' ???

(Message location on screen = 24,1,56)

Thanks for any assistance !
 
Is this error message one you coded? If so, did you do it with a message box or dialog box? With a msgbox, you would code it (more or less) in the following way, possibly making a few syntax changes before this works [smile]

Code:
dim rc as integer
rc=msgbox("TW007 - Required by Date less than End Date; Confirm Y/N",4)
if rc=6 then
   'this is where you handle if they click yes
end if

[blue]When birds fly in the correct formation, they need only exert half the effort. Even in nature, teamwork results in collective laziness.[/blue]
 
Code:
Declare Sub Wait()

GLOBAL Sys as Object
GLOBAL Sess as Object

Sub Main()
   Dim i_cols As Integer, msg_line As String

   Set Sys = CreateObject("Extra.System")

   If Sys Is Nothing Then
      MsgBox ("Could not create Extra.System...is E!PC installed on this machine?")
      Exit Sub
   End If

   Set Sess = Sys.ActiveSession

   If Sess Is Nothing Then
      MsgBox ("No session available...stopping macro playback.")
      Exit Sub
   End If

   i_cols = Sess.Screen.Cols   
   msg_line = Trim(Sess.Screen.GetString(24, 1, i_cols))
   
   If InStr(1, UCase(msg_line), UCase("TW007 - Required by Date less than End Date")) > 0 Then
      Sess.Screen.PutString "y", 24, 62  ' location of "y"
      Sess.Screen.SendKeys ("<Enter>")      
      Wait
   End If

   Set Sess = Nothing
   Set Sys = Nothing
End Sub

Sub Wait()
   Do While Sess.Screen.OIA.Xstatus <> 0
      DoEvents
   Loop
End Sub
 
Thank you both very much
- pinkgecko, no it's already coded in, but thanks anyway
- WinblowsME, loving your work !
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top