AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

FileRead & FileAppend problem

 
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
Da Rossa



Joined: 06 Dec 2007
Posts: 361

PostPosted: Fri Dec 11, 2009 12:46 am    Post subject: FileRead & FileAppend problem Reply with quote

Hi ahk experts!
Let me bring you a simple "challenge":
Lets say I have a exactly the following on my clipboard:

Code:
C:\file 10-12.txt
C:\file 7-12.txt
C:\file 8-12.txt
C:\file 9-12.txt


The fact that all file paths are in different lines is relevant. But there isn't a command that can read lines from the clipboard content, like FileReadLine does with text files. The idea is to transpose the clipboard data to a text file so the lines can be read in sequence.

But using FileAppend will not make that possible unless there is a way to have the above become:
Code:
C:\file 10-12.txt`nC:\file 7-12.txt`nC:\file 8-12.txt`nC:\file 9-12.txt

...automatically.

What can I do in this case?

thanks for any help.
_________________
AHK is perfect.
Back to top
View user's profile Send private message
Guest






PostPosted: Fri Dec 11, 2009 12:53 am    Post subject: Reply with quote

Code:
data = %clipboard%
Loop, parse, data, `n, `r
{
    MsgBox, 4, , Line number %A_Index% is %A_LoopField%.`n`nContinue?
    IfMsgBox, No, break
}

?
Back to top
Da Rossa



Joined: 06 Dec 2007
Posts: 361

PostPosted: Fri Dec 11, 2009 7:02 am    Post subject: Reply with quote

Nice! this makes it look so easy! But the fact is that I didn't tell you where I'd apply that. That is to make faster the e-mail attachments in Thunderbird. I had to send to a mate four text files at the very end of the class, when none of us had time to wait. Since I was using the notebook, the trackpad makes it even nastier.

What I was thinking:
1- Put the clipboard content (which I got from xplorer˛, a fantastic Windows Explorer replacement by hitting Alt+C, a built-in function that copies the file(s) path(s) to the clipboard) in a text file;
2- Activate the Thunderbird window, have ahk send "!axa" to open the attachments dialog;
3- Fill in the contents of the above text file's line 1, which is the path to the first file
4- Hit enter to attach
5- Repeat this until all are attached.

OR

Take that file list, and use winrar's command line functions to quickly zip them and attach in the Thunderbird message, which could be even more complicated.

But I think both ideas above are complicated and not so well reliable.

What would you suggest me to accomplish this? Smile
_________________
AHK is perfect.
Back to top
View user's profile Send private message
SoLong&Thx4AllTheFish



Joined: 27 May 2007
Posts: 4999

PostPosted: Fri Dec 11, 2009 7:45 am    Post subject: Reply with quote

Look at the various script to automate email, why reinvent the wheel? Personally I'd use blat but you can use http://www.autohotkey.com/forum/viewtopic.php?t=39797&highlight=blat for example

That way all is done by ahk and relies on programs running and sending key strokes.
_________________
AHK Wiki FAQ
TF : Text files & strings lib, TF Forum
Back to top
View user's profile Send private message
Da Rossa



Joined: 06 Dec 2007
Posts: 361

PostPosted: Fri Dec 11, 2009 7:03 pm    Post subject: Reply with quote

Because this would not be only about sending e-mails, but this routine can be applied to many things. Yesterday, when I was thinking about a way to do it, I realised, for example, that this can be done to send attachments in an e-mail and also make it use the rar/unrar functions of winrar more quickly. That's why I need a way to have the cliboard content to interact with a text file plus the fileappend and fileread commands. ?)
_________________
AHK is perfect.
Back to top
View user's profile Send private message
SoLong&Thx4AllTheFish



Joined: 27 May 2007
Posts: 4999

PostPosted: Fri Dec 11, 2009 8:08 pm    Post subject: Reply with quote

I assume - I don't use rar as it is for nerds only Smile - rar can read a filelist from a file (zip can, so rar can to I think), so can ahk. Thus solution is simple: save clipboard to file and do with it what you want: pass on the filelist.txt to rar via cmdline parameter to rar (or zip) files. Launch ahk script to that reads filelist and does something with it like emailing via blat or ahk method. Save clipboard to file Exclamation

Edit: Total Commander is far superior in my opinion Wink

Edit2: You do realise you can save the clipboard with fileappend don't you?
Code:
FileAppend, %clipboard%, filelist.txt
Otherwise I don't understand the question actually
_________________
AHK Wiki FAQ
TF : Text files & strings lib, TF Forum
Back to top
View user's profile Send private message
Da Rossa



Joined: 06 Dec 2007
Posts: 361

PostPosted: Tue Feb 16, 2010 12:22 am    Post subject: Reply with quote

Wow its been quite a long time since I started this thread!

Now I'd like to ask you two things hugoV:

1 - The thing I want has not gone cold but I was reading your previous post about e-mail via command line and I got interested. Perhaps this is more important now: I Googled about Blat and found it. Such a tiny application! I appeared to be simple and functional, but, when trying to configure a gmail account to send via smtp, using some info from the documentation and some of the echoes from the program itself, I saw one error after another. Got very sad and don't know what to do. Assuming I have setup a fresh new Gmail account, what to do next?

2 - Whats so special about total commander? I like xplorer˛ because it is simple, besides powerful, and has the very nice and necessary rectangle selection! Or does TC have it too?

p.s. Mods, if this has gone so offtopic it's beyond the forum rules, please let me know so I can open this in another area in this forum. Smile
_________________
AHK is perfect.
Back to top
View user's profile Send private message
SoLong&Thx4AllTheFish



Joined: 27 May 2007
Posts: 4999

PostPosted: Tue Feb 16, 2010 8:19 am    Post subject: Reply with quote

Google for blat gmail and a few pages will turn up I'm sure, here is one that might get you started http://www.lifehacker.com/software/email/geek-to-live-automatically-email-yourself-file-backups-168156.php so I assume something like Blat -install smtp.google.com your-funny-account-at@gmail.com typed at the command line prompt (dos box) to begin with. (Search the forum for blat as well)

Re: TC what is not to like? It has the familiar two panel interface which might take a bit of getting used to but you can customize it there are many many many plugins and hidden features, built in FTP, directory bookmarks for quick navigation (and you can use a script to read those bookmarks and use them in your windows open/file dialogs) still runs on Win98, has tabs etc the list is endless. No sure what you mean by rectangular selection but you have many options to quickly sort and select specific file types with keyboard or mouse). It does have a learning curve so you would really have to use it for a few weeks before you get a hang of it, but once you master it nothing will beat it. But as always a filemanager is something of a personal preference so it might not be for you. You can try the TC shareware version for 30 days or so, but its well worth the money (lifetime free updates).
_________________
AHK Wiki FAQ
TF : Text files & strings lib, TF Forum
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group