Hi...i was wondering if there is a way to read line by line from an opened Notepad window....
i saw that readln does this but from a filename....
thanks...
Read line from opened window...
Moderators: Dorian (MJT support), JRL
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
ReadLn *does* read from a filename:
ReadLn>FILENAME,LINE_NUM,VAR_TO_STORE_LINE_IN
ReadLn>FILENAME,LINE_NUM,VAR_TO_STORE_LINE_IN
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?
Hi brahama,
Do you mean you want to write a script that can read the text inside a Notepad window before Notepad has saved the text to a file? If so, read about the GetControlText> command in the Help file then, enter and save this script:
- open a new Notepad window, type in 3 or 4 short lines of text but don't save the file
- run the above macro
- It will read all the text from Notepad and display it
- Click OK and it will display the text again, only CRLF (Carriage Return and Linefeed pairs) have been replaced with ~ characters. Did this just to prove that the CRLF pairs are there.
I don't think there is a convenient command or structure to just read in say... just the 3rd line... but since you can read the whole mess into a variable, you can then setup a loop to search through that variable, building lines as you go. Every time you hit a CRLF, you've read in another line so you could save that line in an array variable and when you had processed it all, you'd have all the lines loaded into the array. Want line three, its in linearray[3] or whatever you called it.
Hope this helped, take care.
Do you mean you want to write a script that can read the text inside a Notepad window before Notepad has saved the text to a file? If so, read about the GetControlText> command in the Help file then, enter and save this script:
Code: Select all
GetControlText>Untitled - Notepad,Edit,1,npEdit
MDL>Here's the text in your Notepad window:%CRLF%%CRLF%%npEdit%
StringReplace>npEdit,%CRLF%,~,npEdit
MDL>Here's that text again only we've replaced all the CRLF pairs with a ~%CRLF%%CRLF%%npEdit%
- run the above macro
- It will read all the text from Notepad and display it
- Click OK and it will display the text again, only CRLF (Carriage Return and Linefeed pairs) have been replaced with ~ characters. Did this just to prove that the CRLF pairs are there.
I don't think there is a convenient command or structure to just read in say... just the 3rd line... but since you can read the whole mess into a variable, you can then setup a loop to search through that variable, building lines as you go. Every time you hit a CRLF, you've read in another line so you could save that line in an array variable and when you had processed it all, you'd have all the lines loaded into the array. Want line three, its in linearray[3] or whatever you called it.
Hope this helped, take care.
jpuziano
Note: If anyone else on the planet would find the following useful...
[Open] PlayWav command that plays from embedded script data
...then please add your thoughts/support at the above post -
Note: If anyone else on the planet would find the following useful...
[Open] PlayWav command that plays from embedded script data
...then please add your thoughts/support at the above post -
Glad to hear. If you're willing to share your finished script, please post it here as it may be just the thing others are looking for. Also, quite often someone else may suggest an improvement that you may not have thought of.brahama wrote:thats exactly what i wanted jpuziano....i will try it now....great explanation...thanks a lot....
Take care
jpuziano
Note: If anyone else on the planet would find the following useful...
[Open] PlayWav command that plays from embedded script data
...then please add your thoughts/support at the above post -
Note: If anyone else on the planet would find the following useful...
[Open] PlayWav command that plays from embedded script data
...then please add your thoughts/support at the above post -