Minor scripting related wishes (a generic thread)

Features wanted...
TheQwerty
Posts: 4373
Joined: 03 Aug 2007 22:30

Re: Minor scripting related wishes (a generic thread)

Post by TheQwerty »

admin wrote:
TheQwerty wrote:I'm honestly surprised that this is a lot of work, I didn't expect retrieving the lists to be that difficult, but I understand if it is and that causes you some hesitation. However, I hope you reconsider your view of this as nothing more than configuration automation in assigning it a slot on the road map. 8)
It is difficult. List Management makes it look easy and straightforward, but under the hood there is blood sweat and tears.
I believed you the first time you said it! ;)

Though blood, sweat, and tears does seem like the right kind of challenge to de-stress from a massive localization project. :whistle:

admin
Site Admin
Posts: 64843
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: Minor scripting related wishes (a generic thread)

Post by admin »

It's good to know somebody cares for me. :)

TheQwerty
Posts: 4373
Joined: 03 Aug 2007 22:30

Re: Minor scripting related wishes (a generic thread)

Post by TheQwerty »

Some suggested enhancements to the Report SC.
  1. Rename itemlist option 0 to 'all currently visible list items' - this will make more sense after the next item.
  2. Introduce a new value, 2, for itemlist that would use 'all current list items (including those hidden by visual filters)' or 'all current list items'.
  3. Bring more meaning to these values by renaming them:
    • 0 could be :visible.
    • 1 could be :selection
    • 2 could be :list
    • And obviously [else] would be unchanged and still a pipe(|)-separated list of items (full path).

My reasoning goes back to the Filter by Extension script I did. It doesn't work well if you're trying to filter search results for a second+ time, because it cannot determine which extensions were visible before filtering began (which seems better than only listing those visible now).


In truth, I'm not sure there's much use beyond the case I just hit for 1 and 2, but 3 is something I'd like to see happen to most SC parameters that use numbers in a similar manner to report.

EDIT: In other words, perhaps any time you enhance or add SCs you could try to give numbered values alternate useful text names that can be used instead?

nerdweed
Posts: 648
Joined: 25 Feb 2012 07:47

Re: Minor scripting related wishes (a generic thread)

Post by nerdweed »

Request for a scripting function to return a random file

$file=randomfile(<directory>,<include subfolders>,<optional criteria>)


Can this be granted, please

highend
Posts: 14566
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: Minor scripting related wishes (a generic thread)

Post by highend »

You want a new script command for something that you can achieve with two lines of scripting? oO

Code: Select all

$files = folderreport("files", "r", "D:\Temp", "r", , "|");
	$rndFile = gettoken($files, rand(1, gettoken($files, "count", "|")), "|");
One of my scripts helped you out? Please donate via Paypal

binocular222
Posts: 1419
Joined: 04 Nov 2008 05:35
Location: Win11, Win10, 100% Scaling

Re: Minor scripting related wishes (a generic thread)

Post by binocular222 »

@Highend: Good to see you. I've posted solution to your XYS syntax highlighting in Sublime forum (also PM you in this forum too). Hope you can finnish it and share with everyone here.
I'm a casual coder using AHK language. All of my xys scripts:
http://www.xyplorer.com/xyfc/viewtopic. ... 243#p82488

nerdweed
Posts: 648
Joined: 25 Feb 2012 07:47

Re: Minor scripting related wishes (a generic thread)

Post by nerdweed »

highend wrote:You want a new script command for something that you can achieve with two lines of scripting? oO

Code: Select all

$files = folderreport("files", "r", "D:\Temp", "r", , "|");
	$rndFile = gettoken($files, rand(1, gettoken($files, "count", "|")), "|");
Though, I know it can be achieved with folderreport, sometimes an explicit function helps. Pulling a report of all files (in excess of 50000 files), for a random file name isn't justified. I trust Don can get a random file in a much efficient way. If that can't be done in a more efficient way, would have to use folderreport instead.

Filehero
Posts: 2713
Joined: 27 Feb 2012 18:50
Location: Windows 11@100%

Re: Minor scripting related wishes (a generic thread)

Post by Filehero »

Hi nerdweed,

I see how to get this work the highend's way might appear "somewhat cumbersome". However, I'd like to counter your conclusion by asking in return:
nerdweed wrote:Pulling a report of all files (in excess of 50000 files), for a random file name isn't justified.
Is it justified to extend the SC API for such an exotic use case?


Cheers,
Filehero

PS: Having SC supporting user functions would help to take off a lot of work from Don.... :whistle:

nerdweed
Posts: 648
Joined: 25 Feb 2012 07:47

Re: Minor scripting related wishes (a generic thread)

Post by nerdweed »

Filehero wrote:Hi nerdweed,

I see how to get this work the highend's way might appear "somewhat cumbersome". However, I'd like to counter your conclusion by asking in return:
nerdweed wrote:Pulling a report of all files (in excess of 50000 files), for a random file name isn't justified.
Is it justified to extend the SC API for such an exotic use case?


Cheers,
Filehero

