Welcome!

By registering with us, you'll be able to discuss, share and exchange private messages with other members of our community.

SignUp Now!

handling percent signs in filenames

Take Command 8.02.106 Windows XP [Version 5.1.2600]
Take Command Build 106 Windows XP Build 2600 Service Pack 3
Registered to Charles S. Galloway - 5 System License

I am not sure of how to handle the percent signs in filename - given this short and easy to understand BTM, also attached.

I have debugged the file but I can't see what is wrong now?

=======================================================================::
:: 1) send multiple files per email generated from DIR /S
:: 2) file names might have % signs ....
:: 3) if name of folder changes - email and the current folder name is the subject of the email
::
cls
echo %@repeat[=,%@winmetrics[5]]
set cListfile=twilight.lst
set nMails=0
setlocal
set nLines=%@lines[%cListFile]
for /L %line in (0,1,%lines) (
setdos /x-3
set cLine=%@line[%cListFile,%line]
:: setdos /x0
set cAtt=%cAtt /A %cLine
::
:: handle different folder name in line from %cListFile
:: rightmost \ will be significant
set nAt=%@index[%cLine,\,-1]
echo 1......
iff %nAt > 0 then
set cThisFldr=%@right[-nAt,%cLine]
iff NOT "%cThisFldr" == "%cCurrFldr" then
echo sendmail %cAtt /D /I1 /P1 /R /S1 /V "Ta[email protected]" "%cCurrFldr" Files are attached
set nEmails=%@inc[%nEmails]
echo Emails: %nEmails
set cCurrFldr=%cThisFldr
unset cAtt
endiff
endiff
:: end handle....
echo 2......
iff %@eval[%line mod 5] eq 0 then
echo sendmail %cAtt /D /I1 /P1 /R /S1 /V "Ta[email protected]" "%cCurrFldr" Files are attached
set nEmails=%@inc[%nEmails]
echo Emails: %nEmails
set cCurrFldr=%cThisFldr
unset cAtt
endiff
)
iff %@eval[%line mod 5] ne 0 then
echo sendmail %cAtt /D /I1 /P1 /R /S1 /V "Ta[email protected]" "%cCurrFldr" Files are attached
set nEmails=%@inc[%nEmails]
echo Emails: %nEmails
set cCurrFldr=%cThisFldr
unset cAtt
endiff
endlocal
goto :here
:: sample of twilight.lst
Cast Member Photos\u7u7t.jpg
Cast Member Photos\v.jpg
Cast Member Photos\yhyt.jpg
Covers\gallery_main-robert-pattinson-gq-magazine.jpg
Covers\rob_kris_ok.jpg
Graphics\l36c19a950001_1_9427.jpg
Graphics\l36c19b170000_1_8980.jpg
Graphics\l36c19c5b0001_1_21803.jpg

would generate 3 emails. if there were more than 5 files in any one folder - that would generate more emails...
:here

Sample output now....
1......
C:\Documents and Settings\Charles\Desktop\Tarra\sendlist.btm [41] Usage : IFF [NOT] condition [.AND. | .OR. | .XOR. [NOT] co
ndition ...] THEN & commands
sendmail %cAtt /D /I1 /P1 /R /S1 /V "Ta[email protected]" "%cCurrFldr" Files are attached
Emails: %nEmails
TCMD: C:\Documents and Settings\Charles\Desktop\Tarra\sendlist.btm [41] Unknown command "endiff"
2......
sendmail %cAtt /D /I1 /P1 /R /S1 /V "Ta[email protected]" "%cCurrFldr" Files are attached
Emails: %nEmails
TCMD: C:\Documents and Settings\Charles\Desktop\Tarra\sendlist.btm [47] Not in environment "cAtt"
 
I hardly looked at it, but SETDOS /x-4 should come in very handy.

On Thu, 28 May 2009 23:40:36 -0500, "[email protected]"
<> wrote:

