Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.
 Entire forum ➜ MUSHclient ➜ General ➜ Notepad

Notepad

It is now over 60 days since the last post. This thread is closed.     Refresh page


Posted by Donecce   (16 posts)  Bio
Date Sat 24 Jan 2015 01:40 PM (UTC)
Message
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.
Top

Posted by Nick Gammon   Australia  (23,121 posts)  Bio   Forum Administrator
Date Reply #1 on Sat 24 Jan 2015 08:36 PM (UTC)
Message
Can you post what you tried, describe what you expect exactly, and what happens, exactly.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Donecce   (16 posts)  Bio
Date Reply #2 on Sat 24 Jan 2015 11:15 PM (UTC)
Message
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?
Top

Posted by Donecce   (16 posts)  Bio
Date Reply #3 on Sat 24 Jan 2015 11:48 PM (UTC)
Message
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.
Top

Posted by Donecce   (16 posts)  Bio
Date Reply #4 on Tue 27 Jan 2015 05:25 PM (UTC)
Message
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.
Top

Posted by Donecce   (16 posts)  Bio
Date Reply #5 on Fri 06 Feb 2015 12:54 PM (UTC)
Message
In case anyone else stumbles down this path...

Calling world.Open() on a text file accomplishes exactly what I was trying with the notepad.
Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


14,766 views.

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.