Old 11-17-2019, 12:45 PM   #1
jbraner
Human being with feelings
 
jbraner's Avatar
 
Join Date: Nov 2017
Location: Edinburgh
Posts: 250
Default Can a script open a text file from disk?

Hi,

I have a simple script that I use for creating track notes.
It just opens the track notes and then opens a message box, so I can copy and paste some stuff in to the track notes.

It would be even easier if I could open a txt file (I'm in Windows), as formatting the message box is messy. It's easier to just use a text file.

Is there something I could put in my script to open E:\path\filename.txt?
Thanks
jbraner is offline   Reply With Quote
Old 11-17-2019, 12:51 PM   #2
Edgemeal
Human being with feelings
 
Edgemeal's Avatar
 
Join Date: Apr 2016
Location: ASU`ogacihC
Posts: 1,482
Default

Have a look at, reaper.ExecProcess, I use it something like,
reaper.ExecProcess('notepad.exe '.. filepath, -1)
Edgemeal is offline   Reply With Quote
Old 11-17-2019, 12:54 PM   #3
jbraner
Human being with feelings
 
jbraner's Avatar
 
Join Date: Nov 2017
Location: Edinburgh
Posts: 250
Default

Boy that was quick!
Thanks for that Edge meal - I figured there must be a way to do this, but I didn't really know where to look (except ask here)
jbraner is offline   Reply With Quote
Old 11-17-2019, 01:40 PM   #4
-_~
Human being with feelings
 
Join Date: Oct 2019
Posts: 19
Default

There's the CF_SetClipboard function, I think it's from SWS. You can get the contents of a file into the clipboard, ready for pasting anywhere...

Code:
local file = io.open("e:/path/filename.txt", "r")
local contents = file:read("*a")
file:close()
reaper.CF_SetClipboard(contents)
-_~ is offline   Reply With Quote
Old 11-17-2019, 03:27 PM   #5
jbraner
Human being with feelings
 
jbraner's Avatar
 
Join Date: Nov 2017
Location: Edinburgh
Posts: 250
Default

Quote:
Originally Posted by -_~ View Post
There's the CF_SetClipboard function, I think it's from SWS. You can get the contents of a file into the clipboard, ready for pasting anywhere...

Code:
local file = io.open("e:/path/filename.txt", "r")
local contents = file:read("*a")
file:close()
reaper.CF_SetClipboard(contents)
Thanks for that - it's an al ernative way - I'll try them both and see which works best.
jbraner is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 04:23 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2019, vBulletin Solutions Inc.