I would like to open saved text files in Mushclient notepad windows from a plugin popup menu. I can't figure out how to open or append them using a folder path. Putting the path in the title for AppendToNotepad and SendToNotepad isn't working like I expected.
Notepad
Posted by Donecce on Sat 24 Jan 2015 01:40 PM — 6 posts, 20,567 views.
Can you post what you tried, describe what you expect exactly, and what happens, exactly.
local function NotePad(filename)
local fn = G.WORLD_PATH .. filename .. ".txt"
print("!", fn)
local is_open = false
for _, n in ipairs (GetNotepadList(true) or {}) do
print(n, "!")
if fn == n then
is_open = true
break
end
end
if not is_open then G.world.AppendToNotepad (fn, "") end
return G.world.ActivateNotepad (fn)
end
It (fn) looks ok when I print it, but in the dialog to save the file, it is transformed to something like,
C--users-mushclient-worlds-foo-bar.txt
If I manually open the existing file first and run this, then under the Window tab I will see both the windows opened, with apparently the same name, but they are not the same file. Running again, GetNotepadList finds the one with the transformed name. When I use argument true in GetNotepadList, it seems to find one with a title of "", which is maybe pointing to the one I really want?
local fn = G.WORLD_PATH .. filename .. ".txt"
print("!", fn)
local is_open = false
for _, n in ipairs (GetNotepadList(true) or {}) do
print(n, "!")
if fn == n then
is_open = true
break
end
end
if not is_open then G.world.AppendToNotepad (fn, "") end
return G.world.ActivateNotepad (fn)
end
It (fn) looks ok when I print it, but in the dialog to save the file, it is transformed to something like,
C--users-mushclient-worlds-foo-bar.txt
If I manually open the existing file first and run this, then under the Window tab I will see both the windows opened, with apparently the same name, but they are not the same file. Running again, GetNotepadList finds the one with the transformed name. When I use argument true in GetNotepadList, it seems to find one with a title of "", which is maybe pointing to the one I really want?
I apologize. I didn't provide everything you asked for.
What I want exactly:
to click on a mini-window map, open a menu via a hotspot, select "Notepad", then create, open, or activate a specific text file in a Mushclient Notepad window. Ultimately, I'd want the menu to provide other actions to call on the Notepad, but I'm content just getting the correct file opened for now.
What happens exactly:
It creates a new Notepad window with a title that is NEARLY what I want, as described in the previous post.
I'm left thinking it's some kind of OS or Mushclient setting, or something about lua strings that I just have no clue about.
Thank you.
What I want exactly:
to click on a mini-window map, open a menu via a hotspot, select "Notepad", then create, open, or activate a specific text file in a Mushclient Notepad window. Ultimately, I'd want the menu to provide other actions to call on the Notepad, but I'm content just getting the correct file opened for now.
What happens exactly:
It creates a new Notepad window with a title that is NEARLY what I want, as described in the previous post.
I'm left thinking it's some kind of OS or Mushclient setting, or something about lua strings that I just have no clue about.
Thank you.
I apologize again. I think I have misunderstood the use of the Notepad. I will try to launch the Windows Notepad with a filename instead.
Thank you.
Thank you.
In case anyone else stumbles down this path...
Calling world.Open() on a text file accomplishes exactly what I was trying with the notepad.
Calling world.Open() on a text file accomplishes exactly what I was trying with the notepad.