Page 12 of 28

Re: Minor scripting related wishes (a generic thread)

Posted: 17 Jan 2013 22:22
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:

Re: Minor scripting related wishes (a generic thread)

Posted: 18 Jan 2013 09:15
by admin
It's good to know somebody cares for me. :)

Re: Minor scripting related wishes (a generic thread)

Posted: 07 Mar 2013 20:06
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?

Re: Minor scripting related wishes (a generic thread)

Posted: 08 Jun 2013 12:56
by nerdweed
Request for a scripting function to return a random file

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


Can this be granted, please

Re: Minor scripting related wishes (a generic thread)

Posted: 08 Jun 2013 13:35
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", "|")), "|");

Re: Minor scripting related wishes (a generic thread)

Posted: 08 Jun 2013 13:56
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.

Re: Minor scripting related wishes (a generic thread)

Posted: 08 Jun 2013 15:15
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.

Re: Minor scripting related wishes (a generic thread)

Posted: 08 Jun 2013 16:03
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:

Re: Minor scripting related wishes (a generic thread)

Posted: 08 Jun 2013 22:38
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.

Re: Minor scripting related wishes (a generic thread)

Posted: 20 Jun 2013 21:26
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.

Re: Minor scripting related wishes (a generic thread)

Posted: 20 Jun 2013 21:28
by admin
Not this year. :)

Re: Minor scripting related wishes (a generic thread)

Posted: 20 Jun 2013 21:32
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.

Re: Minor scripting related wishes (a generic thread)

Posted: 16 Jul 2013 17:01
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.

Re: Minor scripting related wishes (a generic thread)

Posted: 17 Jul 2013 08:07
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.

Re: Minor scripting related wishes (a generic thread)

Posted: 17 Jul 2013 14:17
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