|Take Command 8.02.106 Windows XP [Version 5.1.2600]
|Take Command Build 106 Windows XP Build 2600 Service Pack 3
|Registered to Charles S. Galloway - 5 System License
|
|I am not sure of how to handle the percent signs in filename - given this short and easy to understand BTM, also attached.
|
|I have debugged the file but I can't see what is wrong now?
|
|=======================================================================::
|:: 1) send multiple files per email generated from DIR /S
|:: 2) file names might have % signs ....
|:: 3) if name of folder changes - email and the current folder name is the subject of the email
|::
|cls
|echo %@repeat[=,%@winmetrics[5]]
|set cListfile=twilight.lst
|set nMails=0
|setlocal
| set nLines=%@lines[%cListFile]
| for /L %line in (0,1,%lines) (
| setdos /x-3
| set cLine=%@line[%cListFile,%line]
| :: setdos /x0
| set cAtt=%cAtt /A %cLine
| ::
| :: handle different folder name in line from %cListFile
| :: rightmost \ will be significant
| set nAt=%@index[%cLine,\,-1]
| echo 1......
| iff %nAt > 0 then
| set cThisFldr=%@right[-nAt,%cLine]
| iff NOT "%cThisFldr" == "%cCurrFldr" then
| echo sendmail %cAtt /D /I1 /P1 /R /S1 /V "Ta[email protected]" "%cCurrFldr" Files are attached
| set nEmails=%@inc[%nEmails]
| echo Emails: %nEmails
| set cCurrFldr=%cThisFldr
| unset cAtt
| endiff
| endiff
| :: end handle....
| echo 2......
| iff %@eval[%line mod 5] eq 0 then
| echo sendmail %cAtt /D /I1 /P1 /R /S1 /V "Ta[email protected]" "%cCurrFldr" Files are attached
| set nEmails=%@inc[%nEmails]
| echo Emails: %nEmails
| set cCurrFldr=%cThisFldr
| unset cAtt
| endiff
| )
| iff %@eval[%line mod 5] ne 0 then
| echo sendmail %cAtt /D /I1 /P1 /R /S1 /V "Ta[email protected]" "%cCurrFldr" Files are attached
| set nEmails=%@inc[%nEmails]
| echo Emails: %nEmails
| set cCurrFldr=%cThisFldr
| unset cAtt
| endiff
|endlocal
|goto :here
|:: sample of twilight.lst
|Cast Member Photos\u7u7t.jpg
|Cast Member Photos\v.jpg
|Cast Member Photos\yhyt.jpg
|Covers\gallery_main-robert-pattinson-gq-magazine.jpg
|Covers\rob_kris_ok.jpg
|Graphics\l36c19a950001_1_9427.jpg
|Graphics\l36c19b170000_1_8980.jpg
|Graphics\l36c19c5b0001_1_21803.jpg
|
|would generate 3 emails. if there were more than 5 files in any one folder - that would generate more emails...
|:here
|
|Sample output now....
|1......
|C:\Documents and Settings\Charles\Desktop\Tarra\sendlist.btm [41] Usage : IFF [NOT] condition [.AND. | .OR. | .XOR. [NOT] co
|ndition ...] THEN & commands
|sendmail %cAtt /D /I1 /P1 /R /S1 /V "Ta[email protected]" "%cCurrFldr" Files are attached
|Emails: %nEmails
|TCMD: C:\Documents and Settings\Charles\Desktop\Tarra\sendlist.btm [41] Unknown command "endiff"
|2......
|sendmail %cAtt /D /I1 /P1 /R /S1 /V "Ta[email protected]" "%cCurrFldr" Files are attached
|Emails: %nEmails
|TCMD: C:\Documents and Settings\Charles\Desktop\Tarra\sendlist.btm [47] Not in environment "cAtt"
|
|
|
|
|
|
|
--
- Vince
 
I believe Vince already answered this, but setdos /x-3 disables all
variable expansion which is not what you want. You just want to disable
nested variable expansion which is setdos /x-4.

-Scott

