Two parts: Email and Tcl/Tk and executing a tcl script 
Author Message
 Two parts: Email and Tcl/Tk and executing a tcl script

To all the Tcl/Tk community:

Problem #1:
I have a requirement to be able to send an email from a Tcl/Tk script.  I am
working on a Windows NT networked machine and I need to send the contents of a
file as a email message.  

Problem #2:
I would like to call my Tcl script by it's name without having to run the
tclsh.exe executable.  Again I am on a Windows NT machine.  In UNIX I would set
the first line of my script to   #!/bin/tclsh    however I am not running on
UNIX

Please help
rwcr406



Sat, 06 Apr 2002 03:00:00 GMT  
 Two parts: Email and Tcl/Tk and executing a tcl script


Quote:

>To all the Tcl/Tk community:

>Problem #1:
>I have a requirement to be able to send an email from a Tcl/Tk script.  I am
>working on a Windows NT networked machine and I need to send the contents of a
>file as a email message.  

                        .
                        .
                        .
I write Tcl scripts that simply connect directly to the target
machine through a network socket.  Other people, particularly
on WNT, take other approaches.  Feel free to chose from among
<URL:http://starbase.neosoft.com/~claird/comp.lang.tcl/tcl-examples.html#mail>
--

Cameron Laird           http://starbase.neosoft.com/~claird/home.html



Sun, 07 Apr 2002 03:00:00 GMT  
 Two parts: Email and Tcl/Tk and executing a tcl script

Quote:

> Problem #2:
> I would like to call my Tcl script by it's name without having to run the
> tclsh.exe executable.  Again I am on a Windows NT machine.  In UNIX I would set
> the first line of my script to   #!/bin/tclsh    however I am not running on
> UNIX

> Please help
> rwcr406

From someone here in c.l.t. I learned the following trick,
which works for me under Win95:
file foo.bat:
        ::set run_dos { ;# run tcl-script from BAT-file
        tclsh80 %0 %1 %2 %3 %4 %5 %6 %7 %8 %9
        exit
        }
        puts "Tcl $tcl_patchLevel"

Rolf.
---------------------------------------------------------------------
German Aerospace Center              Rolf Schroedter
Inst. of Planetary Exploration       Tel/Fax:  +49 (30) 67055-416/384  



Sun, 07 Apr 2002 03:00:00 GMT  
 Two parts: Email and Tcl/Tk and executing a tcl script


Quote:
> Problem #1:
> I have a requirement to be able to send an email from a Tcl/Tk
script.  I am
> working on a Windows NT networked machine and I need to send the
contents of a
> file as a email message.

Sure.  Grab my ezsmtp package from:

    http://www.millibits.com/djh/tcl/ezsmtp-current.tar.gz

(WinZip should be able to unpack the .tar.gz for you), install
in your Tcl library directory, and:

package require ezsmtp

set chan [open SOMEFILENAME r]

ezsmtp::send -mailhost SOMEHOSTNAME -from MYADDRESS \
    -subject MYSUBJECT -channel $chan RECIPADDRESS

replacing SOMEFILENAME, SOMEHOSTNAME, MYADDRESS, MYSUBJECT, and
RECIPADDRESS as appropriate.

Quote:
> Problem #2:
> I would like to call my Tcl script by it's name without having to run
the
> tclsh.exe executable.  Again I am on a Windows NT machine.  In UNIX I
would set
> the first line of my script to   #!/bin/tclsh    however I am not
running on
> UNIX

On windows, you do this with file extension associations in the
registry, such that double-clicking on a .tcl file will run
"C:\tcl\bin\wish.exe C:\path\to\scriptname".  Any good book on the
Registry discusses how to configure this w/ Regedit.  If you want
to reverse-engineer it, install Tcl from the installer at
www.scriptics.com, open RegEdit, and search for ".tcl".

Sent via Deja.com http://www.deja.com/
Before you buy.



Sun, 07 Apr 2002 03:00:00 GMT  
 Two parts: Email and Tcl/Tk and executing a tcl script

Quote:
> Problem #2:
> I would like to call my Tcl script by it's name without having to run the
> tclsh.exe executable.  Again I am on a Windows NT machine.  In UNIX I would set
> the first line of my script to   #!/bin/tclsh    however I am not running on
> UNIX

i use 4nt (enhanced shell for nt (also avialble for windows, dos...)

and put this in one of your startup/login scripts:

set .tcl=<path to tclsh.exe>

then all your scripts with a .tcl extension, you can just call by name
without the extension.

--
*--------------------------------------
|
|remove myspleen to email
|
*-----------------------



Sun, 07 Apr 2002 03:00:00 GMT  
 Two parts: Email and Tcl/Tk and executing a tcl script

Quote:

>To all the Tcl/Tk community:

>Problem #1:
>I have a requirement to be able to send an email from a Tcl/Tk script.  I am
>working on a Windows NT networked machine and I need to send the contents of a
>file as a email message.  

This can be done using your current mail system's mailer by using the 'mail'
extension for NT. The file can be sent as an attachment, names in your address
book can be used as destinations, and your "Sent Items" will contain a copy of
the message if you are so configured. See
http://www.du.edu/~mschwart/tcl-tk.htm for the extension and example scripts.

mail send [-to tolist] [-subject subject] [-body text] [-attachments attachmentlist]

For example:


Obviously, if you got this, it worked!
Thanks! } -attachments { xyz.txt abc.doc }

Quote:

>Problem #2:
>I would like to call my Tcl script by it's name without having to run the
>tclsh.exe executable.  Again I am on a Windows NT machine.  In UNIX I would set
>the first line of my script to   #!/bin/tclsh    however I am not running on
>UNIX

If you mean that you wish, from the explorer, to launch the script, just give
it a .tcl file extension, and it will be launched with wish automatically.
Under explorer's File/View/Options/File Types, you can define your own
association with a different extension if you want Tclsh instead of Wish to
launch the script (Look at the TclScript entry to see how this is done).

Quote:

>Please help
>rwcr406

Hope this helps,

Michael

--
Michael Schwartz                  "Expect everything...
                                        and the unexpected never happens"



Mon, 08 Apr 2002 03:00:00 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. Executing Tcl script inside a Tcl script

2. Executing TCL/TK from TCL/TK

3. tcl/tk-scripts, Apache & tcl/tk-plugin

4. tcl/tk 8.0 problem with Windows app that calls tcl/tk script

5. Can _One_ Tcl/Tk script run _Two_ displays?

6. Port TCL script to Wish Can't find variable contents from tcl script

7. Running a TK script using wish80.exe within a tcl script

8. calling a tcl script form another tcl script

9. tcl script to edit tcl script

10. Tcl script exec'd from VMS tcl script doesn't display puts o/p

11. Need example of working tcl/tk script used as cgi-bin script

12. Executing other TCL - Scripts in the background

 

 
Powered by phpBB® Forum Software