Undocumented script commands - Suggestions

Discuss and share scripts and script files...
Post Reply
highend
Posts: 13274
Joined: 06 Feb 2011 00:33

Undocumented script commands - Suggestions

Post by highend »

Please suggest all script commands that are still undocumented (by Don).

Please add as much of your own documentation that you can (syntax, examples, etc.)!

I'll add them to the main (locked) thread afterwards (http://www.xyplorer.com/xyfc/viewtopic.php?f=7&t=13581).

Thanks for all contributions!



WARNING for visitors: undocumented commands are liable to vanish without a moment's notice. Exercise caution.
(This applies particularly to least-used, debug commands, those that have no conceivable use in regular scripting, but again, no undocumented command is perfectly safe.)
One of my scripts helped you out? Please donate via Paypal

bdeshi
Posts: 4249
Joined: 12 Mar 2014 17:27
Location: Asteroid B-612 / Dhaka
Contact:

Re: Undocumented script commands - Suggestions

Post by bdeshi »

list each command in separate posts at the target topic. Better for linking.

Here's a nice template :whistle:

----
cmd or func()
Description

Syntax

Code: Select all

command [[params], [params=default]]
function([[params], [params=default]])

param1    description
          more description
           option1    description
                      more
           option2    description
Return
the return of the functions

Example Remarks
Text

History
  • <reverse chronological summary of versions where changes occurred>
  • <try to link each one to that version's change log post (and include code-block quote of any mentions)>
  • v??.??.???? - yyyy-mm-dd hh:nn - Introduction
See Also
Icon Names | Onyx | Undocumented Commands | xypcre
[ this user is asleep ]

bdeshi
Posts: 4249
Joined: 12 Mar 2014 17:27
Location: Asteroid B-612 / Dhaka
Contact:

Re: Undocumented script commands - Suggestions

Post by bdeshi »

unthumb
removes all thumbnails from the current list (only the icons will be shown for the files) and closes the related cache files.

Syntax

Code: Select all

unthumb [pane=a]

pane    the pane to work on. Defaults to "a" for active pane.
        possible values:
         a    active pane
         i    inactive pane
         1    first pane
         2    second pane
Example

Code: Select all

unthumb i; //removes thumbnails from the inactive pane
History
  • v14.50.0306 - 2014-11-16 20:11

    Code: Select all

        * SC unthumb: Added flag to refer to the pane to unthumb.
          Syntax: unthumb [pane=a]
          Examples:
            unthumb;
            unthumb a;
            unthumb i;
            unthumb 1;
            unthumb 2;
    [/size]
  • v14.50.0305 - 2014-11-16 15:45 - Introduction

    Code: Select all

        + Scripting: Added an undocumented command that removes all thumbs from the 
          current list (only the icons will be shown for the files) and closes the 
          related cache files:
            unthumb;
    [/size]
See Also
Icon Names | Onyx | Undocumented Commands | xypcre
[ this user is asleep ]

bdeshi
Posts: 4249
Joined: 12 Mar 2014 17:27
Location: Asteroid B-612 / Dhaka
Contact:

Re: Undocumented script commands - Suggestions

Post by bdeshi »

Documented officially now.
--
freshhere
Runs a new XYplorer instance with factory defaults, opened to current path.

Syntax

Code: Select all

freshhere
Example

Code: Select all

freshhere;
Remarks
Since v14.80.0215, Fresh mode sets the App Data Path to subfolder "Fresh" of the normal App Data Path. This way it's impossible that any of your everyday settings are inadvertedly overwritten by the fresh instance.

History
Last edited by bdeshi on 26 Mar 2015 07:39, edited 2 times in total.
Icon Names | Onyx | Undocumented Commands | xypcre
[ this user is asleep ]

binocular222
Posts: 1416
Joined: 04 Nov 2008 05:35
Location: Hanoi, Vietnam

Re: Undocumented script commands - Suggestions

Post by binocular222 »

sendkeys
Simulate keyboard keypresses.

Syntax

Code: Select all

sendkeys [keys=""]

keys    keycode(s) to simulate. Multiple keycodes can be joined together as a string and sent in sequence.
        See "Remarks" section for details.
Example

Code: Select all

 setlayout("ShowAddressBar=1"); focus A; //focus addressbar...
 sendkeys "^a"; sendkeys "{<}xydata+.~"; //... select all (CTRL+A), type <xydata>, and go there (ENTER)

Code: Select all

 sendkeys "{5 5}"; //send 5 five times.
