Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Problem invoking pcAnywhere (DOS)
Message
From
09/12/2002 10:14:14
 
 
To
09/12/2002 09:41:53
Henry Ravichander
RC Management Systems Inc.
Saskatchewan, Canada
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00730525
Message ID:
00730878
Views:
7
Note that the scripts and batch files are different for EACH version of pcAnywhere. For example, we had different scripts when the remote was pcAnywhere 4.5 and the Host was pcAnywhere 5.0, etc. The below examples are EXACT copies (minus confidential information of course) that worked for YEARS on live systems. We had 3 hosts and 28 remotes that downloaded and uploaded files DAILY successfully using this script on government systems (until we switched from pcanywhere to secure data transfer).

Remember, that first it is KEY that the host entry be setup correctly ON THE REMOTE in pcanywhere 5.0, the modem be configured and a modem entry setup on the remote in pcanywhere 5.0 correctly, and the remote must have an authorized entry on the HOST system in pcanywhere 5.0 ALSO. You must be able to manually call the host from the remote and download the file in pcanywhere 5.0 BEFORE you test a script to automate it.

Here is the batch file that invokes pcAnywhere 5.0 remote to call a pcAnywhere 5.0 host:

(The script file called from this batch file is actdnld5.scr)
@echo off
rem **********************************************************************
rem *  This batch file runs the correct PC Anywhere program switches
rem *  for PCAnywhere DOS Version 5.0 at the Activity and Version 5.0 at
rem *  the host.  It automatically runs PCAnywhere and initiates the
rem *  the actdnld5.scx script which downloads a payroll file to the remote
rem **********************************************************************
rem
rem
rem
c:\aw50\aw /O:S /M:S /N:actdnld5
Below is the actdnld5.scr script file that downloads a payroll file. Some overview: the host system is configured in PCAnywhere for DOS on the REMOTE as 'LCCS' and includes the telephone number, and the required pcanywhere login and passwords in it. The modem on the remote system is configured on COM2 and Hayes Compatible. The host system is also a Novell server, so Novell login is required. You can remove that portion to suit your needs. The script downloads a single file from the host to the remote and notifies the user if errors occur.
;************************************************************************
; SYSTEM:        Electronic Data Interchange Script
; AUTHOR:        Tracy C. Holzer
; DATE:          26 JUNE 1995
; LAST MODIFIED: 15 JULY 1998
;************************************************************************
;                     Variable Declaration  
  string  Login[79]                       ; String for HOST Novell Login
  string  NOVELLPASS[79]                  ; String for HOST Novell PassWord
  string  HostDrive[2]                    ; Download drive location on HOST
  string  HostDownLoad[79]                ; Download path location on HOST
;-------------------  Parameters to Change --------------------------------
; NOTE: All variables below MUST BE INCLOSED IN QUOTES EXCEPT THE PORTNUM
;       variable -- it is NUMERIC and MUST BE WITHOUT QUOTES!
; ****************  
  Login = "yourlogin"                     ; Replace with your Novell login on host
  NOVELLPASS = "yourpassword"             ; Replace with your Novell password on host
  PortNum = 2                             ; Replace with the Comm port your Modem uses
  HostDrive = "Y:"                        ; Replace with drive letter on host system drive
; *****************
;==========================================================================
;                               MAIN ROUTINE
;==========================================================================

@begin:                                 ; Main dailup routine
  set attribute 44
  clear screen                          ; begin with clear screen with attributes
  set attribute 37
  set attribute 1
  set echo off                          ; don't echo messages to screen
  clear screen
  LET $ERROR=0                          ; Set error variable to no errors (0)
  LET $RESULT=0                         ; Command result variable set to 0
  set ignorecase on                     ; do not force uppercase letters
  on error goto @error                  ; error trapping routine

  set cancel on
  on cancel goto @cancel

  cursor position 5 33
  set attribute 37 
  set attribute 1
  set attribute 5
  type string "Dailing host ..."        ; send message to screen

  set disconnect on                     ; set disconnection trapping on
  on disconnect goto @DISCONNECT        ; disconnection error trap

  set timeout 120                       ; set timeout to 120 seconds
  
  Session ExitMode Accept               ; leave pcAnywhere active to accept calls
  Session Overwrites Always             ; will always overwrite file on download
  Session OnError Ignore                ; at error will go to next line
  Session Timeout 120                   ; timeout value
  Session Retry 3                       ; number of retries
  Session Delay 2                       ; amount of time between retries
  Session Dial LCCS                     ; intiates remote control session using LCCS configuration
  
  cursor position 5 28

