Script(Ver1.60対応版)
Index

ブックマークツールにスクリプトを指定できます。
ブックマークやツールのパスの部分の記述によって秀丸ファイラーClassic独自のオブジェクトが使えるスクリプトにできます。
JScript/VBScriptのスクリプトエンジンを利用できます。

スクリプトファイルはどこに置いてもいいです。
スクリプトライブラリから入手したスクリプトファイルがある場合、ブックマークまたはツールのプロパティの「パス」の入力欄の右側に「>>」ボタンがあり、ここから「スクリプトの参照...」でスクリプトファイルを選ぶと簡単です。
You can specify scripts for bookmarks and tool items.
It becomes a script by describing the part of the path.
You can use the JScript / VBScript script engine.


記述方法

パスの先頭に書く文字列
「js:」→JScriptを利用
「vbs:」→VBScriptを利用
例:「vbs:message "test"」
例:「js:Message("test");」

「:」の後に書く文字列
スクリプトを直接記述できます。直接記述の場合は記述できる文字数には限界があります。
例:「js:Message("a");Open("c:\\");」
またはファイル名を記述するとファイルを参照します。ファイル参照の場合は限界は無いです。
スクリプトファイルのエンコーディングはShift-JISまたはUnicode(UTF-16,LE,BOMあり)をサポートしています。
例:「vbs:C:\folder\test.vbs」
例:「js:C:\folder\test.js」
スクリプトファイル名に続いて空白で区切って、GetArgで取得できるパラメータを記述できます。(V1.44)
例:「js:"C:\folder\test.js" param1 "param 2"」

Description method

String at the beginning of the path
If you write "js:" JScript will be used.
If you write "vbs:" VBScript will be used.
Example: vbs:message "test"
Example: js:Message("test");

String to write after ":"
You can write scripts directly. In the case of direct description, there is a limit to the number of characters that can be described.
Example: js:Message("a");Open("c:\\");
References a file when describing the file name.
Example: vbs:C:\folder\test.vbs
Example: js:C:\folder\test.js
You can describe parameters by separating the script file name with a space. (V1.44)
Parameters can be get with the GetArg method.
Example: js:"C:\folder\test.js" param1 "param 2"


オブジェクトの説明
strは文字列、numは数値、[]は省略可。
bool値はvbsとjsで値が違うので原則使いません。真偽を表す場合は数値で1が真、0が偽としています。
Object description
str is string, num is number, [] is optional.
When it is true or false, 1 is true and 0 is false.

Global
You can write as it is without writing an object.

Method
Echo( str ) Show message box.
Message( str [, num] ) Show message box.
num corresponds to the second parameter of MsgBox of vbs. (V1.04)
num is optional.
Question( str ) Show ask dialog of YES or NO. Get result by return value.
Input( str1, str2 ) Show input dialog.(V1.46)
str1 is the message text.
str2 is the default content of the input field.
The return value is the string entered.
Prompt( str1, str2 ) Alias for the same function as Input.(V1.46)
Beep() Sound a beep.
EndMacro() Stop script execution.
Command( num or str ) Command execution by command name.
Reference:Command list
ContextMenu( str1 [, str2] ) Execute the item of the context menu.(V1.02)
Check the context menu of the selected file for a match with the string of str1.
(Example : "&Extract")
Or check the matching verb string.
(Example : "copy")
In the case of a submenu, specify the submenu name in str1 and the item name in str2.
BackgroundContextMenu( str1 ) Execute the item of background context menu, like a ContextMenu() method.(V1.52)
SendTo( str [, num [, num2] ] ) Send selected file to path.(V1.02)
str specifies the path.
If it is not an absolute path, examine the file in %userprofile%\SendTo.
If num is 1, copy it.
If num is 2, move it.
If num is 3, create a link.
If num is 4, it is automatic.
num is optional.

If num2 is 1, it is drop to folder by mouse right button.
num2 is optional.
SelectAll() Command of "Select All".
Cut() Command of "Cut".
Copy() Command of "Copy".
Paste() Command of "Paste".
PasteLink() Command of "Paste Shortcut".
Rename( strBase [, strExt] ) Execute "Rename (multi)" command equivalent with parameter specification.(V1.24)
strBase is file name part.
strExt is extension part.
This is different from the "Rename" command.
Open( str [, num1 [, num2 [, num3] ] ] ) Open the path of str.
It is also possible to write "*".
It is also possible to describe the file name.

num1 is a specification such as a new tab.
num1 is optional.
0: Open normally
1: New tab
2: New tab (existing is active)
3: New tab (at the background)
4: New tab (at the background / existing is no action)
5: New split
6: Open normally (existing is active)
7: New window (V1.44)
If 7 is specified, script execution will not continue in the new window, but will continue in the original window.

num2 specifies tab insertion position.
num2 is optional.
0: Add to right edge 1: Add to left edge 2: Insert right: 3: Insert left

num3 specifies how to expand the tree's subfolders.
num3 is optional.
0:Default 1:Not expand 2:Expand
Refresh( [num] ) Command of "Refresh".
When 1 is specified to num, it is equivalent to "Refresh (focus)" command. (V1.01)
When 2 is specified to num, it is equivalent to "Refresh (file list is difference)" command. (V1.50)
When 3 is specified to num, it is equivalent to "Refresh (tree is difference)" command. (V1.50)
When 4 is specified to num, it is equivalent to "Refresh" command and keep selection. (V1.50)
CloseOtherTab() Close all other tabs.
It also closes the locking tab.
GetView() Get View value.
0:Details 1:List 2:Icon 3:Tile 4:Thumbnails
SetView( num ) Set View by value.
0:Details 1:List 2:Icon 3:Tile 4:Thumbnails
Sort( num1 or str1 [,num2] ) Do sorting.

When specifying numerically with num1:
0: Name 1: Size 2: Type 3: Update date and time

When specifying string with str1:
"name" / "size" / "type" / "date"
Or column name (property name).

num2 is the sort direction.
0: Reverse 1: Ascending 2: Descending
If num2 is specified and str1 is specified as "", the current sort column is targeted. (V1.01)
GetItemCount() Return the count of items in the file list.
GetSelectedCount() Returns the selected item count.
GetNextItem( num1, num2 ) Returns the index of the next item that corresponds to the status flag specified by num2.
If num1 is -1, the first hit is returned.
If num1 is 0 or more, the next hit at the specified index is returned.
Example:
First selection item : iSel = GetNextItem (-1, 2);
First focus item : iFocus = GetNextItem (-1, 1);
GetItemState( num ) Returns the status flag of the item at index num.
Bitwise OR of the following values
0x01: Focused, 0x02: Selected, 0x04: New file (when the color setting is valid)
GetItemText( num1 [, num2] ) Returns the text of the item at index num1. num2 is a subitem. (optional).
GetItemPath( num ) Returns the path of the item at index num.
IsFolder( num ) Returns whether the index item of num is a folder.
GetColumnCount() Returns the count of columns in details view.
GetColumnText( num ) Returns the column item name (name of property) of the details view of the index of num.
GetClipboard() Returns the clipboard contents in text format. (V1.24)
SetClipboard( str ) Copy text to clipboard in text format.
GetDirectory() Return the current folder (current directory) path.
SelectItem( num1 or str1 [, num2] ) When string is specified in str1:
It behaves the same as the "Find and Select ..." command.
Search and select after the current focus.
If multiple items hit, select in order.
Clear the selection when it is the last item.
If num2 contains 0x02, select the exact match item including the extension, not the same as the "Find and Select ..." command.
num2 specifies the method to select. (Bitwise OR of the following values)
0x01: Add selection
0x02: Perfect match to the file name (even if the extension is not displayed) (V1.01)
0x10: Do not target files (V 1.42)
0x20: Do not target folder (V 1.42)
In the case of wildcards in str1:
In the case of wildcard specification, multiple selection with wildcards.
num2 specifies the method to select. (Bitwise OR of the following values)
0x01: Add selection
0x10: Do not target files (V 1.42)
0x20: Do not target folder (V 1.42)
In case of numeric specification with num1:
Selection of index specification.
num2 specifies the method to select.
0x01: Add selection
AddBookmark( str1, str2 [,str3 [, num1] ] ) Add to bookmarks.
str1 is the display name. str2 is the path. str3 is the path and index of the icon (eg "hmfilerclassic.exe, 1").
num1 is the link bar display value.
0: Icon and text 1: Icon only 2: Text only 3: Do not display
GetFocusTarget() Returns the type of window currently in focus.
1: File list
2: Folder pane (or each tab folder pane)
0: Other than that
GetKeyState( num1, num2 ) Gets the keyboard status.
Specify a virtual key code in num1. (Example: 0x10 for VK_SHIFT / 0x11 for VK_CONTROL / 0x04 for VK_MBUTTON)
When num2 is 0 it is the same as GetKeyState of Win32 API.
When num2 is 1, you can get the state of the middle button when you press a button such as the link bar.
When num2 is 2, it is the same as GetAsyncKeyState of Win32 API.
The return value is whether the 0x8000 bit is pressed or not. A bit of 0x0001 represents the toggle state of the key.
ExpandFolder( str[, num1 [, num2] ] ) Expand / collapse folder tree without selecting. (V1.01)
str is the target path.

num1 is the expansion method. (Bitwise OR of the following values)
0x01: Scroll to enter the screen
0x02: Collapse subfolders
0x04: Equivalent to expansion with "*" on the numeric keypad

num2 is num1 depth when 0x04 is specified.
Expand to the specified depth.
Default is equivalent to 2, and when deployment is complete, drill down one hierarchy at a time.
GetTabBarCount() Gets the count of tab bars. (V1.01)
It is not tab mode when 0. Tab mode is 1 or more. When the tab is splitted, it becomes 2 or more.
GetTabCount( [num] ) Gets the count of tabs. (V 1.03)
If split, num specifies which split. Count left / top split from 0.
If you specify -1 as num, it returns the count of tabs of the split currently in focus.
If you specify -2 for num, it returns the count of tabs that totaled all splits.
If omitted, it is the same as -2.
GetTabState( num1, num2 ) Gets the state of the tab. (V1.04)

num1 is the tab number.
The tab number is the serial number of all splits, counting from zero.

num2 specifies the type of return status.
0 is the lock status, 1 is the close prohibition status, and 2 is the parent path for each tab (if it is set).
GetCurrentTab( [num] ) Gets the number of the currently active tab. (V 1.03)
If split, num specifies which split. Count left / top split from 0.
If you specify -1 as num, it returns the index number of tab of the split currently in focus.
If you specify -2 for num, it returns the index number of tab that totaled all splits.
If omitted, it is the same as -2.
GetTabName( num1 [, num2] ) Gets the name of the tab specified by num1. (V1.28)
The tab number is the serial number of all splits, counting from zero.
Specify 1 in num2 to get the tab path. (V1.46)
SetTabName( str, num1 ) Sets the name of the tab specified by num1. (V1.54)
SetActiveTab( num ) Activate the specified tab. (V1.28)
The tab number is the serial number of all splits, counting from zero.
CloseTab( num ) Closes the specified tab. (V 1.42)
The tab number is the serial number of all splits, counting from zero.
It will fail for locked tabs.
In the case of the last one tab, it fails.
If it is not locked, 1 is returned. If it is locked, 0 is returned.
Sleep( num ) Wait for a fixed time (ms). The CPU does not stop, but if there is asynchronous processing, it is processed during that time.
GetWildcard() Returns the current filter (wildcard). (V 1.03)
There is no SetWildcard. The setting can be set as Open("*.xxx");.
GetClipboardFiles() If the file is copied to the clipboard, returns an array of file paths. (V 1.03)
If the clipboard is a content other than a file (such as text), the number of elements in the array will be less than or equal to 0 (0 or -1).
It will fail if a place without a path (such as "computer") is copied.
An array is an array of type SAFEARRAY.
Example for vbs:
varSafeArray = GetClipboardFiles
numFiles = UBound(varSafeArray) 'Elements
strPath = varSafeArray(0) 'Element 0〜numFiles-1
Example for js:
varSafeArray = GetClipboardFiles();
objArray = varSafeArray.toArray();
numFiles = objArray.length; //Elements
strPath = objArray[0]; //Element 0〜numFiles-1
IsClipboardFormatAvailable( num or str ) Returns whether the content copied to the clipboard is valid. (V1.46)
Specify the clipboard format number with num or the clipboard format string with str.
Typical values are as follows.
Text: 13
File or folder (where there is a path): 15
File or folder (with or without path): "Shell IDList Array"
Menu( str1, ... ) Display the menu. (V1.24)
Specify the menu item as a string in the parameter.
Up to 32 pieces.
If a menu item is selected, the item number counted from 1 is returned.
If not selected, 0 is returned.
If you write "&" in front of the key alphanumeric characters, that character becomes the key. For example, if "Item (&A)", "A" will be the key.
When using as a separator, use "\ x01" as the character string. (in the case of js)
To use a submenu, write "\ x01" followed by the menu name of the submenu. (1.40 or later)
Subsequent items will be items in the submenu. Specifying "" means the end of the submenu.
Example for js:
Menu(
  "\x01Sub menu A",
    "Item A-1",
    "Item A-2",
    "",
  "\x01Sub menu B",
    "Item B-1",
    "Item B-2",
    "",
  "Item C"
  );