Remarks
  • To send special and exact keys, enclose key name within { }, for example: {Tab}, {%} {A}, {<}, {F1}, {{}
  • To specify that any combination of modifier keys should be held down while several other keys are pressed, enclose the code for those keys in parentheses.
    For example, to simulate SHIFT held down while E and C are pressed, use "+(ec)".
  • A single key can be sent multiple times: "{L 5}" sends L 5 times. Note that only one character at a time can be sent this way.
All possible keycodes with a detailed syntax can be found on https://msdn.microsoft.com/en-us/librar ... 60%29.aspx (the wait parameter in the linked document does not apply here citation needed)
Some often-used/special keycodes:

Code: Select all

+ SHIFT, ^ CTRL, % ALT, ~ ENTER, {%}  %, {Esc} ESCAPE, {Tab} TAB
Depend on your keyboard settings, result may differ, i.e: "+." would translate to ">" on English keyboard layout but to ":" on German layout.
Last edited by binocular222 on 12 Apr 2016 08:59, edited 4 times in total.
I'm a casual coder using AHK language. All of my xys scripts:
http://www.xyplorer.com/xyfc/viewtopic. ... 243#p82488

binocular222
Posts: 1416
Joined: 04 Nov 2008 05:35
Location: Hanoi, Vietnam

Re: Undocumented script commands - Suggestions

Post by binocular222 »

edittags
Opens a dialog for viewing and modifying the in-memory tags.dat data.

Syntax

Code: Select all

edittags
Example

Code: Select all

edittags;
History
  • v7.90.0079 - 2009-01-28 13:34 - Introduction

    Code: Select all

        + File Tags: For developers and hardcore users there's a new
          undocumented and unsupported SC edittags. It works directly on the 
          memory (not on tag.dat), and it works well... :)
See Also
Last edited by TheQwerty on 18 Mar 2015 15:48, edited 1 time in total.
Reason: Updated format and added references.
I'm a casual coder using AHK language. All of my xys scripts:
http://www.xyplorer.com/xyfc/viewtopic. ... 243#p82488

binocular222
Posts: 1416
Joined: 04 Nov 2008 05:35
Location: Hanoi, Vietnam

Re: Undocumented script commands - Suggestions

Post by binocular222 »

msecs
Toggles the dispaly of milliseconds in displayed filetimes.

Syntax

Code: Select all

msecs [toggle], [decimals=3], [cropNulls]

toggle     Show msecs in time columns?
             0 = Hide
             1 = Show
             If empty or omitted, the state is toggled.
decimals   Number of decimal places to show.
             Defaults to 3.
             If omitted, the last value is used.
cropNulls  Crop trailing nulls?
            0 = Leave nulls.
            1 = Crop nulls.
Example

Code: Select all

msecs 1, 7, 1; // Show msecs, with 7 decimal places, and crop trailing nulls.
msecs 1, 5, 0; // Show msecs, with 5 decimal places, and leave trailing nulls.
Remarks
The values set by this command are retained across sessions.
Using this without any arguments is the same as command #455 (Tools | Customize List | Date Column Format | Show Milliseconds).

History
  • v12.40.0304 - 2013-06-09 20:14

    Code: Select all

    v12.40.0304 - 2013-06-09 20:14
      +++ Now the full NTFS filetime resolution can be displayed, edited, 
          and reported. The resolution goes down to 1/10 of a microsecond (= 
          100 nanoseconds).
          Note that with today's hard and software the relation of such 
          granular time expressions with temporal reality is less than 
          perfect, but who knows what's coming. At least the present data 
          structures are ready for such precision and data can be read and 
          written already now.      
          Now for the individual enhancements:
        > TIP: To display filetimes in the list with maximum resolution run 
          either of these through the Address Bar:
            ::msecs 1, 7, 1;  //show fractions ON; 7 decimal places; crop trailing nulls ON
            ::msecs 1, 7, 0;  //show fractions ON; 7 decimal places; crop trailing nulls OFF
          Note concerning the display of fractions:
            - Less exact fractions are displayed truncated, not rounded.
              So for example this time:
                2013-06-09 10:34:42.1888240
              formatted as "fff" (milliseconds reolution) will display:
                2013-06-09 10:34:42.188
              and not rounded to:
                2013-06-09 10:34:42.189
              This is in accordance with the Windows API behavior in similar 
              contexts, and ensures that XY's display will likely match the 
              display of other softwares that can show sub second fractions 
              of filetimes.
    [/size]
  • v12.40.0301 - 2013-06-04 14:35

    Code: Select all

        ! SC msecs (secret undocumented non-official scripting command from 
          v6.80.0111 - 2008-03-15 11:35): Well, it did not show the correct 
          milliseconds. Now it does. Also the state of showing milliseconds 
          in the file list is now remembered between sessions.
    [/size]
  • v6.80.0111 - 2008-03-15 11:35 - Introduction

    Code: Select all

        * Time-stamping, aka "Touch": From now on, the milliseconds (yes, 
          NTFS supports milliseconds in file times) will be set to 0 (zero) 
          when you touch a file date. Before they were ignored, resp. set to 
          some uncontrolled random value.
          Tip 1: Use the undocumented scripting command "msecs" to toggle 
          showing milliseconds in the file list! :)
    [/size]
