COMMENT ENS.ASP by Joe Scholes (70715,643) This script is designed to logon to CompuServe, enter the Executive News Service, send all items in all folders to CompuServe Mail, delete all items, and then log off. Feel free to change this to suite your own needs, but please email me a copy if you do so I can see what you did. I am unfamiliar with ASPECT and this script took me most of a day to write. I have tested it under a variety of circumstances and it works flawlessly, at least, on my ID and with my setup! BACKGROUND For those of you who have the Executive Option, you know that by using the Executive News Service, you can "clip" stories of interest to you by setting up a maximum of three clipping folders. ENS costs an additional $15 per hour while you are in the service. The surcharge applies when you are setting up folders, modifying folders, or just reading the clippings that have been stored there. With the advent of flat rate basic services on CompuServe that includes reading unlimited mail, I wanted a means of sending all my news clippings from ENS to CompuServe Mail as quickly as possible. There is a command in ENS where you can do that. It is issued as follows: SEND 1-3 70715,643. You can send one story, a selection of stories, or all stories. If you want to mix and match, the command looks like this: SEND 1-3,5,15,18-20 70715,643. That command would send stories 1 through 3, 5, 15, and 18 through 20 to your user ID. (My ID is in the example, but you get my meaning.) Unfortunately, there is no SEND ALL command. If there are 48 stories in a folder and you want to send them all, the command must look like this: SEND 1-48 70715,643, and has to be issued on the LAST screen of a SCA FOLDER (where "FOLDER" is the name of your folder) command. I have checked with CompuServe. Sending stories from within ENS does NOT count against your total number of outgoing email letters permitted each month under the flat rate plan. Their specific reply was that sending the stories via email from within ENS was part of the premium service and covered by the ENS surcharge. So, I felt like I could save money by going into ENS, sending all news clippings to myself as email, delete the news clippings in ENS, and then go read them at my leisure in email where there is no surcharge. Naturally a script file could do that much quicker than I could type in the commands. HOW IT WORKS Given the constraints of ENS, this script was difficult to write. First, it tests the folders for contents and skips those that are empty. It sets a variable with the exact number of stories in each folder so it can use the proper SEND command. It issues the SCA FOLDER (where "FOLDER" is the name of the folder) command for each folder created and "hits RETURN" until it gets to the last page of listed stories. Then it issues the SEND command to send all stories to your own logon ID. It deletes mailed stories before leaving the folder. TECHNICAL NOTES I have my terminal emulation set to ANSI on CompuServe. That is convenient for cursor positioning etc., but causes some problems when the script is scanning incomming lines for a very specific series of characters, specifically, ^M^J! (Carriage Return, Line Feed, and an exclamation point). In order to receive these characters properly, the script issues a SET TTY DUMCTR command to CompuServe as soon as it logs on. THIS SCRIPT WILL NOT WORK WITHOUT THAT COMMAND! Rest assured, however, that the change is only valid for the current session and will revert back to your defaults the next time you logon. Or, you may add a line to the end of the script to change it back after the script has finished its work. WHAT YOU SHOULD DO TO MAKE THIS SCRIPT WORK FOR YOU Change the names of the three folders in the first STRING statement below to match the names of your folders. If you don't have three folders, you can delete ones you don't need from the script, but you will have to carfully delete portions of the script below also. You will also have to change the names of the variables throughout the script to match your folder names, if you change the names in the first STRING statement. It would be best if you used your favorite ASCII text editor and did a Global change on PEOPLE, PLACES, and THINGS. Everything else should work properly. You also need to change your logon ID in the second STRING statement below. BE SURE TO LEAVE IN THE LEADING SPACE! This variable is used later in concatenation statements. Likewise, change the pasword in the third STRING statement below. Change the DIAL statement below to the entry in your Dialing Directory that is set for CompuServe. Change the LOG OPEN statement and put in the correct path and filename for your log file, if you want one. You may delete this line if you wish. Note: At the end of the script, it issues an OFF command to CompuServe. I do this because it takes anywhere from 5 to 15 minutes for stories to show up in my mailbox after sending from ENS, so I log off and then uses a different script to get my mail later. If you want to stay logged on, you will have to modify the last few commands to suit your needs. DISCLAIMER I know this is a very rough script compared to some I've seen (and used as examples). I apologize for that. Ideally, a script uploaded for general use should account for every possible variation. I'm not that good at writing scripts yet, so you'll have to do your own "clean up" work if you find some of the code sloppy. Feel free to share this script with anyone. I release it to the public domain. Any comments or suggestions can be sent to me at 70715,643. If you want to test it without danger of losing stories in your folders, I suggest you remove the DEL ALL commands that are sent after scanning each folder. If all works well, this script will get you in ENS, transmit stories, delete stories, and back out of ENS fairly quickly, keeping your surcharged time to a minimum. I run this script every two weeks (the maximum time stories can be kept in a folder without being deleted), then go in and scan or read my email at leisure when it doesn't cost anything extra. Joe Scholes April 26, 1992 ENDCOMMENT ; PROC MAIN STRING PEOPLE,PLACES,THINGS ; Change to match your folders. See above! STRING IDSTRING=" xxxxx,xxx" ; Substitute your ID. Leave in leading space! STRING PWSTRING="\*********^M" ; Substitute your PW in place of asterisks. STRING PEO1,PLA1,THI1 STRING SENDONE="SEND 1",SENDMANY="SEND 1-" STRING PEOPLESEND,PLACESSEND,THINGSSEND STRING LOGONSTRING STRCPY LOGONSTRING IDSTRING STRCAT LOGONSTRING PWSTRING WHEN 0 "MORE !" TRANSMIT "^M" SET MODEM WAITCNCT 45 SET ATIME 0 SET ENQ OFF ; Eliminates accidental "line noise" dl's SET TRANSLATE STRIP IF NOT CONNECTED DIAL "1" PAUSE 1 TRANSMIT "^C" WAITFOR "User ID:" TRANSMIT LOGONSTRING WAITFOR "!" FOREVER ENDIF LOG CLOSE LOG OPEN "c:\pcplus\xfer\ens.log"; Change to match your log file TRANSMIT "set tty dumcrt^M" ; MUST BE LEFT ALONE FOR THIS TO WORK! WAITFOR "!" FOREVER TRANSMIT "g ens^M" WAITFOR "4 Create" FOREVER WAITFOR "^M" WAITFOR "^M" RGET PEOPLE ; These should be renamed. See comments RGET PLACES ; above. RGET THINGS ; WAITFOR "!" FOREVER SUBSTR PEO1 PEOPLE 27 2 ; Gets count of stories in folder #1. SUBSTR PLA1 PLACES 27 2 ; Gets count of stories in folder #2. SUBSTR THI1 THINGS 27 2 ; Gets count of stories in folder #3. STRCMP PEO1 "0 " ; Tests folder #1 for empty contents. IF SUCCESS GOTO SKIPPEOPLE ENDIF STRCMP PEO1 "1 " ; Tests folder #1 for only one story. IF SUCCESS STRCAT SENDONE IDSTRING ; Creating SEND command to match # of stories STRCPY PEOPLESEND SENDONE ; STRCAT PEOPLESEND "^M" ; GOTO SENDPEOPLE ENDIF STRCAT SENDMANY PEO1 ; Creating SEND command to match # of stories STRCAT SENDMANY IDSTRING ; STRCPY PEOPLESEND SENDMANY ; STRCAT PEOPLESEND "^M" ; SENDPEOPLE: TRANSMIT "sca people^M" ; Issues SCAN command, waits for last screen WAITFOR "^M^J!" ; to appear. TRANSMIT PEOPLESEND ; Issues SEND command. WAITFOR "!" FOREVER ; Wait for prompt. TRANSMIT "del all^M" ; Deletes stories sent to e-mail. WAITFOR "!" FOREVER ; Wait for prompt. ASSIGN SENDONE "SEND 1" ; Resets variable ASSIGN SENDMANY "SEND 1-" ; Resets variable SKIPPEOPLE: STRCMP PLA1 "0 " ; Repeat of above, for different folder IF SUCCESS GOTO SKIPPLACES ENDIF STRCMP PLA1 "1 " IF SUCCESS STRCAT SENDONE IDSTRING STRCPY PLACESSEND SENDONE STRCAT PLACESSEND "^M" GOTO SENDPLACES ENDIF STRCAT SENDMANY PLA1 STRCAT SENDMANY IDSTRING STRCPY PLACESSEND SENDMANY STRCAT PLACESSEND "^M" SENDPLACES: TRANSMIT "sca places^M" WAITFOR "^M^J!" TRANSMIT PLACESSEND WAITFOR "!" FOREVER TRANSMIT "del all^M" WAITFOR "!" FOREVER ASSIGN SENDONE "SEND 1" ASSIGN SENDMANY "SEND 1-" SKIPPLACES: ; Repeat of above, for different folder STRCMP THI1 "0 " IF SUCCESS GOTO WRAPUP ENDIF STRCMP THI1 "1 " IF SUCCESS STRCAT SENDONE IDSTRING STRCPY THINGSSEND SENDONE STRCAT THINGSSEND "^M" GOTO SENDTHINGS ENDIF STRCAT SENDMANY THI1 STRCAT SENDMANY IDSTRING STRCPY THINGSSEND SENDMANY STRCAT THINGSSEND "^M" SENDTHINGS: TRANSMIT "sca things^M" WAITFOR "^M^J!" TRANSMIT THINGSSEND WAITFOR "!" FOREVER TRANSMIT "del all^M" WAITFOR "!" FOREVER WRAPUP: TRANSMIT "off^M" ; Logs off after sending/deleting stories WAITFOR "NO CARRIER" FOREVER ; Waits for a "graceful" exit LOG CLOSE ; Closes log file QUIT ; Stops execution and exits PCPLUS ENDPROC