Rocket Software Homepage
Forum Home Forum Home > AccuTerm Knowledge Base (read only) > Scripting & Automation
  New Posts New Posts RSS Feed - Can BASIC program interact with 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 LockedCan BASIC program interact with script?

 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: Can BASIC program interact with script?
    Posted: February 24 2004 at 7:19am
Can a BASIC program on the host interact with an AccuTerm script to the extent of passing data back and forth? I'm not asking for a detailed set of instructions! But if you can point me to the best place to start in the docs, I would be appreciative. Overall application is to pass data from REALITY to a windows program's api, and then retrieve the 'answer' from same.
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: February 24 2004 at 7:31am
Yes. You can build the script itself in the BASIC program as a long string, and then simply PRINT the string to launch the script. Do not include the Sub Main and End Sub lines, but everything inbetween. Separate multiple script lines with CHAR(25).

To pass data to a script you build in the BASIC program simply assign it to a script variable. For example, to display a message using the MsgBox function, and return the button clicked use:

MSG = 'Do you want to proceed?'
SCRIPT = ''
SCRIPT = SCRIPT : 'X = "' : MSG : '"' : CHAR(25)
SCRIPT = SCRIPT : 'Y = MsgBox(X, vbOkCancel)' : CHAR(25)
SCRIPT = SCRIPT : 'InitSession.Output CStr(Y) & Chr$(13)'
PRINT CHAR(27) : CHAR(2) : 'P' : SCRIPT : CHAR(13) :
INPUT RESPONSE

This sample assigns to the script variable X the value of the host variable MSG, enclosed in double-quote marks. Then the result of the MsgBox function is assigned to script variable Y. Finally, the result variable Y is sent to the host using the Session.Output method, followed by a CR. The result is picked up the the host program and stored in the host variable RESPONSE using the INPUT statement.

You could dress this up a little by using PROMPT '' and ECHO OFF before the INPUT.

      
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.