Smart questions
Smart answers
Smart people
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Tek-Tips
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

LINK TO THIS FORUM!

Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

Partner With Us!

"Best Of Breed" Forums Add Stickiness To Your Site
Partner Button
(Download This Button Today!)

Feedback

"...The forum looks great! You guys have done a fantastic job on arranging things there...Your site is very precise and fun to visit..."

Geography

Where in the world do Tek-Tips members come from?
foleys (TechnicalUser)
28 Jun 08 6:55
I am trying to install a script that calls 3 text files up. I have stored the files in the aspect folder of procomm, but the script fails when it gets to the point of calling the file.

Can anyone see where i am going wrong.

proc main

string tn
string mem
string des

if fopen 0 "tn.txt" read
if fopen 1 "mem.txt" read
if fopen 2 "des.txt" read
while not feof 0
fgets 0 tn  
fgets 1 mem
fgets 2 des   

   transmit "new^M"
   waitfor "TYPE "
   transmit "did^M"
   waitfor "TN  "
   transmit tn
   waitfor "DES  "
   transmit des
   waitfor "PDCA "
   transmit "2^M"
   waitfor "PCML "
   transmit "a^M"
   waitfor "cust"
   transmit "o^m"
   waitfor "NCOS "
   transmit "7^M"
   waitfor "RTMB "
   transmit "0 "
   transmit mem
   waitfor "NITE "
   transmit "^M"
   waitfor "AST  "
   transmit "^M"
   waitfor "CLS  "
   transmit "unr dtn^M"
   waitfor "TKID "
   transmit "^M"
   waitfor "req"
   pause 2
endwhile
else
endif
endif
endif
endproc
knob (Programmer)
30 Jun 08 4:04
Are you receiving an error message of some sort?  You might also try adding the TEXT keyword to the end of the three fopen commands as it will strip out carriage returns and linefeeds from the line read from the text files.

http://www.aspectscripting.com

geirendre (Vendor)
30 Jun 08 11:35
But then you need to replace a line like

CODE

transmit des
with

CODE

transmit des
transmit "^M"
I prefere using DDE to read such info from a excel-file
and using it as input to the script.
Spreadsheets are much easyer to create and edit.
But thats my personal oppinion winky smile

Check the help-function for examples on DDE usage.

HTH
 
foleys (TechnicalUser)
30 Jun 08 15:23
thanks I will give it a try
johnpoole (Programmer)
7 Jul 08 12:09
late reply, i have had better results using a delimnited file then handling x numbers of files

CODE

proc main

   string sline, tn,key0,cpnd,key1,key2

   fopen 0 "3904.txt" READ               ;Open our data file
   while not feof 0                       ;While the file still has data
      fgets 0 sLine                       ;Read a line of data
      strtok tn sLine "`t" 1          ;Get the first field
      strtok key0 sLine "`t" 1          ;Get the second field
      strtok cpnd sLine "`t" 1          ;Get the third field
      strtok key1 sLine "`t" 1          ;Get the fourth field
      strtok key2 sLine "`t" 1          ;Get the fifth field
     ; strtok sTemp3 sLine "`t" 1          ;Get the sixth field
  
  set txpace 30
  waitfor "req:"
   transmit "new^M"
  waitfor "type"
   transmit "3904^M"
  waitfor "tn  "
   transmit tn
   transmit "^M"
  waitfor "des"
   transmit "xxxx^M"
  waitfor "CUST"
   transmit "0^M"
  waitfor "KBA"
   transmit "^M"
  waitfor "dba"
   transmit "^M"
 waitfor "fdn"
   transmit "xxxxx^M"
 waitfor "tgar"
   transmit "^M"
 waitfor "ldn"
   transmit "^M"
 waitfor "ncos"
   transmit "5^M"
 waitfor "rnpg"
   transmit "^M"
 waitfor "ssu"
   transmit "^M"
 waitfor "xlst"
   transmit "^M"
 waitfor "sgrp"
   transmit "^M"
 waitfor "cls"
   transmit "LNA FNA HTA HFA MWA CNDA DNDA CFXA FTTU AHA^M"
 waitfor "rco"
   transmit "^M"
 waitfor "hunt"
   transmit "xxxxx^M"
 waitfor "lhk"
   transmit "0^M"
 waitfor "lnrs"
   transmit "^M"
 waitfor "sci"
   transmit "^M"
 waitfor "plev"
   transmit "^M"
 waitfor "ast"
   transmit "^M"
 waitfor "iapg"
   transmit "^M"
 waitfor "mlwu_lang"
   transmit "^M"
 waitfor "mlng"
   transmit "^M"
 waitfor "dndr"
   transmit "^M"
 waitfor "key  "
   transmit key0
   transmit "^M"
 waitfor "marp"
   transmit "^M"
 waitfor "cpnd"
   transmit "new^M"
 waitfor "name  "
   transmit cpnd
   transmit "^M"
 waitfor "vmb"
   transmit "^M"
 waitfor "key  "
   transmit key1
   transmit "^M"
 waitfor "marp"
   transmit "^M"
 waitfor "cpnd"
   transmit "^M"
 waitfor "vmb"
   transmit "^M"
 waitfor "key  "
   transmit key2
   transmit "^M"
 waitfor "marp"
   transmit "^M"
 waitfor "cpnd"
   transmit "^M"
 waitfor "vmb"
   transmit "^M"
 waitfor "key"
   transmit "3 adl^M"
 waitfor "key"
   transmit "4 adl^M"
 waitfor "key"
   transmit "5 adl^M"
 waitfor "key"
   transmit "6 csd^M"
 waitfor "key"
   transmit "7 adl^M"
 waitfor "key"
   transmit "8 adl^M"
 waitfor "key"
   transmit "9 adl^M"
 waitfor "key"
   transmit "10 adl^M"
 waitfor "key"
   transmit "11 adl^M"
 waitfor "key"
   transmit "16 mwk xxxxx^M"
 waitfor "key"
   transmit "24 nul^M"
 waitfor "key"
   transmit "25 nul^M"
 waitfor "key"
   transmit "26 nul^M"
   
  
   endwhile
   
   fclose 0

   
endproc


and you can look at compile options to open the debugger.. that tells you what line the file dies on.. even if it just freezes, when you stop it, you get a pop up to see what it was waiting for..   

john poole
bellsouth business
columbia,sc

foleys (TechnicalUser)
11 Jul 08 2:38
Thanks again I will have a go with this.
kxboy (TechnicalUser)
11 Jul 08 10:53
When I have a script that needs a lot of carrage returns, I often define a macro for the "transmit "^M" command

Like this

#DEFINE CR transmit "^M"

Then, for every line that you have transmit "^M", just use "CR".

This will also work with a line like this

transmit "10 adl"
CR

This saves the effort of entering transmit "^M" a bunch of times. Also, for me I find that I make fewer errors, as I don't forget the "^M" at the end of a transmit command

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Back To Forum

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close