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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to close session without messagebox??

Status
Not open for further replies.

phbrady

Programmer
Oct 17, 2003
41
US
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!!
 



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,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
Thanks but I'm trying to do it from an Extra! Basic macro instead of using VBA.
 
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
 
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?
 
Thank you, thank you boatbum! I dug all around in the settings, can't believe I missed that!
 
I just use this and it works fine.

Sub Main()
Sendkeys "%F{up}+{Enter 2}"
End Sub
 
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
 



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

Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top