How do I implement copied text into a text file through WriteLn?
Thanks for reading.
Copy text through WriteLn
Moderators: Dorian (MJT support), JRL
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
WriteLn writes text to the end of a text file.
Feel free to elaborate on your question but I'm guessing that what you want to do is modify a file by inserting text somewhere in the middle - i.e. not at the end of the file.
To do that what you would normally do is read the file in first using ReadFile. Then use string manipulation using e.g. RegEx/StringReplace/Position/MidStr and you may or may not use a loop, so that you end up with a large string which is what you want your updated file to contain.
So finally you would delete the old file, then write out the new chunk of text to file using WriteLn using the old filename (or use a new filename and do the delete and rename later).
Feel free to elaborate on your question but I'm guessing that what you want to do is modify a file by inserting text somewhere in the middle - i.e. not at the end of the file.
To do that what you would normally do is read the file in first using ReadFile. Then use string manipulation using e.g. RegEx/StringReplace/Position/MidStr and you may or may not use a loop, so that you end up with a large string which is what you want your updated file to contain.
So finally you would delete the old file, then write out the new chunk of text to file using WriteLn using the old filename (or use a new filename and do the delete and rename later).
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
What I meant is that, after you copied the text (say, after pressing Ctrl + C), then I want to use this copied text and put it into a file directly, without the need to open the file and paste it. Basically pasting the content at the end of the file without actually opening the file. Would that be possible?
PPQ
Code: Select all
//get text from the clipboard and assign it to the variable "data"
GetClipBoard>data
//Write the value of "data" to a file
WriteLn>%temp_dir%clipboard_text.txt,wres,data
Thanks for the advice!JRL wrote:Code: Select all
//get text from the clipboard and assign it to the variable "data" GetClipBoard>data //Write the value of "data" to a file WriteLn>%temp_dir%clipboard_text.txt,wres,data
PPQ