Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Sending last line of txt document using blat

Posted on 2008-06-18
8
Medium Priority
?
419 Views
Last Modified: 2012-05-05
I am trying to send the last line of last_line.txt using Blat. What I have right now sends me the whole txt document in the body. I dont want all that because there our multiple lines. I just want the last line of last_line.txt. Here is what I have in my test.cmd file:

blat.exe "last_line.txt" -subject "A Screen Saver has been Changed" -to 123@mail.com -i ScreenSaver -priority 1 -server smtp.mydomain.com -f wpdomain


Any help is much appreciated. Thanks!
0
Comment
Question by:missywpitt
  • 4
  • 4
8 Comments
 
LVL 38

Expert Comment

by:Shift-3
ID: 21816746
This should do it.


@echo off
setlocal enabledelayedexpansion
 
for /F "tokens=* usebackq" %%G in (last_line.txt) do set body=%%G
 
blat.exe -subject "A Screen Saver has been Changed" -body "%body%" -to 123@mail.com -i ScreenSaver -priority 1 -server smtp.mydomain.com -f wpdomain

Open in new window

0
 

Author Comment

by:missywpitt
ID: 21816870
when I try and run it it says -subject does not exist.
0
 
LVL 38

Expert Comment

by:Shift-3
ID: 21816889
Oh, I guess the -to switch has to go first.


@echo off
setlocal enabledelayedexpansion
 
for /F "tokens=* usebackq" %%G in (last_line.txt) do set body=%%G
 
blat.exe -to 123@mail.com -subject "A Screen Saver has been Changed" -body "%body%" -i ScreenSaver -priority 1 -server smtp.mydomain.com -f wpdomain

Open in new window

0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 

Author Comment

by:missywpitt
ID: 21816958
Now I got -to does not exist. I think the file itself has to b put after blat? When I run my code I had before it works except I get everything that is in the text file rather than just the last line like I want. Not sure about this one.

I have a work around if we cant get it.
0
 
LVL 38

Expert Comment

by:Shift-3
ID: 21817044
After re-reading the Blat documentation (http://www.blat.net/syntax/syntax.html), I'm pretty sure this will work.


@echo off
setlocal enabledelayedexpansion
 
for /F "tokens=* usebackq" %%G in (last_line.txt) do set body=%%G
 
blat.exe - -body "%body%" -to 123@mail.com -subject "A Screen Saver has been Changed" -i ScreenSaver -priority 1 -server smtp.mydomain.com -f wpdomain

Open in new window

0
 

Author Comment

by:missywpitt
ID: 21817200
well that sent me the second line of the text document? Atleast were getting somewhere here.
0
 
LVL 38

Accepted Solution

by:
Shift-3 earned 2000 total points
ID: 21817308
Perhaps there is an ampersand or something messing it up.

Last try.


@echo off
setlocal enabledelayedexpansion
 
for /F "tokens=* usebackq" %%G in (last_line.txt) do set body="%%G"
 
blat.exe - -body %body% -to 123@mail.com -subject "A Screen Saver has been Changed" -i ScreenSaver -priority 1 -server smtp.mydomain.com -f wpdomain

Open in new window

0
 

Author Comment

by:missywpitt
ID: 21821426
That worked! Once again Shift-3 you pulled through!
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
The Windows functions GetTickCount and timeGetTime retrieve the number of milliseconds since the system was started. However, the value is stored in a DWORD, which means that it wraps around to zero every 49.7 days. This article shows how to solve t…
Learn the basics of if, else, and elif statements in Python 2.7. Use "if" statements to test a specified condition.: The structure of an if statement is as follows: (CODE) Use "else" statements to allow the execution of an alternative, if the …
Learn the basics of modules and packages in Python. Every Python file is a module, ending in the suffix: .py: Modules are a collection of functions and variables.: Packages are a collection of modules.: Module functions and variables are accessed us…
Suggested Courses

824 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question