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!

setting remote output to a variable

Status
Not open for further replies.

cougarconvt

Programmer
Oct 30, 2009
3
US
I have specific config files on my server for each system i'm connecting too and I'm trying to automate a process that pulls the specific file for that system when a user requests it while connected to said machine. It's a unix machine and I have a variable set with the information I need (i.e. IPCFG=127.0.0.1) and a corresponding file on the server that I want to download (127.0.0.1.txt) what i'm trying to do is somehow assign the IPCFG variable on the machine to a variable within the aspect script so I can specify which file to download, I know this can be done by just putting up a box and asking the user to enter the ip number for the machine they're connected to, but to avoid user error I'd like to just get it from the machine itself.
 
This is for other users and not just yourself, so this information needs to come from the machine itself and not your local Connection Directory entries, correct?

If you can run a separate script before launching your current script, this may be possible using Procomm's remote script feature. I've copied some information below from my website, but I don't have access to a Unix machine nowadays to do any further digging. My thinking is such an idea could be used to place the value of the IPCFG variable in one of Procomm's predefined string variables (s0 through s9), then have the second script read that value.

After seeing a post from J Dan Skinner on the Symantec support forum, I did a little more research into remote script commands in the context of a Unix shell script echoing the necessary commands to Procomm Plus. First, here is a sample to look at:
#!/bin/sh
echo "\004test"
echo "string dl"
echo "fetch dnldpath dl"
echo "usermsg dl"
echo "usermsg \$ASPECTPATH"
echo "run \c"
echo "\"C:\\Program Files\\Symantec\\Procomm Plus\\Programs\c"
echo "\\pwedit.exe\""
echo "\004"

\004 indicates the beginning or end of the remote script commands. \004test tells Procomm Plus to begin the remote script process, with test being the corresponding remote script password (select the Options | System Options | System Options menu item to set this). The remainder of the shell script is mostly self-explanatory, but there are a couple things to keep in mind when operating in a Unix environment. First, some characters need to be escaped with a backslash, such as the $ in the $ASPECTPATH environment variable or a double-quote in a string (such as in line 8). This also means you need to use two backslashes to echo one backslash, as seen in lines 8 and 9. Finally, you can use \c to have the shell script not send the newline character that usually follows an echo command. This can allow you to concatenate the output of several echo commands in the shell script into one ASPECT command line.

 
I may not have explained the issue at hand, the user (A) is already connected to the remote machine(52) via procomm, the script used to connect to (52) has run and that variable is gone, the user then finds an issue and needs to download the machine config file to (52), what I'd like to do is avoid having the user type in (52) again when they request the file in the script, so the sequence of events is like this

user A connects to (52) via procomm
user A needs to download a file named 52.txt from the server

I am trying to create a script that wouldn't require any further input from the user, they would basically hit a button and the corresponding file for the machine they are connected to would be downloaded from the server. So everything needs to be done from within the procomm environment.

My question I guess would be I have a script the user enters the machine number in to when they first connect to the machine, but the script exits once they are connected, is there a variable that can be held for the entire session for multiple wax files to reference? That would probably be the easiest way to get it done, I'm just not sure that's possible.

 
If the user has connected from an entry in the Connection Directory and are still connected (original script can be finished executing), then you could use the $DIALCONNECT system variable to get the name of the Connection Directory entry that was dialed. Does that get you what you need?

Another option would be to have each of your scripts (I'm assuming there is a different one for each entry to dial) can place the necessary value in one of Procomm's predefined string variables (s0 through s9), which hold their value across script executions as long as Procomm remains running.

 
I didn't realize the predefined string variables held their values during the entire session, that's exactly what I needed, everything is working. Thank you, I really appreciate your help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top