PS: Having SC supporting user functions would help to take off a lot of work from Don.... :whistle:
I know it appears exotic, but I do believe it will open up nice other uses as well.


Why I asked for a SC, was because if I were to create a function for it on my own, my algorithm would have been
1. Pick a random folder/file from the folder
2. If its a folder, repeat from step 1.

I have lost the snippet of a VC#.net, where such a command existed and it was very responsive and that was around 2005.

I do understand Don has really nice ideas and occupied with them. I have just asked for it, I would be happy if Don agrees to give it, otherwise would have to search if I can make XYS and some other scripts play together to get this done.

TheQwerty
Posts: 4373
Joined: 03 Aug 2007 22:30

Re: Minor scripting related wishes (a generic thread)

Post by TheQwerty »

Some InputSelect wishes...
  1. Flag to enable the soon to be possible monospace font.
  2. When not using the checkbox style, the first item prefixed with a '+' should be selected, and all other plus-prefixes ignored/trimmed.
  3. Ability to provide custom icons as previously requested.
  4. Ability to insert separators again as previously requested.

admin
Site Admin
Posts: 64843
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: Minor scripting related wishes (a generic thread)

Post by admin »

Not this year. :)

TheQwerty
Posts: 4373
Joined: 03 Aug 2007 22:30

Re: Minor scripting related wishes (a generic thread)

Post by TheQwerty »

Awww... Not even 1 or 2? :(

Well if I'm going to have to wait anyhow.. let me add a fifth.
5. In lieu of separators, a '-' prefix which would disable the row and prevent the user from selecting it. Thus meaning I can insert separators without having to worry about stupid users selecting them.

TheQwerty
Posts: 4373
Joined: 03 Aug 2007 22:30

Re: Minor scripting related wishes (a generic thread)

Post by TheQwerty »

<xylng> Path and filename of the language file currently in use.
If none has been selected then it should either be blank or the URL to the latest (for that XY vers) reference file.

The latter would be nice in the case of needing to retrieve the English translation of say menu captions including access keys.

admin
Site Admin
Posts: 64843
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: Minor scripting related wishes (a generic thread)

Post by admin »

TheQwerty wrote:<xylng> Path and filename of the language file currently in use.
If none has been selected then it should either be blank or the URL to the latest (for that XY vers) reference file.

The latter would be nice in the case of needing to retrieve the English translation of say menu captions including access keys.
Hmm, I don't think scripting should mess with language files. Do you have an example for your needs? I maybe can add better ways to spill out menu captions including access keys.

TheQwerty
Posts: 4373
Joined: 03 Aug 2007 22:30

Re: Minor scripting related wishes (a generic thread)

Post by TheQwerty »

admin wrote:
TheQwerty wrote:<xylng> Path and filename of the language file currently in use.
If none has been selected then it should either be blank or the URL to the latest (for that XY vers) reference file.

The latter would be nice in the case of needing to retrieve the English translation of say menu captions including access keys.
Hmm, I don't think scripting should mess with language files. Do you have an example for your needs? I maybe can add better ways to spill out menu captions including access keys.
The variable would really only eliminate reading it from Language.ini; probably after forcing a settings save to ensure its accuracy.

It was something I ran into when attempting to solve this Application button main menu replacement request. The problem being I can get a list of commands and reconstruct the menu from copying the "List of All Commands" but if I want the access keys included in the captions I either have to extract the English ones from XYplorer.exe (I previously used strings.exe here) or I could possibly get them from the language file so that they're translated as well.

I'm not so much interested in messing with language files, but reading them could be useful, and might provide the capability of more easily offering scripts with "loose" translations.



That said if there were a better way to retrieve the menu / list of commands it could eliminate my needs entirely.

Off the top of my head, maybe something like this?

Code: Select all

CommandReport([template], [query=All], [flags=0]);

Template:
  {CID}          Command ID
  {Category}     CKS Category / Main Menu
  {Path}         {Category} | [Submenus |] {Command}
  {Command}      Command name only.
  {Description}  Description as shown in CKS.
  {Shortcuts}    Keyboard shortcuts.
  {Scope}        Shortcut scope.
  {MenuCaption}  Menu caption for command.
  {Checked}      1 = Menu items is checked; 0 = not checked, checkable, or in menu.*
  {State}        1 = Command is currently enabled; 0 = disabled.*

  Defaults to the List All Commands format: "{CID}<tab>{Path}<tab> ({Shortcuts})<crlf>"

Query:
  "All" or "*"                (Default) Retrieves all commands.
  Category / main menu name.  Retrieves only the commands in a given category.
  #CID                        Retrieves only the command specified by CID.
  #CID,CID                    Retrieves only the commands specified by CIDs.
  #START-END                  Retrieves the range of commands specified by CIDs.

Flags:
  0  (Default) Return all matching commands.
  1  Return only commands with keyboard shortcuts.
* I realize these may be pushing my luck. ;)


Something like that would be much better, but it's probably quite a bit more work than just exposing the language file via variable. :lol:


EDIT: Also care to comment on this previous post? http://www.xyplorer.com/xyfc/viewtopic. ... 752#p83752

Post Reply