"[email protected]" <> wrote on 05/29/2009
12:40:25 AM:


> Take Command 8.02.106 Windows XP [Version 5.1.2600]
> Take Command Build 106 Windows XP Build 2600 Service Pack 3
> Registered to Charles S. Galloway - 5 System License
>
> I am not sure of how to handle the percent signs in filename - given
> this short and easy to understand BTM, also attached.
>
> I have debugged the file but I can't see what is wrong now?
>
>
=======================================================================::

> :: 1) send multiple files per email generated from DIR /S
> :: 2) file names might have % signs ....
> :: 3) if name of folder changes - email and the current folder name
> is the subject of the email
> ::
> cls
> echo %@repeat[=,%@winmetrics[5]]
> set cListfile=twilight.lst
> set nMails=0
> setlocal
> set nLines=%@lines[%cListFile]
> for /L %line in (0,1,%lines) (
> setdos /x-3
> set cLine=%@line[%cListFile,%line]
> :: setdos /x0
> set cAtt=%cAtt /A %cLine
> ::
> :: handle different folder name in line from %cListFile
> :: rightmost \ will be significant
> set nAt=%@index[%cLine,\,-1]
> echo 1......
> iff %nAt > 0 then
> set cThisFldr=%@right[-nAt,%cLine]
> iff NOT "%cThisFldr" == "%cCurrFldr" then
> echo sendmail %cAtt /D /I1 /P1 /R /S1 /V "TarraAnn85@aol.
> com" "%cCurrFldr" Files are attached
> set nEmails=%@inc[%nEmails]
> echo Emails: %nEmails
> set cCurrFldr=%cThisFldr
> unset cAtt
> endiff
> endiff
> :: end handle....
> echo 2......
> iff %@eval[%line mod 5] eq 0 then
> echo sendmail %cAtt /D /I1 /P1 /R /S1 /V "[email protected]"
> "%cCurrFldr" Files are attached
> set nEmails=%@inc[%nEmails]
> echo Emails: %nEmails
> set cCurrFldr=%cThisFldr
> unset cAtt
> endiff
> )
> iff %@eval[%line mod 5] ne 0 then
> echo sendmail %cAtt /D /I1 /P1 /R /S1 /V "[email protected]" "%
> cCurrFldr" Files are attached
> set nEmails=%@inc[%nEmails]
> echo Emails: %nEmails
> set cCurrFldr=%cThisFldr
> unset cAtt
> endiff
> endlocal
> goto :here
> :: sample of twilight.lst
> Cast Member Photos\u7u7t.jpg
> Cast Member Photos\v.jpg
> Cast Member Photos\yhyt.jpg
> Covers\gallery_main-robert-pattinson-gq-magazine.jpg
> Covers\rob_kris_ok.jpg
> Graphics\l36c19a950001_1_9427.jpg
> Graphics\l36c19b170000_1_8980.jpg
> Graphics\l36c19c5b0001_1_21803.jpg
>
> would generate 3 emails. if there were more than 5 files in any one
> folder - that would generate more emails...
> :here
>
> Sample output now....
> 1......
> C:\Documents and Settings\Charles\Desktop\Tarra\sendlist.btm [41]
> Usage : IFF [NOT] condition [.AND. | .OR. | .XOR. [NOT] co
> ndition ...] THEN & commands
> sendmail %cAtt /D /I1 /P1 /R /S1 /V "[email protected]" "%
> cCurrFldr" Files are attached
> Emails: %nEmails
> TCMD: C:\Documents and Settings\Charles\Desktop\Tarra\sendlist.btm
> [41] Unknown command "endiff"
> 2......
> sendmail %cAtt /D /I1 /P1 /R /S1 /V "[email protected]" "%
> cCurrFldr" Files are attached
> Emails: %nEmails
> TCMD: C:\Documents and Settings\Charles\Desktop\Tarra\sendlist.btm
> [47] Not in environment "cAtt"
>
>
>
>
>
>
>
 

Similar threads

Back
Top