Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

Help with script to send

 [1/5] from: psa102:toward at: 15-Aug-2004 17:33


Can someone help me with the script below. The error message is: "Component: "System Port" 1.1.2.5 (30-Sep-2003/16:57:26) Script: "User Preferences" (20-May-2001/21:08:16-4:00) Script: "Send message with attachment script" (8-Aug-2004) ** Script Error: Invalid argument: ** Where: to-file ** Near: to file! :value" I presume the problem is that the words messagefile, addressfile, etc. are not properly typed or the argument values are not properly loaded into them. The first argument, messagefile, is the filename (drive,path, and filename) of a text file that contains the message to be sent. The message consists of lines, each 60 characters or less, ending with an 0D0A. The second argument, addressfile, is a text file with email addresses in it (one per line). Attachfile is a file with one or more filenames in it. This script is to be used to distribute messages with one or more attachments to a community email list. The Rebol file is loaded by a REXX script that is also included below. - - - - - - - - - - - REBOL [ Title: "Send message with attachment script" File: %sendattach6.r Author: "jwirt" Date: 8-8-04 Purpose: { Load an email script from command line, two arguments. Uses REBOL 2.5.8.3.1 } ] arguments: parse/all system/script/args none addressfile: to-file first arguments messagefile: to-file next arguments attachfiles: to-file next arguments members: make block! message: make string! attachfiles: make block! message: read/lines messagefile members: load addressfile attachfiles: [%test1.txt %test2.txt] send/attach members message attachfiles .. . . . . . . . /* test shell for send attachment */ messagefile="message.txt" addrfile="localaddresses.txt" attachfile = "test1.txt" address cmd ok=directory("d:\rebol") rebol.exe sendattachtest6.r addrfile read messagefile attachfile address

 [2/5] from: tomc:darkwing:uoregon at: 16-Aug-2004 0:20


seems to me if you use 'parse/all you cant have 'none as your rule since 'none parses on the chars you have just told parse not to consider so unless you need soaces in your file names etc I would drop the /alll refinment. Or if I were to keep the /all I would write an actual rule block On Sun, 15 Aug 2004, PSA102 wrote:

 [3/5] from: stasil213:yaho:o at: 16-Aug-2004 9:44


Welcome to using Rebol!! For debugging, I would probably put a print statement after the argument assignment. arguments: parse/all system/script/args none print "arguments:" print mold arguments or, perhaps better, arguments: parse/all system/script/args none print ["arguments:" mold arguments] The function mold turns whatever arguments is into a string. Hope this helps. --Stan

 [4/5] from: gabriele::colellachiara::com at: 16-Aug-2004 11:15


Hi PSA102, On Sunday, August 15, 2004, 11:33:57 PM, you wrote: P> arguments: parse/all system/script/args none P> addressfile: to-file first arguments P> messagefile: to-file next arguments P> attachfiles: to-file next arguments I'd suggest you using: addressfile: to file! system/options/args/1 messagefile: to file! system/options/args/2 attachfiles: to file! system/options/args/3 P> members: make block! P> message: make string! P> attachfiles: make block! MAKE takes two arguments here, not one. But anyway, you don't need these at all, since you are assigning new values to the words again below, so you should just remove these lines. (Note that because you are missing one argument, they will actually do: members: make block! message: make string! attachfiles: make block! message: read/lines messagefile So you get message turned back into a string here. (Also, I really think you're not wanting /LINES here.) Regards, Gabriele. -- Gabriele Santilli <[g--santilli--tiscalinet--it]> -- REBOL Programmer Amiga Group Italia sez. L'Aquila --- SOON: http://www.rebol.it/

 [5/5] from: psa102:toward at: 16-Aug-2004 16:47


Gabriele's, Stan's, and Tom's suggestions have almost gotten my command file (script file?) to run. The error message now is: Script: "User Preferences" (20-May-2001/21:08:16-4:00) Script: "Send message with attachment script 8" (8-Aug-2004) arguments: ["localaddresses.txt message.txt attachments.txt"] addressfile: %localaddresses.txt messagefile: %message.txt attachfiles: %attachments.txt ** Access Error: Cannot open /D/Rebol/test1.file ** Where: build-attach-body ** Near: val: read/binary file Apparently, the script is opening the "attachments.txt" file and reading the first filename listed but stripping off the leading "%" that I included in the file. For example, the attachments.txt file consists of two lines, %test1.txt and %test2.txt. I didn't really think that including the "%" before the filename in the data file, attachments.txt, would convert into a block of Rebol filenames in the attachfiles: word but I didn't know what command to use (reduce?, ...?). THe script is now: REBOL [ Title: "Send message with attachment script 8" File: %sendattach8.r Author: "jwirt, gabriele santilli, stan silver, tom conlin :-)" Date: 8-8-04 Purpose: { Load an email script from command line, two arguments. Uses REBOL 2.5.8.3.1 } ] arguments: parse system/script/args none print ["arguments:" mold arguments] addressfile: to file! system/options/args/1 print ["addressfile:" mold addressfile] messagefile: to file! system/options/args/2 print ["messagefile:" mold messagefile] attachfiles: to file! system/options/args/3 print ["attachfiles:" mold attachfiles] message: read messagefile members: load/all addressfile attachments: load/all attachfiles send/attach members message attachments The next to last statement is the one that probably needs to change. The individual filenames in the text file whose name is stored in the word, attachments:, need to be loaded into attachments: as a block of Rebol filennames. At worst, I could load the list of filenames in attachments.txt into a series word and then somehow convert them one by one into a series of Rebol filenames that is then stored as a block in a word. The word attachments has to contain a list of Rebol file Names as a block, if I understand the syntax of the send command correctly. If I replace the next to last line with: [%test1.txt %test2.txt] Currently, the data in the text file attachments.txt are two lines of text, %test1.txt and %test2.txt. This gives the error above. John Wirt it works perfectly. Thank you in advance. John Wirt