Add Send to E-Mail Recipient to Tool Bar

Discuss and share scripts and script files...
Stefan
Posts: 1360
Joined: 18 Nov 2008 21:47
Location: Europe

Re: Add Send to E-Mail Recipient to Tool Bar

Post by Stefan »

Interesting

i just did an test for the longest string i can send to command interpreter:

Code: Select all

$XP = strrepeat("X", 2042);
 run "cmd /k echo $XP-";

Code: Select all

$Win7 = strrepeat("X", 8151);
 run "cmd /k echo $Win7-";

-

But in XP DOS-Box i can copy in "ECHO 8191XXX" and get an good result.

"8191XXX" is an 8191 char long string.
::text strrepeat("X", 8191)

Stefan
Posts: 1360
Joined: 18 Nov 2008 21:47
Location: Europe

Re: Add Send to E-Mail Recipient to Tool Bar

Post by Stefan »

Idea: if you have setup your system to an unicode code page for DOS-Box,
you have even only an half of this amount available for strings because each char takes two bytes?

I use non-unicode cp:
C:\>chcp
850

or
1252

Can someone answer this please?

IMPVGO
Posts: 9
Joined: 16 May 2011 02:48

Re: Add Send to E-Mail Recipient to Tool Bar

Post by IMPVGO »

serendipity wrote:OK, here is another way using command prompt which supports longer string length. Again not sure what that number is.

Code: Select all

//Attach to Thunderbird
//Get item's path and names
    $items=chr(39).get("SelectedItemsPathNames",",").chr(39);
//Get item's names
    $itemnames=chr(39).get("SelectedItemsNames",", ").chr(39);
//Insert values into Thunderbird syntax
    $TB_Syntax= chr(34)."subject=$itemnames,body=$itemnames,attachment=$items".chr(34);

//Attach selected files to thunderbird's compose window 
//This method uses command prompt. 
    run "cmd /c cd /d C:\Program Files\Mozilla Thunderbird\ & thunderbird -compose $TB_Syntax";

Serendipity: Now this code is perfect. I can attach all the files I need without any problem (as long as I do not do over about 30 files - that will never need anyways). All files are attached and listed in the body and subject of the e-mail, without any of the problems I was having before. Thank-you again.

There is only one last question. Is there a way to name each file in separate lines in the body of the e-mail??... Eg.

filnename.pdf
filename.tif
filename.pdf
etc.

Thank-you!!!

serendipity
Posts: 3358
Joined: 07 May 2007 18:14
Location: NJ/NY

Re: Add Send to E-Mail Recipient to Tool Bar

Post by serendipity »

IMPVGO wrote:There is only one last question. Is there a way to name each file in separate lines in the body of the e-mail??... Eg.

filnename.pdf
filename.tif
filename.pdf
etc.

Thank-you!!!
Try this:

Code: Select all

//Attach to Thunderbird
//Get item's path and names
    $items=chr(39).get("SelectedItemsPathNames",",").chr(39);
//Get item's names
    $itemnames=chr(39).get("SelectedItemsNames",", ").chr(39);
//Get item's names for body
    $itemnamesbody=chr(39).get("SelectedItemsNames","<br>").chr(39);
//Insert values into Thunderbird syntax
    $TB_Syntax= chr(34)."subject=$itemnames,body=$itemnamesbody,attachment=$items".chr(34);

//Attach selected files to thunderbird's compose window 
//This method uses command prompt. 
    run "cmd /c cd /d C:\Program Files\Mozilla Thunderbird\ & thunderbird -compose $TB_Syntax";

IMPVGO
Posts: 9
Joined: 16 May 2011 02:48

Re: Add Send to E-Mail Recipient to Tool Bar

Post by IMPVGO »

serendipity wrote: Try this:

Code: Select all

//Attach to Thunderbird
//Get item's path and names
    $items=chr(39).get("SelectedItemsPathNames",",").chr(39);
//Get item's names
    $itemnames=chr(39).get("SelectedItemsNames",", ").chr(39);
//Get item's names for body
    $itemnamesbody=chr(39).get("SelectedItemsNames","<br>").chr(39);
//Insert values into Thunderbird syntax
    $TB_Syntax= chr(34)."subject=$itemnames,body=$itemnamesbody,attachment=$items".chr(34);

//Attach selected files to thunderbird's compose window 
//This method uses command prompt. 
    run "cmd /c cd /d C:\Program Files\Mozilla Thunderbird\ & thunderbird -compose $TB_Syntax";


This works flawlessly. Is it possible to add the word Emailing: before the names of the files on the subject of the e-mail?? I have tried this, but it does not come out okay. I tried:

"subject=Emailing: $itemnames, body etc., but in the subject it only appears the name of the first file.

And the last one, that I do not even have idea if it is possible is to number the files in the body of the e-mail. Eg.:

1) file.pdf
2) file.tif
3) file.jpg, etc.

I have appreciated very much your help, because now I have a button in my toolbar that attached the selected files to my e-mail client. Thank-you again.

Impvgo

serendipity
Posts: 3358
Joined: 07 May 2007 18:14
Location: NJ/NY

Re: Add Send to E-Mail Recipient to Tool Bar

Post by serendipity »

IMPVGO wrote:
serendipity wrote: Try this:

Code: Select all

//Attach to Thunderbird
//Get item's path and names
    $items=chr(39).get("SelectedItemsPathNames",",").chr(39);
