AutoHotkey Community

It is currently May 27th, 2012, 12:26 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 199 posts ]  Go to page Previous  1, 2, 3, 4, 5, 6, 7 ... 14  Next
Author Message
 Post subject:
PostPosted: February 2nd, 2009, 7:39 am 
Offline

Joined: April 19th, 2005, 10:26 am
Posts: 2250
Location: switzerland
DOS command type writes all *.txt files to one text file
can use also ahk commands Loop read fileappend
Code:
Txtfiles = c:\txtfiles                 ;Folder for all txt files
FilesALL = %TxtFiles%\_alltxt.tx_      ;File for all txt files

ifexist,%TxtFiles%\_alltxt.txt
  FileDelete,%TxtFiles%\_alltxt.txt

setworkingdir,%TxtFiles%

     runwait %comspec% /c type *.txt >%FilesALL%,,hide    ;hidden
     ;runwait %comspec% /k type *.txt >%FilesAll%

;--- if you want to sort -------
;FileRead,AA,%FilesAll%
;FileDelete,%FilesAll%
;Sort,AA,U
;FileAppend,%AA%,%FilesAll%

FileMove, %FilesAll%,%TxtFiles%\_alltxt.txt   ;rename

setworkingdir,%A_scriptdir%
ifexist,%TxtFiles%\_alltxt.txt
  run,%TxtFiles%\_alltxt.txt
else,
 msgbox,File not exist`n%TxtFiles%\_alltxt.txt
exitapp


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 2nd, 2009, 8:00 am 
Offline
User avatar

Joined: December 21st, 2007, 3:14 pm
Posts: 3826
Location: Louisville KY USA
omg did any of you even look at Seans well written script

Code:
sAttach   := "C:\Program Files\AutoHotkey\lib\at.ahk|C:\Program Files\AutoHotkey\lib\ap.ahk|C:\some.zip" ; can add multiple attachments, the delimiter is |
Seriously dont play with big toys if your not gonna pay attention

_________________
No matter what your oppinion Please join this discussion
Formal request to Polyethene
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 2nd, 2009, 9:38 am 
Offline

Joined: January 26th, 2009, 7:14 am
Posts: 32
tank wrote:
omg did any of you even look at Seans well written script

Code:
sAttach   := "C:\Program Files\AutoHotkey\lib\at.ahk|C:\Program Files\AutoHotkey\lib\ap.ahk|C:\some.zip" ; can add multiple attachments, the delimiter is |
Seriously dont play with big toys if your not gonna pay attention



i looked at it..what i'm asking is to scan for all .txt files then attach that into email..


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 2nd, 2009, 11:16 am 
Offline

Joined: April 19th, 2005, 10:26 am
Posts: 2250
Location: switzerland
thank you tank for the example
here just a small ahk script to select a folder and then copy all txt ( or other) files to c:\_COPIED1
Code:
COPIED        =c:\_COPIED1
run,%COMSPEC% /C if not exist \%COPIED%\NUL MD %Copied%,,hide

FileSelectFolder,Var1, , 3
if VAR1=
   exitapp
Loop, %var1%\*.*, , 1
   {
   A=%A_loopfileext%
   if (A="txt" or a="lnk" or a="rtf")    ;(extension)
      {
      SplitPath,A_LoopFileFullPath, namex, dir, ext, name_no_ext, drive
      Filecopy,%A_LoopFileFullPath%,%copied%\%namex%
      }
   }
run,%copied%
exitapp



another example with drag and drop


Code:
;--------------------- drag&drop example ( used for blat.exe ) -----------------------------------------------
MODIFIED  = 20090202
Filename1 = Drag&Drop Example

#NoEnv
#SingleInstance force
SetBatchLines,-1
setworkingdir, %a_scriptdir%
AutoTrim Off

txtfil=_FileText.txt
binfil=_Filebin.txt

ifexist,%txtfil%
  filedelete,%txtfil%
ifexist,%binfil%
  filedelete,%binfil%

Gui,3:default
Gui,3:Color, 000000
Gui,3:Font,S10 CDefault,Verdana

Gui 3:Add, Text,        x100  y10         cWhite        ,ATTACHMENTS put here
Gui 3:Add, Edit,cWhite  x6    y40  w750  h350 vMsg2 readonly,              ;ATTACH input files her

Gui 3:Add, Button, x570  y5   w90   h25  gClearMSG2, CLEAR-ATT
Gui 3:Show,        x10   y30  w770  h370         ,%filename1%
Return
;---------------
3GuiClose:
3GuiEscape:
ExitApp
;-----------------

CLEARMSG2:
Gui,3:submit,nohide
Selectedfilename=
GuiControl,3:,MSG2,%nothing%
ifexist,%txtfil%
  filedelete,%txtfil%
ifexist,%binfil%
  filedelete,%binfil%
return


3GuiDropFiles:
Gui,3:submit,nohide

Loop, parse, A_GuiEvent, `n
    {
    SelectedFileName = %SelectedFileName%`r`n%A_LoopField%     ;write files-names
    SplitPath,A_loopfield, name, dir, ext, name_no_ext, drive
    if ext=txt
         Fileappend,%A_LoopField%`,,%txtfil%
      else
         Fileappend,%A_LoopField%`,,%binfil%
    }

