×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Methods and keys in E!B

Methods and keys in E!B

Methods and keys in E!B

(OP)
Hello, I was wondering if there was a way to wait for certain keys to be pressed while the macro is running. For example, while the macro is running, is it possible to wait for a key to be pressed, so i could exit macro, mid-run? Also, i would like to know if i can wait for two different keys at once, i have tried something, but it didnt work as well as i wanted, this is what i tried

CODE

While (K <> " " and K <> "`")
       K = Sess0.Screen.WaitForKeys()
            If (K <> " " and K <> "`") Then
                'nothing goes here, but this way of testing only works if i put in this if statement
            End If
WEnd
MsgBox F

RE: Methods and keys in E!B

(OP)
Oh, and also i wanted to know if there was a way to make methods in E!B, and how to use them with parameters.

RE: Methods and keys in E!B

Try

CODE

   Do
      K = Sess.Screen.WaitForKeys()
   Loop While (K <> " " and K <> "`")
   
   Msgbox K
   
   Exit Sub ' exits macro
   
   Do While(1)   
   Loop

Functions and Subs

CODE

Declare Function Session_Open(ByRef message as String) As Integer  ' Function Prototype
Declare Sub Wait()                                                 ' Sub Prototype
Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)    ' Sleep API

GLOBAL Sys as Object
GLOBAL Sess as Object

Sub Main
   Dim message as String
   
   If Session_Open (message) <> 1 Then
      Msgbox message
      Exit Sub
   End If
End Sub

' Function Declaration

Function Session_Open(ByRef message As String) As Integer
   Dim sess_open As Integer

   sess_open = 1

   Set Sys = CreateObject("Extra.System")
   Set Sess = Sys.ActiveSession

   If Sys Is Nothing Then
      message = "Could not create Extra.System...is E!PC installed on this machine?"
      sess_open = 0
   End If

   If Sess Is Nothing Then
      message = "No session available...stopping macro playback."
      sess_open = 0
   End If

   Session_Open = sess_open
End Function

' Sub Declaration

Sub Wait()
   Do While Sess.Screen.OIA.Xstatus <> 0
      DoEvents
   Loop
End Sub

Note, if you declare your subs and functions before Sub Main, you don't need the prototypes.

RE: Methods and keys in E!B

(OP)
Thank you so much.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close