See Also
Last edited by bdeshi on 26 Mar 2015 08:00, edited 3 times in total.
I'm a casual coder using AHK language. All of my xys scripts:
http://www.xyplorer.com/xyfc/viewtopic. ... 243#p82488

PeterH
Posts: 2776
Joined: 21 Nov 2005 20:39
Location: Germany

Re: Undocumented script commands - Suggestions

Post by PeterH »

caller()
Returns info about the script which called (via load, sub) the current script.

Syntax

Code: Select all

caller(info)

info    [required] any of the following:
        file:    calling script file (empty if none)
        path:    calling script file's path (app data if none)
        base:    calling script file's base (empty if none)
        script:  calling script
        caption: caption of the calling script
        icon:    icon resource of the calling script
Return
Info.

Example

Code: Select all

"Caller Info : callMeMaybe"
	$script = caller('script');
	$caption = caller('caption');
	Text "caller caption: $caption<crlf>caller script:<crlf>" . $script ;
"Call Caller Info : callCallMeMaybe"
	Sub 'callMeMaybe';
Remarks
This is analogous to the Self SC.

History See Also
Last edited by bdeshi on 24 Mar 2015 16:29, edited 5 times in total.
W7(x64) SP1 German
( +WXP SP3 )

PeterH
Posts: 2776
Joined: 21 Nov 2005 20:39
Location: Germany

Re: Undocumented script commands - Suggestions

Post by PeterH »

wait
pause script execution for the specified time.

Syntax

Code: Select all

wait [msecs=100]

msecs    milliseconds to wait
         Allowed values: 0 to 2147483647 (= 0x7fffffff = ~ 25 days)
Return

Example

Code: Select all

 echo "Hi"; wait 1000; echo "Nice day"; //echo two messages with 1 second (1000ms) pause inbetween.
 wait;       //minimum yield: let the OS do one thing
 wait 2000;  //let the OS do its things for 2 seconds (2000 ms)
 wait 60000; //wait a minute
 wait 1000; echo "Hi!"; //show message after 1 second
History
W7(x64) SP1 German
( +WXP SP3 )

serendipity
Posts: 3358
Joined: 07 May 2007 18:14
Location: NJ/NY

Re: Undocumented script commands - Suggestions

Post by serendipity »

Exist
Checks if a path exists and gives a quick report.

Syntax

Code: Select all

exist [path=<curitem>]
path    the path to check existence of. Can be a folder, file or server.
Example

Code: Select all

 exist "C:\Windows";
 exist "\\server1\share2";

serendipity
Posts: 3358
Joined: 07 May 2007 18:14
Location: NJ/NY

Re: Undocumented script commands - Suggestions

Post by serendipity »

Snippet
This is a quick way of creating a button in your toolbar. Say you want a dedicated button to access C:\ drive, all you do is type ::snippet in AB and enter relevant details and you get the button. Type ::snippet in AB and copy-paste the below code:

Code: Select all

Snip: CTB 1
  XYplorer 12.20.0303
Action
  NewUserButton
Name
  C drive
Icon
  label:C:\
ScriptL
  goto "C:\";
ScriptR
  
FireClick
  0
This should create a new button which upon clicking will take you to C:\ drive
Change Name, Icon, ScriptL, Script and FireClick to your liking.
Name=Name of the button
Icon=path to icon file or internal icons such as :minitree or :drives or text label:C:\
ScriptL= Command to run when left clicking the icon
ScriptR= Command to run when right clicking the icon
FireClick= set to 1 to get a quick dropdown like effect, useful if you have multiple scripts and want menu like effect.
See the link below for one such script.
http://www.xyplorer.com/xyfc/viewtopic. ... 737#p51737

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

