×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

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!
  • Students Click Here

*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

How to close session without messagebox??

How to close session without messagebox??

How to close session without messagebox??

(OP)
I am opening a session and downloading files, and I simply want to close the session and the instance of Extra without anyone having to click "Yes" on a messagebox.  The only way I could find to close the session is as follows:
---------------
QuitAllSessions.ebm
---------------
Sub Main

    Pause(2) 'make sure previous macro has finished
    
    dim system as object       
    
    set system = CreateObject("Extra.System")
    if (system is nothing) then
        msg = "CreateObject(""Extra.System"") failed." + chr(13)
        msg = msg + "Try uninstalling, then reinstalling EXTRA! Personal Client."
        msgbox msg
        exit sub
    end if
    
    system.quit
End Sub
----------------
----------------

I use this code to call QuitAllSessions.ebm:
----------------
----------------
ret = session.WaitForDisconnect(99999999999)
rc = shell("ebrun quitallsessions.ebm")
----------------
----------------

The code works fine but it pops up an "Are you sure.." Yes/No messagebox.  Can this be done without the messagebox being displayed??

Thanks!!

RE: How to close session without messagebox??




Hi,

Here's how I close my session from Excel VBA...

CODE

Public oSystem As ExtraSystem
Public oSess As ExtraSession
Public oScrn As ExtraScreen

Sub CloseIMS_Session()
    oSess.Close

    Shell "tskill EXTRA"

    Set oScrn = Nothing
    Set oSess = Nothing
    Set oSystem = Nothing
End Sub

Skip,

glassesJust traded in my old subtlety...
for a NUANCE!tongue

RE: How to close session without messagebox??

(OP)
Thanks but I'm trying to do it from an Extra! Basic macro instead of using VBA.

RE: How to close session without messagebox??

from the help files

CODE

Sub Main()
    Dim Sys As Object
    Set Sys = CreateObject("EXTRA.System")
' Assumes one or more open sessions
    Sys.Sessions.CloseAll
End Sub
or

CODE

This example closes the active session.

Sub Main()
    Dim Sys As Object, Sess As Object
    Set Sys = CreateObject("EXTRA.System")
' Assumes an open session
    Set Sess = Sys.ActiveSession
    MsgBox "Press to close session."
    Sess.Close
End Sub

RE: How to close session without messagebox??

I know this is an old thread but couldn't he just turn off the prompts under Options | Global Preferences so that the MsgBox doesn't come up?

RE: How to close session without messagebox??

(OP)
Thank you, thank you boatbum!  I dug all around in the settings, can't believe I missed that!

RE: How to close session without messagebox??

I just use this and it works fine.

Sub Main()
    Sendkeys "%F{up}+{Enter 2}"    
End Sub

RE: How to close session without messagebox??

i know, i know, old thread......
Skip, the TSKILL probably works fine for your purposes but others need to be aware of what the TSKILL is really doing behind the scenes.  The tskill on Extra will kill all extra processes, whether they are 'in scope' of your application or not.

In my environment, users may be using an extra session which is not being used for automation so the tskill would close their session on them, even though that session really has nothing to do with the macro thats closing it.  When our macros close sessions, the dialog box is not displayed and I found the best method is to disable the option via the settings as boatbum cleverly suggested.

On another side note, it would probably be in a coders best interest to reference the session being used by the macro specifically rather than with the activeSession.  Doing this will allow your macro to interact with more than one session if necessary.  if you have any questions about how to do this, let me know and i would be more than happy to provide code
  

RE: How to close session without messagebox??




Yes, in my environment, one can only have ONE session open.  So that's a good point!

Skip,

glassesJust traded in my old subtlety...
for a NUANCE!tongue

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