GuiControl,3:,MSG2,%SelectedFileName%
return
;---------------------------------------------------------------------------


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 2nd, 2009, 11:20 am 
Might be of interest too: [Outlook Redemption - Access Outlook using Data Objects [COM] 8)


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: February 2nd, 2009, 2:18 pm 
Offline
User avatar

Joined: December 21st, 2007, 3:14 pm
Posts: 3826
Location: Louisville KY USA
kizsleg wrote:
i looked at it..what i'm asking is to scan for all .txt files then attach that into email..
help file parsing loop thats all im gonna say

_________________
No matter what your oppinion Please join this discussion
Formal request to Polyethene
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 17th, 2009, 5:47 pm 
Code:
sFrom     := "Mail_Address_Of_Sender"
sTo       := "Mail_Address_Of_Receipient"
sSubject  := "Message_Subject"
sBody     := "Message_Text"
sAttach   := "Path_Of_Attachment" ; can add multiple attachments, the delimiter is |
Unfortunately I've to send the mail (a daily notification list from one of my processes) to a fixed set of two distribution lists and 3 single persons. Before spamming them with mails (because I've no test environment), I had decided to better ask beforehand: is it possible to send a mail to several addressees in one go, this way: "xyz@xyz.com;abc@xyz.com;123@xyz.com" (the way its done in the Outlook address bar) from within the above given code snippet ??

Any advise will be appreciated. Thx for your time 8)


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: February 17th, 2009, 9:52 pm 
Offline

Joined: October 4th, 2006, 2:15 am
Posts: 250
Location: Louisville, KY
Yes, it handles multiple recipients.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 17th, 2009, 10:36 pm 
Thx for the confirmation :D


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: February 18th, 2009, 12:45 pm 
If you're not a NOOB, you've to leave this post NOW :!: 8)

Send the mails body as text ...
Code:
COM_Invoke(pmsg, "From", sFrom)
COM_Invoke(pmsg, "To", sTo)
COM_Invoke(pmsg, "Subject", sSubject)
COM_Invoke(pmsg, "TextBody", sBody)
... or as HTML ...
Code:
COM_Invoke(pmsg, "From", sFrom)
COM_Invoke(pmsg, "To", sTo)
COM_Invoke(pmsg, "Subject", sSubject)
COM_Invoke(pmsg, "HTMLBody", sBody)


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: February 18th, 2009, 12:50 pm 
Online
User avatar

Joined: December 26th, 2005, 4:40 pm
Posts: 8776
:o Thanks BoBo :D


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 18th, 2009, 1:30 pm 
Offline

Joined: February 12th, 2007, 7:54 am
Posts: 2462
Quote:
or as HTML
So, you never read the posts.
Sean wrote:
I changed the variable sText to sBody as there exists also a function HTMLBody in addition to TextBody.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 18th, 2009, 2:32 pm 
Quote:
So, you never read the posts.
Never say never. Well, I wouldn't say it this way + "it depends". There are threads (especially yours) which are quite frequented. And therefore, to read each and every post could become a real challenge (beside the fact that this doesn't mean necessarilly, to be able to understand each and everything!). You're a pro, I'm a noob. Lets be fair. 8)

+TBH, I had already created an additional request, and at the moment I wanted to send it, I realized that TextBody-tag, so - I've done a test and it worked to change it to HTMLBody. Yeehaa :shock: :D

But let me quote my own statement "If you're not a NOOB, you've to leave this post NOW", and ask you this: So, you never read that statement? :wink::lol:

Thx for your effort & time. Much appreciated. 8)


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: March 23rd, 2009, 11:46 pm 
Offline

Joined: March 2nd, 2009, 7:05 pm
Posts: 6
hey Sean... does this really work?:

Code:
sFrom     := "my.mail@gmail.com"


is there any way to put "myself" and then the from field say myself?... 'cause i try but nothin'... it will be good because i'm sending messages to a cellphone and the "..@gmail.com" is very annoying and let me no space for other characters

it will be very good using it like "jhon: textmessage blah" and not "my.mail@gmail.com: textmessage blah"

_________________
oh darn, i just lose all that GWBasic data...


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 24th, 2009, 12:42 am 
Offline

Joined: February 12th, 2007, 7:54 am
Posts: 2462
suehprom wrote:
it will be very good using it like "jhon: textmessage blah" and not "my.mail@gmail.com: textmessage blah"
Why don't you just try it? I don't think From part is that crucial.


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 199 posts ]  Go to page Previous  1, 2, 3, 4, 5, 6, 7 ... 14  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: Bon, SKAN, Yahoo [Bot] and 5 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group