; this portion logs into Novell server and occurs AFTER successful pcanywhere
; to pcanywhere connection is achieved.

  type string "Logging into Novell..."    ; send message to screen

  send scancode ""                      ; advances one line
  send scancode ""                      ; advances one line
  wait time 2                           ; waits 2 seconds
  send scancode Login                   ; send login to host
  wait time 2                           ; waits 2 seconds
  send scancode "^M"                    ; send a line return
  wait time 2                           ; waits 2 seconds
  send scancode NOVELLPASS              ; send password to host
  wait time 2                           ; waits 2 seconds
  send scancode "^M"                    ; send a line return
  wait time 2                           ; waits 2 seconds

; change to the correct location to download file FROM on the HOST

  send scancode "CD\LABOR\DOWNLOAD^M"   ; changes to download directory
  wait time 3                           ; waits 3 seconds

;*************************************************************************************
; The next line initiates the data transfer - from host to remote with paths included
;*************************************************************************************
  SessOpr Host Send "y:\labor\download\*.lzh c:\labor\download\"   ; receive these files
  
  set disconnect off                    ; sets disconnect trap off
  GOTO @hangup                          ; goes to hangup subroutine

;************************************************************************
; HANGUP
;************************************************************************
@HANGUP:
  LET $ERROR=0                          ; reset error code to no error
  LET $RESULT=0                         ; reset result code to okay 
  
  set attribute 44
  clear screen
  set attribute 37
  set attribute 1
  set attribute 5
  cursor position 5 10
  type string "Please be patient...Hanging up phone and logging off LCCS..."
  set disconnect off
  session end
  IF ($ERROR<0) GOTO @error             ; an error occurred trying to logout and hangup
  EXIT                                  ; return to exit normally
 
 ;************************************************************************
; DISCONNECT OCCURS
;************************************************************************
@DISCONNECT:                            ; disconnection, so end the script
  set disconnect off                    ; stop disconnection trap
  set attribute 41
  set attribute 1
  clear screen
  set attribute 37
  set attribute 1
  CURSOR POSITION 5 25
  Type string "ERROR! Disconnect Occurred!"
  goto @ERROR

;************************************************************************
; USER PRESSED ESCAPE TO ABORT OR EXIT
;************************************************************************
@CANCEL:                                ; User exit
  cursor position 5 28
  type string "User Pressed Escape!"
  GOTO @ERROR

;************************************************************************
; ERROR OCCURRED
;************************************************************************
@ERROR:
  set disconnect off
  set attribute 41
  set attribute 1
  clear screen
  set attribute 37
  set attribute 1
  ON ERROR                              ; CANCEL ERROR TRAP-WE ARE HERE
  cursor position 6 25
  IF ($ERROR==-8) THEN TYPE STRING "       File not found."
  IF ($ERROR==-4) THEN TYPE STRING "     Timeout has occurred."
  IF ($ERROR==-1) THEN TYPE STRING "      User aborted script."
  IF ($ERROR==-19) THEN TYPE STRING "     File already exists."
  IF ($ERROR==-15) THEN TYPE STRING "Could not establish a connection."
  BEEP                                  ; AUDIBLE SOUND ALARM
  wait time 1
  BEEP
  wait time 1
  BEEP
  cursor position 2 31
  type string "**** WARNING ****"
  cursor position 4 31
  type string "AN ERROR OCCURRED!"
  cursor position 8 31
  type string "ERROR NUMBER: "
  IF ($ERROR!=0) THEN type string $ERROR
  cursor position 10 31
  type string "RESULT NUMBER: "
  IF ($RESULT!=0) THEN type string $RESULT
  cursor position 14 28
  type string "Redial option in 10 seconds..."
  session end
  set attribute 44
  clear screen
  set attribute 37
  set attribute 1
  LET $RESULT=0
  LET $ERROR=0
  MessageBox "MESSAGE BOX" "Do you want to dial the LCCS again?" 37
  clear screen
  IF ($RESULT==4) Then Goto @begin
  goto @HANGUP                             ; User pressed escape error End of script with 1
  
>>Did you ever resolve this issue completely? In the past, I wrote pcAnywhere scripts for the government and I have done both PcAnywhere for Dos 5.0 and PcAnywhere for windows scripts using Windows 95/98. Let me know if you are still having problems with the modem.
>
>Hello Tracy:
>
>Thank you for your kind reponse.
>
>To answer your question, I think Ed's WinAPI stuff did the trick on my computer. I have to try that out on client machines too. Therefore, not sure whether the problem has been addressed completely. I would however like to try your scripts too.
>
>UT is such a fine place - where people so readily help. Kudos to you all.
.·*´¨)
.·`TCH
(..·*

010000110101001101101000011000010111001001110000010011110111001001000010011101010111001101110100
"When the debate is lost, slander becomes the tool of the loser." - Socrates
Vita contingit, Vive cum eo. (Life Happens, Live With it.)
"Life is not measured by the number of breaths we take, but by the moments that take our breath away." -- author unknown
"De omnibus dubitandum"
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform