Author Topic: Batch for mailing pictures with thunderbird  (Read 4306 times)

0 Members and 1 Guest are viewing this topic.

webazubi

  • Member
  • **
  • Posts: 17
    • View Profile
Batch for mailing pictures with thunderbird
« on: 2016-01-15 21:24:39 »
Hello.

I'm trying to build a batch-File, wich can send selected pictures in Thumbs 10 to Mozilla Thunderbird.

So I select some Pictures with clicking the mouse by holding Strg-Button. Then I start the batch like

FOR %%i IN (%*) DO set 'tmpvar=%%i'
"thunderbird.exe" -compose "to='testmail@xx.xx',subject='Test',attachment='%tmpvar%'"


But always the variable tmpvar seems to be empty - no pictures arrived in thunderbird.

So the question: How can I fill tmpvar?

Thanks

Daan van Rooijen

  • Administrator
  • Sr. Member
  • *****
  • Posts: 933
    • View Profile
Batch for mailing pictures with thunderbird
« Reply #1 on: 2016-01-15 22:49:02 »
> I'm trying to build a batch-File, wich can send selected pictures in Thumbs 10 to Mozilla Thunderbird.

Doesn't the built-in e-mail function work for you? (File | Email or right-click on image, then Email).

> So I select some Pictures with clicking the mouse by holding Strg-Button. Then I start the batch like
>
> FOR %%i IN (%*) DO set 'tmpvar=%%i'
> "thunderbird.exe" -compose "to='testmail@xx.xx',subject='Test',attachment='%tmpvar%'"

>
> But always the variable tmpvar seems to be empty - no pictures arrived in thunderbird.

This is probably a stupid comment -I'm not up to date with current batch command syntax- but in the old days we had to use %%p to get command line parameters. Could that be the problem?

Also, I assume that you made a button for your external batch command. If so, did you enable "Accepts multiple files" in the properties of your external command?

Again, I'm not all that familiar with today's batch commands (which I know are much more powerful than those from the DOS 3 days), but another possible solution might be to copy the filenames to the clipboard and then read the clipboard items from your batchfile. You can do the copying in ThumbsPlus by selecting the files and then Edit | Copy | Filename (Shift-Alt-C, or through the right-click menu).

There are 3d party utilities to copy text between the clipboard and textfiles that might help, e.g. http://www.nirsoft.net/utils/nircmd.html and http://www.horstmuc.de/wbat32.htm#cliptext
I'm volunteering as a moderator - I do not work for Cerious Software, Inc.

webazubi

  • Member
  • **
  • Posts: 17
    • View Profile
Batch for mailing pictures with thunderbird
« Reply #2 on: 2016-01-15 23:24:04 »
Hello.
> Doesn't the built-in e-mail function work for you? (File | Email or right-click on image, then Email).

No, because in that way it's not possible to set other values like "To" or "Subject" or set the Account.

>use %%p to get command line parameters. Could that be the problem?

No change. Variable keeps empty.

> enable "Accepts multiple files" in the properties
Yes, I enabled, but no change.

When I start my batch I can see in a short Dos-Box that Thumbs works something with several files, but they don't arrive in Thunderbirds Attachment.

>copy the filenames to the clipboard
I also thought about exporting all files to a specific folder ... But thats not what I wanted.

Seems to be easier to set the values für the Mail in the Batch-file and then drag the pictures with the mouse from Thumbs in the Mailwindow.

Daan van Rooijen

  • Administrator
  • Sr. Member
  • *****
  • Posts: 933
    • View Profile
Batch for mailing pictures with thunderbird
« Reply #3 on: 2016-01-15 23:33:47 »
I just made a very simple batchfile, TEST.BAT:

 for %%p in (*.*) do ECHO %%p
 pause

I made a button for it, selected some files and ran it. It worked fine, each filename was ECHOed to the screen. So, I think the problem is in the syntax of your batchfile. I wish I knew/remembered more about CMD syntax, but I'm afraid that this is all the help that I can offer.
I'm volunteering as a moderator - I do not work for Cerious Software, Inc.

webazubi

  • Member
  • **
  • Posts: 17
    • View Profile
Batch for mailing pictures with thunderbird
« Reply #4 on: 2016-01-16 20:47:09 »
Hm. Trying again with your code it seems to work really. Thumbs makes a perfect job.
I found something here

http://www.computerhope.com/forum/index.php?topic=119374.20;wap2

and used it for this code, which works perfectly.
Thanks for help!


REM must be on to enumerate correctly
setlocal enabledelayedexpansion

REM Create string, set it to zero length
set AttachmentList=

REM Set error-out counter
set /a error=-1

REM Examine each file, add its name to the list followed by a comma
for %%F in (%*) do (set AttachmentList=!AttachmentList!%%~dpnxF,) & (set /a error=!error!+1)

REM End script if no files are processed
IF %error% LSS 0 GOTO cleanup

REM Remove final character (a comma)
set AttachmentList=%AttachmentList:~0,-1%

REM Compose email with attachments
thunderbird.exe -compose "to='test@xxx.xx',subject='test',body='test',attachment='%Attachmentlist%'"

GOTO CLEANUP

:CLEANUP
set AttachmentList=
set /a error=0
localoff
GOTO NEXT

:NEXT

Daan van Rooijen

  • Administrator
  • Sr. Member
  • *****
  • Posts: 933
    • View Profile
Batch for mailing pictures with thunderbird
« Reply #5 on: 2016-01-16 21:48:40 »
Very nice to hear that you got it working. Thanks for sharing your solution!
I'm volunteering as a moderator - I do not work for Cerious Software, Inc.