//Get item's names
    $itemnames=chr(39).get("SelectedItemsNames",", ").chr(39);
//Get item's names for body
    $itemnamesbody=chr(39).get("SelectedItemsNames","<br>").chr(39);
//Insert values into Thunderbird syntax
    $TB_Syntax= chr(34)."subject=$itemnames,body=$itemnamesbody,attachment=$items".chr(34);

//Attach selected files to thunderbird's compose window 
//This method uses command prompt. 
    run "cmd /c cd /d C:\Program Files\Mozilla Thunderbird\ & thunderbird -compose $TB_Syntax";


This works flawlessly. Is it possible to add the word Emailing: before the names of the files on the subject of the e-mail?? I have tried this, but it does not come out okay. I tried:

"subject=Emailing: $itemnames, body etc., but in the subject it only appears the name of the first file.

And the last one, that I do not even have idea if it is possible is to number the files in the body of the e-mail. Eg.:

1) file.pdf
2) file.tif
3) file.jpg, etc.

I have appreciated very much your help, because now I have a button in my toolbar that attached the selected files to my e-mail client. Thank-you again.

Impvgo
This is possible. I hope you are learning some scripting to take full advantage of what XY can do. Also, I would appreciate if you can contribute to XY in anyway possible, including writing reviews and spreading the word. And ofcourse if you are evaluating this product, consider buying it.

And here's the script:

Code: Select all

//Attach to Thunderbird
//Get item's path and names
    $items=chr(39).get("SelectedItemsPathNames",",").chr(39);
//Get item's names
    $itemnames=chr(39).get("SelectedItemsNames",", ").chr(39);
//Get item's names for subject
    $itemsubject=chr(39)."Emailing: ".get("SelectedItemsNames",", ").chr(39);
//Get item's names for body
  $itemnamesbody=chr(39).report("{#}) {name}<br>", 1).chr(39);
//Insert values into Thunderbird syntax
    $TB_Syntax= chr(34)."subject=$itemsubject,body=$itemnamesbody,attachment=$items".chr(34);

//Attach selected files to thunderbird's compose window 
//This method uses command prompt. 
    run "cmd /c cd /d C:\Program Files\Mozilla Thunderbird\ & thunderbird -compose $TB_Syntax";

IMPVGO
Posts: 9
Joined: 16 May 2011 02:48

Re: Add Send to E-Mail Recipient to Tool Bar

Post by IMPVGO »

serendipity wrote: This is possible. I hope you are learning some scripting to take full advantage of what XY can do. Also, I would appreciate if you can contribute to XY in anyway possible, including writing reviews and spreading the word. And ofcourse if you are evaluating this product, consider buying it.

And here's the script:

Code: Select all

//Attach to Thunderbird
//Get item's path and names
    $items=chr(39).get("SelectedItemsPathNames",",").chr(39);
//Get item's names
    $itemnames=chr(39).get("SelectedItemsNames",", ").chr(39);
//Get item's names for subject
    $itemsubject=chr(39)."Emailing: ".get("SelectedItemsNames",", ").chr(39);
//Get item's names for body
  $itemnamesbody=chr(39).report("{#}) {name}<br>", 1).chr(39);
//Insert values into Thunderbird syntax
    $TB_Syntax= chr(34)."subject=$itemsubject,body=$itemnamesbody,attachment=$items".chr(34);

//Attach selected files to thunderbird's compose window 
//This method uses command prompt. 
    run "cmd /c cd /d C:\Program Files\Mozilla Thunderbird\ & thunderbird -compose $TB_Syntax";

I am sure trying to learn scripting, although it is difficult. In any case, this has been a good learning experience. I had been trying to put-up a script with these characteristics for a while, but nothing concrete had come up. I sure will be making positive comments about XYPlorer, as I genuinely think is the best file manager there is, and if you know scripting like you do, there are endless possibilities. Overall, I am very satisfied with the customized button I now have in my toolbar. Thank-you very much.

Impvgo

serendipity
Posts: 3358
Joined: 07 May 2007 18:14
Location: NJ/NY

Re: Add Send to E-Mail Recipient to Tool Bar

Post by serendipity »

IMPVGO wrote:I am sure trying to learn scripting, although it is difficult. In any case, this has been a good learning experience. I had been trying to put-up a script with these characteristics for a while, but nothing concrete had come up. I sure will be making positive comments about XYPlorer, as I genuinely think is the best file manager there is, and if you know scripting like you do, there are endless possibilities. Overall, I am very satisfied with the customized button I now have in my toolbar. Thank-you very much.

Impvgo
Glad you like XYplorer. And for scripting, good place to start is : http://www.xyplorer.com/tour/index.php?page=scripting

sinilill
Posts: 111
Joined: 02 Dec 2013 18:37

Re: Add Send to E-Mail Recipient to Tool Bar

Post by sinilill »

Started to use Thunderbird and this script came very handy, only the command window seemed a little bit annoying, but there's a solution.
By adding the command 'start' before the executable the command window closes right after carrying out the command.

Example:

Code: Select all

old: run "cmd /c cd /d C:\Program Files\Mozilla Thunderbird\ & thunderbird -compose $TB_Syntax";
new: run "cmd /c cd /d C:\Program Files\Mozilla Thunderbird\ & start thunderbird -compose $TB_Syntax";
works also like this in my portable configuration:

Code: Select all

run "cmd /c start <xypath>\..\Thunderbirdportable\ThunderbirdPortable.exe -compose $TB_Syntax";

Post Reply