Re: Undocumented script commands - Suggestions

Post by admin »

serendipity wrote:Exist
This command checks if a path and file exists and gives a quick report.
Syntax:
::exist “path/file”
Example:
::exist "C:\Windows";
Note that the info returned by exist is only valuable for me. So it's merely useful for debugging.

bdeshi
Posts: 4249
Joined: 12 Mar 2014 17:27
Location: Asteroid B-612 / Dhaka
Contact:

Re: Undocumented script commands - Suggestions

Post by bdeshi »

base64decode()
decode base64-encoded string or file.

Syntax

Code: Select all

base64decode(string, [flag=0])

string    the string or file to decode.
flag      Bit flag. A combination of these:
           0    originally encoded string is not in unicode
           1    originally encoded string is in unicode
           2    string points to a file whose content should be decoded
Return
Returns decoded string.

Example

Code: Select all

text base64decode("U2VjcmV0IQ=="); //returns "Secret!"
text base64decode("IQQ1BDoEQAQ1BEIEIQA=",1); //returns the unicode string "Секрет!"
text base64decode("<curitem>"); //tries to decode the *name* of <curitem>
History See Also
Icon Names | Onyx | Undocumented Commands | xypcre
[ this user is asleep ]

bdeshi
Posts: 4249
Joined: 12 Mar 2014 17:27
Location: Asteroid B-612 / Dhaka
Contact:

Re: Undocumented script commands - Suggestions

Post by bdeshi »

base64encode()
encodes a string or file content in Base-64.

Syntax

Code: Select all

base64encode(string, [flag=0])

string    the string or file to encode.
flag      Bit flag. A combination of these:
           0    string is not in unicode
           1    string is in unicode
           2    string points to a file whose content should be encoded
Return
Returns encoded string.

Example

Code: Select all

text base64encode("Secret!"); //returns "U2VjcmV0IQ=="
text base64encode("Секрет!", 1); //returns "IQQ1BDoEQAQ1BEIEIQA="
text base64encode("<curitem>"); //encodes the *name* of <curitem> into a base64 string
History See Also
Icon Names | Onyx | Undocumented Commands | xypcre
[ this user is asleep ]

bdeshi
Posts: 4249
Joined: 12 Mar 2014 17:27
Location: Asteroid B-612 / Dhaka
Contact:

Re: Undocumented script commands - Suggestions

Post by bdeshi »

logtofile
Create logs of certain app events to a file in <xydata>, or disable logging.

Syntax

Code: Select all

logtofile [flag=""]

flag      Control which events to log. Integer values can be combined.
           0    deactivate logging
           1    log background jobs added [eLTFBackgroundJobAdded]
           2    log background jobs triggered [eLTFBackgroundJobTriggered]
           "" or empty    display current logging status in the statusbar
Example

Code: Select all

logtofile 3; //log all added *and* triggered background jobs to a logfile
logtofile; //look at the statusbar
Remarks
This command is analogous to the commandline argument /log.
Note that both ways of setting the logging can be done simultaneously: their values will be combined (bitwise OR-ed). So when ::logtofile 1 has been set, and you start the app with /log=2, then both events, eLTFBackgroundJobAdded (1) and eLTFBackgroundJobTriggered (2) are logged.
The setting is remembered across sessions again if it was set by ::logtofile. Logging set by command switch /log=... is not remembered.
Log are saved as <xydata>\XYLog-<date yyyy-mm-dd>.txt. Eg, <xydata>\XYLog-2014-11-22.txt

History
  • v9.30.0004 - 2010-07-20 21:45

    Code: Select all

        + Logging To File: New event and new IDs:
            eLTFBackgroundJobAdded = 1
            eLTFBackgroundJobTriggered = 2
          To log both:
            ::logtofile 3;
    [/size]
  • v9.30.0003 - 2010-07-20 11:05 - Introduction

    Code: Select all

        + Added Logging to File: Now you can optionally have certain events 
          logged to a file named "XYLog-2010-07-20.txt" (date of today) and 
          located in the app data path.
          Events are identified by a number (binary field). Currently only 
          one event is supported: Background Job Triggered (#1). To activate 
          logging for this event use the following new scripting command:
            ::logtofile 1;
          To deactive logging:
            ::logtofile 0;
          To show logging status:
            ::logtofile;    //status is displayed in the statubar
          The setting is remembered across sessions.
    [/size]
Icon Names | Onyx | Undocumented Commands | xypcre
[ this user is asleep ]

Post Reply