Bug - Not A Bug r26560 - Scripts menu missing user scripts

katyarn

Member
It looks like the scriptMRUList is a semicolon separated list but semicolons are valid in filenames on most filesystems.
 

fronobulax

Developer
Staff member
It looks like the scriptMRUList is a semicolon separated list but semicolons are valid in filenames on most filesystems.

That goes to show you how many people besides me use it :) Thank you.

I just checked because semi-colons once were not allowed on Windows. The best answer I found was that you cannot create a file with a semi colon in the file using exclusively Windows components but if you somehow create one on a *nix box and copy it to Windows, it will be treated as a valid filename for most commands.

So another delimiter needs to be used for any list filenames. I can add that to my pile but feel free to make a separate bug report.

Edit:

If this is to be believed (from https://stackoverflow.com/questions...orbidden-in-windows-and-linux-directory-names)

Code:
The forbidden printable ASCII characters are:

Linux/Unix:

  / (forward slash)

Windows:

  < (less than)
  > (greater than)
  : (colon - sometimes works, but is actually NTFS Alternate Data Streams)
  " (double quote)
  / (forward slash)
  \ (backslash)
  | (vertical bar or pipe)
  ? (question mark)
  * (asterisk)

Then the only real solution is to ask *nix users not to use a semi-colon in a script file name
 

Veracity

Developer
Staff member
I coded up an experiment: for bookmarks which are scripts, add them to the Scripts menu below Load Script... and above any scriptMRUlist scripts. It worked well. And then I noticed that just to the left of the Scripts menu is the Bookmarks menu, which has all those same scripts, as well as chat commands and cli commands - and it suddenly seemed less useful. :)
 

Veracity

Developer
Staff member
It looks like the scriptMRUList is a semicolon separated list but semicolons are valid in filenames on most filesystems.
Yes, although for systems with a command line that uses semicolons to separate commands, you have to quote them with back slashes. Similarly if we used, say, "|". Yes, you can quote that character to put them into a filename to access on the command line.

Curious: how would YOU propose formatting a property which is a list of file names?
 

katyarn

Member
Yes, although for systems with a command line that uses semicolons to separate commands, you have to quote them with back slashes. Similarly if we used, say, "|". Yes, you can quote that character to put them into a filename to access on the command line.

Curious: how would YOU propose formatting a property which is a list of file names?

Since directories are omitted from the list, why not forward slashes? They're the most common disallowed character for filenames across MacOS, Linux and Windows.
 
Last edited:

katyarn

Member
I still think submenu folders are a big missing feature from this change. I think it's very useful to be able to organize bookmarked scripts into folders like how scripts menu used to behave. It's the biggest reason why I wanted to revert to the previous system.
 

fronobulax

Developer
Staff member
I still think submenu folders are a big missing feature from this change. I think it's very useful to be able to organize bookmarked scripts into folders like how scripts menu used to behave. It's the biggest reason why I wanted to revert to the previous system.
Could you run an older version and show us a screenshot of this submenu feature that is now gone?
 

fronobulax

Developer
Staff member
Since directories are omitted from the list, why not forward slashes? They're the most common disallowed character for filenames across MacOS, Linux and Windows.
I'm not going to do that. I use other tools to process preferences files and they expect a / as a special character or part of a directory name. At this point it is easier for me to tell *inux users not to use a ; in a script file name.

I'm open to discussion later but not until the MRU list is working as I expect and I have the preference in a GUI.
 

Queen Zo

New member
I don't like the way scripts now don't show up on the mafia script list. It's a shame that we can't check a box in the preferences. "Check here if you want all your scripts to show up in the list like before, or leave it blank if you want to have it the new way."
 
Last edited:
I just checked because semi-colons once were not allowed on Windows. The best answer I found was that you cannot create a file with a semi colon in the file using exclusively Windows components but if you somehow create one on a *nix box and copy it to Windows, it will be treated as a valid filename for most commands.
Maybe that might have been true historically, but I've successfully used semicolons in file names on Windows since at least Windows 7, including in Windows Explorer no less.

Looking through my filesystem, there are a number of files dating back to even Windows XP days, though I guess most of those were either downloaded or created programmatically.
 
MCroft - Did you implement something that would generate the above or was it all done by directories under scripts/ ?
It has worked that way for years, at least, longer than MCroft has been a mafia dev.

This is why I solicited suggestions and bug reports. “The behavior changed” is not a good bug report. “The new feature is not working as intended” is a good bug report. “I miss such-and-such and here is an idea to get the essence of what I miss” is a good suggestion.
Ok, this just sucks.

