Page 1 of 1
insert file
Posted: Thu Mar 14, 2013 10:16 pm
by G74SX
I am looking for a way to insert a file into a document being edited.
I found the fileinsert macro but it doesn't seem to work, or most likely I am not using it correctly.
Posted: Thu Mar 14, 2013 10:31 pm
by jussij
I am looking for a way to insert a file into a document being edited.
There are several ways you can do this.
The first is to use the
FileInsertAtCursor keyboard function which you can easily bind to any keyboard key combination.
Another option would be to write a custom macro script (like the file_insert macro).
I found the file_insert macro but it doesn't seem to work, or most likely I am not using it correctly.
I had a look at the macro and I think the issue is that the Lua
io.open function has change between Lua versions.
To fix this open the
file_insert.lua file and find this text:
Code: Select all
-- open the file selected for text reading mode
local file_in = io.open(file_name, "r+t")
Change that code to read as follows:
Code: Select all
-- open the file selected for text reading mode
local file_in = io.open(file_name, "r")
The macro should now work fine.
Thank you for taking the time to report the error in the script
Cheers Jussi
Posted: Fri Mar 15, 2013 12:54 am
by G74SX
The keyboard function works great.
Thanks.
Posted: Mon May 06, 2013 4:14 pm
by polixx
I tried using the option one which is FileInsertAtCursor keyboard function and yes it really works! thanks for the inputs.