MenuArray( array [, num ] ) Display the menu. (V1.24)
Specify the menu item in the array.
Specify the menu item name in the array for the first parameter.
In the second parameter, specify the number of elements of the array. The second parameter can be omitted.
Return value and separator are the same as Menu method.
It is an array of the type SAFEARRAY.
Example for vbs:
varSafeArray = Array("aaa", "bbb", "ccc")
MenuArray varSafeArray
Example for js:
varDic = new ActiveXObject("Scripting.Dictionary");
varDic.add(0, "AAA");
varDic.add(1, "BBB");
varDic.add(2, "CCC");
varSafeArray = varDic.items();
MenuArray( varSafeArray );
GetSpaceSelectMode() Gets whether it is space selection mode. (V1.26)
SetSpaceSelectMode( num ) Change the space selection mode. (V1.26)
GetArg( num ) Get the argument specified by command line option /a. (V1.30)
When there are multiple /a, specify the number counted from 0.
Example: "C:\Program Files\HmFilerClassic\HmFilerClassic.exe" /x "c:\folder\test.js" /a param1 /a "param 2"
When executing a script with bookmarks, you can specify parameters by separating the script file name with a space. Get that parameter with GetArg. (V1.44)
Example: js:"c:\folder\test.js" param1 "param 2"
FindWindow( strClass, strTitle [, numOption] ) If numOption is 0, same as FindWindow of Win32API.
If numOption is 1, returns the window handle of the window that matches part of the class name or title.
FindWindowEx( numHwndParent, numHwndChildAfter, strClass, strTitle ) Same as FindWindowEx of Win32API.
GetWindow( numHwnd, num ) Same as GetWindow of Win32API.
IsWindowVisible( numHwnd ) Same as IsWindowVisible of Win32API.
IsWindow( numHwnd ) Same as IsWindow of Win32API.
GetWindowText( numHwnd ) Like GetWindowText of Win32API.
GetCurrentWindowHandle() Get current window handle.
GetStaticVariable( strName [, numOption ] ) Get static variable.
SetStaticVariable( strName, strData [, numOption ] ) Set static variable.
CustomFileList( strFileName ) Outputs the contents of the text file to the file list as search results.(V1.54)
GetThumbnailSize( numType ) Get thumbnail size.(V1.54)
If numType is 0, default size.
If numType is 1, each folder size.
SetThumbnailSize( numSize, numType ) Set thumbnail size.(V1.54)
numSize is thumbnail size.
If numType is 0, default size.
If numType is 1, each folder size.
LoadDll( str ) Loads the DLL equivalent of Hidemaru Editor's loaddll.(V1.56)
Return the DllFuncManager object.
 
