Rocket Software Homepage
Forum Home Forum Home > AccuTerm Knowledge Base (read only) > Scripting & Automation
  New Posts New Posts RSS Feed - Cloning the active session
  FAQ FAQ  Forum Search   Register Register  Login Login

The AccuTerm forum has moved. Go to community.rocketsoftware.com to register for the new Rocket forum.

Forum LockedCloning the active session

 Post Reply Post Reply
Author
Message
anonymous View Drop Down
Groupie
Groupie


Joined: January 15 2004
Location: United States
Status: Offline
Points: 46
Post Options Post Options   Thanks (0) Thanks(0)   Quote anonymous Quote  Post ReplyReply Direct Link To This Post Topic: Cloning the active session
    Posted: April 05 2006 at 4:42am
Is it possible to create a toolbar button to open a new session with the same settings as the current session?
Back to Top
PSchellenbach View Drop Down
Admin Group
Admin Group

Moderator

Joined: December 15 2003
Location: United States
Status: Offline
Points: 2150
Post Options Post Options   Thanks (0) Thanks(0)   Quote PSchellenbach Quote  Post ReplyReply Direct Link To This Post Posted: April 05 2006 at 4:49am
Hi -

You can create a script to clone the current session, then run that script when a toolbar button is pressed. First create the following script and save it in the ...\Program Files\Atwin folder as "clone-session.atsc":

Sub Main()
Dim fn As String
On Error Resume Next
If Sessions.Count > 0 Then
fn = ActiveSession.FileName
If fn <> "" Then
   Sessions.Add fn
End If
End If
End Sub

This script checks if there is a session already open, then retrieves the file name of the active session and uses it as the file name argument of the Add function of the Sessions object.

Next, use the menu designer to add a button to the toolbar: Tools->Customize Menu, then choose the menu scope (user or application would seem appropriate), then expand the Toolbar node in the tree, select the Toolbar node, and click the New button and select Normal. In the new button's Action field, enter:

[chain "clone-session.atsc"]

Choose an icon for the new button and click OK to save the customized toolbar.

Thanks,

Pete
Back to Top
Ima.Geek View Drop Down
Newbie
Newbie


Joined: August 16 2006
Location: United States
Status: Offline
Points: 5
Post Options Post Options   Thanks (0) Thanks(0)   Quote Ima.Geek Quote  Post ReplyReply Direct Link To This Post Posted: August 16 2006 at 8:03am
This method does indeed clone the ATCF file session, but not the ATSC file session.  Is there a way to make a new session based on the current ATSC file?
Back to Top
Ima.Geek View Drop Down
Newbie
Newbie


Joined: August 16 2006
Location: United States
Status: Offline
Points: 5
Post Options Post Options   Thanks (0) Thanks(0)   Quote Ima.Geek Quote  Post ReplyReply Direct Link To This Post Posted: August 16 2006 at 8:08am
Phrased another way...

How can one create a new toolbar button that will detect which .ATSC file is currently in use and open a new session using that .ATSC file?
Back to Top
PSchellenbach View Drop Down
Admin Group
Admin Group

Moderator

Joined: December 15 2003
Location: United States
Status: Offline
Points: 2150
Post Options Post Options   Thanks (0) Thanks(0)   Quote PSchellenbach Quote  Post ReplyReply Direct Link To This Post Posted: August 16 2006 at 11:15am
Hi ImaGeek -

I presume you are using a script (.atsc) file to open a session and log in automatically? When you start AccuTerm using a script file, the script is loaded into the script editor (Tools->Script) and Sub Main is automatically executed. So, to rerun the script, all you need to do is run Sub Main again. Scripts loaded in the script editor window are "shared scripts" and any public Subs and Functions are available to any other script. So all you need to do to run Sub Main of the script in the script editor is do Call Main(). So your toolbar button needs
[Call Main()]

There's no easy way to detect if there is a script loaded, and whether the loaded script will do what you want, but if you know things are set up correctly, this should work fine.

Thanks,

Pete
Back to Top
Ima.Geek View Drop Down
Newbie
Newbie


Joined: August 16 2006
Location: United States
Status: Offline
Points: 5
Post Options Post Options   Thanks (0) Thanks(0)   Quote Ima.Geek Quote  Post ReplyReply Direct Link To This Post Posted: August 17 2006 at 12:19am
Too easy..  MUCH APPRECIATED!

Thanks..   :)
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.03
Copyright ©2001-2019 Web Wiz Ltd.