Rocket Software Homepage
Forum Home Forum Home > AccuTerm Knowledge Base (read only) > Scripting & Automation
  New Posts New Posts RSS Feed - script
  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 Lockedscript

 Post Reply Post Reply
Author
Message
Martin View Drop Down
Newbie
Newbie


Joined: March 24 2004
Status: Offline
Points: 6
Post Options Post Options   Thanks (0) Thanks(0)   Quote Martin Quote  Post ReplyReply Direct Link To This Post Topic: script
    Posted: March 24 2004 at 11:33am
Hello, my question is in regards to automizing a proc using a script. I'm not sure how to write the script, I do have a little bit of understanding of VB. Could someone tell me how to write a script so that I can automize a proc. The proc is called "Gifted". I have Accuterm97
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: March 25 2004 at 5:21am
Hi Martin -

You can use a script to automate a proc by using the Session Output and WaitFor functions. Use the built-in ActiveSession variable to automate the currently active session. To send data to the host, as if the operator typed at the keyboard, use the Output method. For example, if the session is at TCL, you can invoke the proc by using:

ActiveSession.Output "Gifted" & Chr$(13)

The Chr$(13) is the ASCII code for Carriage Return. If you need to wait for a message from the proc before responding to another prompt, use the WaitFor function. For example, if the proc requires a date, and prompts for the date by displaying "Enter Date:", you could wait for this prompt by using:

If ActiveSession.WaitFor(1,10,"Enter Date:") Then ...

Then send the date to the proc using .Output as shown above.

If you are using WaitFor, you must set ActiveSession.InputMode = 1 when you begin the script, and reset it back to 0 before the script terminates. This prevents a competition for data sent by the host between the screen and the script, and makes the screen wait until the script examines the data first.

Thanks,

Peter
Back to Top
Martin View Drop Down
Newbie
Newbie


Joined: March 24 2004
Status: Offline
Points: 6
Post Options Post Options   Thanks (0) Thanks(0)   Quote Martin Quote  Post ReplyReply Direct Link To This Post Posted: March 25 2004 at 5:35am
Peter,
Thanks for the tip! Is it also possible to write a script to capture my proc as a text file? For example I want to be able to send this proc out as a text file and dump it somewhere in the C:\ drive. If I can do this then I am set.
Your help is appreciated.
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: March 25 2004 at 5:44am
Hi Martin -

Do you want to capture the output that is generated by executing the proc, or do you want to copy the proc itself to a text file?

Thanks,

Peter
Back to Top
Martin View Drop Down
Newbie
Newbie


Joined: March 24 2004
Status: Offline
Points: 6
Post Options Post Options   Thanks (0) Thanks(0)   Quote Martin Quote  Post ReplyReply Direct Link To This Post Posted: March 25 2004 at 6:31am
Peter,
Yes, I would like to capture the output based upon the proc itself if possible.

Thanks,
Martin
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: March 25 2004 at 8:40am
Hi Martin -

Before sending the final response to the proc (or before exeuting the proc if there are no other responses) turn on capture:

ActiveSesison.Capture "c:\stuff.txt", 1, 1

when the proc is done sending data, turn off capture:

ActiveSession.CaptureEnd

You might need to spin in a loop waiting for output to complete. This might be a little tricky with AccuTerm 97. In AccuTerm 2K2 you can periodically check the value of ActiveSession.BytesIn property and see if any more data has been received.

Thanks,

Pete
Back to Top
Martin View Drop Down
Newbie
Newbie


Joined: March 24 2004
Status: Offline
Points: 6
Post Options Post Options   Thanks (0) Thanks(0)   Quote Martin Quote  Post ReplyReply Direct Link To This Post Posted: March 25 2004 at 8:46am
Peter,
Your help has been great!
Back to Top
Martin View Drop Down
Newbie
Newbie


Joined: March 24 2004
Status: Offline
Points: 6
Post Options Post Options   Thanks (0) Thanks(0)   Quote Martin Quote  Post ReplyReply Direct Link To This Post Posted: March 26 2004 at 4:50am
Pete,
Is there a way I can get MS Access2K to run a saved Accuterm97 script. Previously I was able to save a batch file on my C:\ drive and then in Access I was able to use the Shell command to run the batch file when I clicked on a command button. Can I do the same for an Accuterm script 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: April 01 2004 at 1:02pm
Hi Martin -

Its time to upgrade to AccuTerm 2K2! With AccuTerm 2K2 (and 2000), the script files have thier own extension (.atsc) which is associated with the AccuTerm application. You can create a shortcut to a script file which will launch AccuTerm then execute the script. No reason you could not initiate this from the Shell command in Access.

Thanks,

Pete
Back to Top
Martin View Drop Down
Newbie
Newbie


Joined: March 24 2004
Status: Offline
Points: 6
Post Options Post Options   Thanks (0) Thanks(0)   Quote Martin Quote  Post ReplyReply Direct Link To This Post Posted: April 09 2004 at 3:49am
Pete,
I saved my script file to my C:\drive, I have Accuterm open, but when I click on the saved script file it gives me the following message.

C:\Program Files\Atwin\ScriptTest.SCR is not a valid Win32 application.

Could I get around this in Accuterm97?
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 09 2004 at 4:45am
Sorry - AccuTerm 97 does not understand file associations.
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.