Property
Version Version number. In the case of V1.23β45, it is 123045 in decimal. (Get only)
Busy Processing asynchronously. (Get only)
FullName HmFilerClassic.exe file name of own full path. (Get only) (V 1.44)
ScriptFullName Own file name of script file. (Get only) (V1.11)
ArgCount If the command line option /a is specified, it indicates how many /a there are. (Get only) (V1.30)
TickCount Same as GetTickCount of Win32API.
Config Config object.
ConfigSystem ConfigSystem object.

Config object

Property
HiddenVisible Hidden file display status. (get / set)
CheckBox Check box display status. (get / set)
TrackSelect Status of "Single-click to open an item (point to select)" option. (get / set)
0: Normal, 1: Point to select, 2: Point to select always underline.
SplitMode Split direction (get / set) (V1.01)
1:Vertical
2:Horizontal
Whether in the split can be get by GetTabBarCount.
MixSort Whether sort of "Mix files and folders" is enabled.(get / set) (V1.01)
AlwaysFolderUpper Whether sort of "Always folder is top" is enabled.(get / set) (V1.01)
StandardButtonsBar Standard button display status (get/ set) (V1.02)
AddressBar Address bar display status (get/ set) (V1.02)
LinkBar Link bar display status (get/ set) (V1.02)
ToolItemBar Tool item bar display status (get/ set) (V1.02)
FilterBar Filter bar display status (get/ set) (V1.02)
DriveBar Drive bar display status (get/ set) (V1.02)
StatusBar Status bar display status (get/ set) (V1.02)
ThumbnailSize Thumbnail size (get/ set) (V1.02)

ConfigSystem object

Property
SystemVisible System file display status. (SYSTEM SETTING) (get / set)
ExtVisible Extension display status. (SYSTEM SETTING) (get / set)

DllFuncManager object

Method
Function name(Parameter,...) Functions in the DLL can be called as methods.
DllFuncExist( str ) Returns whether the function name exists.
SetDllDetachFunc( str ) Set the function name to be called when the DLL is released.
 
Property
LoadDllFile Loaded DLL file name. (get)
DllFunc DllFuncManager object. (get) The member has a set of functions that are called by dllfunc.
DllFuncStr DllFuncManager object. (get) The member has a set of functions that are called by dllfuncstr.
DllFuncW DllFuncManager object. (get) The member has a set of functions that are called by dllfuncw.
DllFuncStrW DllFuncManager object. (get) The member has a set of functions that are called by dllfuncstrw.
 
Reserved name
LoadDllFile DllFuncExist SetDllDetachFunc DllFunc DllFuncW DllFuncStr DllFuncStrW
_SetDefaultCallType _SetCallType _Declare _DeclareW _DeclareStr _DeclareStrW


Other
「WScript」というオブジェクトは無いです。
他のオブジェクト作成は JScriptでは new ActiveXObject、VBScript では CreateObject が使えます。
「js:」は「jscript:」または「javascript:」と書いてもいいです。
「vbs:」は「vbscript:」と書いてもいいです。

「script:」と書いてファイル指定時は拡張子に関連付けされているスクリプトエンジンを利用します。
例:「script:C:\folder\test.vbs」
例:「script:C:\folder\test.js」
(他のスクリプトエンジンは動作確認はしていないです)

スクリプトの例
There is no object called "WScript".
Other objects can be created using new ActiveXObject in JScript and CreateObject in VBScript.
You can write "js:" as "jscript:" or "javascript:".
You can write "vbs:" as "vbscript:".

When "script:" is written, when specifying a file, the script engine associated with the extension is used.
Example: "script: C:\folder\test.vbs"
Example: "script: C:\folder\test.Js"

Script example