Basically, you guys are telling me that the nice folder structure that I had setup and that was working perfectly (it even handled svn updates without any effort on my part) is now worse than useless, because the scriptMRUlist can't handle foldered scripts.
Edit: it seems it can, so that's something. Maybe Frono's guess was incorrect, or maybe something got updated. It still feels like mafia is telling me to reorganize my nicely organized scripts because someone else decided weren't organized the 'correct' way.

You don't. You complain a lot and hope others agree with you and then something gets reverted or added back in.
Well, add my name to the pile of complaints, I guess.
 
Last edited:

xKiv

Active member
Curious: how would YOU propose formatting a property which is a list of file names?

As far as I can see, kolmafia is already using a json library ... why not encode to a (stringified) json array? That should automagically take care of escaping any special characters, in a standard way.

If I am googling correctly (best intro I found is https://www.baeldung.com/java-org-json):
Code:
// formatting as string
JSONArray ja = new JSONArray(listOfStrings);
String str = ja.toString(); // AFAIK, this will produce a one-liner
// parsing a string
JSONArray ja = new JSONArray(str);
List<Object> list = ja.toList(); // or iterate for (int i=0; i< ja.length(); i++) { ja.getString(i); }
 

Veracity

Developer
Staff member
I’m working on optionally (default true) restoring the scripts with nested directories.

As before, it is mutually exclusive with the scriptMRU list..

And, personally, I will keep it off. I have quick script buttons on my GUI for all the scripts I use everyday, and I am looking forward to using bookmarks for the second tier. I expect the file picker to be substantially faster for me than trying to navigate around nested menus and figure out what I am looking for, which was always cumbersome and error prone.
 

fronobulax

Developer
Staff member
It has worked that way for years, at least, longer than MCroft has been a mafia dev.


Ok, this just sucks.

There was a lot of discussion about how to improve the Scripts Menu before hola returned. I could not remember which ideas were implemented. Hence tagging MCroft since if anything had been done I expected him to do it.

I should remind people that the old menu was an option and the script MRU was an opt in replacement for it.

Capture.JPG

The screenshot is from using the Load script... Option. All my scripts are there and my carefully constructed subdirectories are there and at the top. So the ability to keep scripts in subdirectories of your choice and run from there still exists. The "GUI" to access it has changed.

With that in mind let's talk about some concrete pain points. A look and feel that doesn't match mafia's? Having to click (multiple time) to find and run a script instead of sliding through cascading menus? It's just different? Something else?
 

fronobulax

Developer
Staff member
As far as I can see, kolmafia is already using a json library ... why not encode to a (stringified) json array? That should automagically take care of escaping any special characters, in a standard way.

If I am googling correctly (best intro I found is https://www.baeldung.com/java-org-json):
Code:
// formatting as string
JSONArray ja = new JSONArray(listOfStrings);
String str = ja.toString(); // AFAIK, this will produce a one-liner
// parsing a string
JSONArray ja = new JSONArray(str);
List<Object> list = ja.toList(); // or iterate for (int i=0; i< ja.length(); i++) { ja.getString(i); }
The context is a KoLmafia preference that has to be read and written by KoLmafia preference utilities and editable by a plain vanilla text editor. I'd still like to use gawk on preference files. So JSON may be the best solution but at this point I'd rather tell people they can't use a semi-colon in a script file name.
 

gausie

D̰͕̝͚̤̥̙̐̇̑͗̒e͍͔͎͈͔ͥ̉̔̅́̈l̠̪̜͓̲ͧ̍̈́͛v̻̾ͤe͗̃ͥ̐̊ͬp̔͒ͪ
Staff member
I think the case is that many people have grown very fond of their workarounds for a bad feature and what I'd like to hear is what people's problems are not what they'd like the solutions to be.

I liked @katyarn's suggestion of being able to organise bookmarks into folders, and I can imagine reflecting this heirarchy in the ctrl+k "command palette" to great effect.
 

MCroft

Developer
Staff member
I didn't make any changes outside of my sandbox. I didn’t get further than thinking about a UI, because refactoring the svn code to handle either git or Svn stopped me.

I think there are different ideas of what the feature should do. Do we want bookmarks, like a browser? Is that different from Custom Daily Deeds? What could be bookmarked? How should they be organized? Is this more like a text version of a customizable toolbar? Is this more like a plug-in/package manager?

It might be easier to discuss if we had a common understanding of the goal.
 
Top