script to display menu
script to display menu
i want to display the options of each file tab in a small menu containing the following.
name
extension
size
type
modified
created
etc.
is it possible? i require this feature because, some time file lenghth may be too much as a result i could not find modified tab until and unless i resize name tab.
thanks a lot.
name
extension
size
type
modified
created
etc.
is it possible? i require this feature because, some time file lenghth may be too much as a result i could not find modified tab until and unless i resize name tab.
thanks a lot.
Re: script to display menu
Code: Select all
$column = popupmenu("Name|Extension|Size|Type|Created|Modified");
if($column == "Name") {
#362;
} elseif($column == "Extension") {
#363;
} elseif($column == "Size") {
#364;
} elseif($column == "Type") {
#365;
} elseif($column == "Created") {
#366;
} elseif($column == "Modified") {
#367;
}
One of my scripts helped you out? Please donate via Paypal
Re: script to display menu
sir, thanks for the code.
with the above code, tabs (modified, created etc) are getting disappered. i want the files to be ordered by the selected options( name,size, modfied, created, extension etc). i don't want their column names to get disappeared.
with the above code, tabs (modified, created etc) are getting disappered. i want the files to be ordered by the selected options( name,size, modfied, created, extension etc). i don't want their column names to get disappeared.
Re: script to display menu
No single word about ordering by column header entry...file lenghth may be too much as a result i could not find modified tab until and unless i resize name tab
Just look up the correct ids in the keyboard shortcuts configuration dialog...
One of my scripts helped you out? Please donate via Paypal
Re: script to display menu
as per your guidance, i have modified the code as
$column = popupmenu("Name|Extension|Size|Type|Created|Modified");
if($column == "Name") {
#321;
} elseif($column == "Extension") {
#322;
} elseif($column == "Size") {
#323;
} elseif($column == "Type") {
#324;
} elseif($column == "Created") {
#325;
} elseif($column == "Modified") {
#326;
}
and it is working perfectly. thank you.
$column = popupmenu("Name|Extension|Size|Type|Created|Modified");
if($column == "Name") {
#321;
} elseif($column == "Extension") {
#322;
} elseif($column == "Size") {
#323;
} elseif($column == "Type") {
#324;
} elseif($column == "Created") {
#325;
} elseif($column == "Modified") {
#326;
}
and it is working perfectly. thank you.
Re: script to display menu
Thanks HighEnd
Very Useful
Calude
Very Useful
Calude
Re: script to display menu
Just as a tip: you can shorten this to:
Reason: $column can only match one value of the if-group.
2nd reason: it can be read and understood much faster this way
(OK: I would also align the ) { #...; } - but that's a matter of taste )
Code: Select all
$column = popupmenu("Name|Extension|Size|Type|Created|Modified");
if($column == "Name") { #321; }
if($column == "Extension") { #322; }
if($column == "Size") { #323; }
if($column == "Type") { #324; }
if($column == "Created") { #325; }
if($column == "Modified") { #326; }
2nd reason: it can be read and understood much faster this way
(OK: I would also align the ) { #...; } - but that's a matter of taste )
W7(x64) SP1 German
( +WXP SP3 )
( +WXP SP3 )
Re: script to display menu
Time for a little code golf?
If you really do want to customize/minimize the column choices...Otherwise...
If you really do want to customize/minimize the column choices...
Code: Select all
SortBy PopupMenu('Name|Extension|Size|Type|Created|Modified'), 'clk';
Code: Select all
#320; //View | Sort By | - submenu -
Re: script to display menu
-TheQwerty wrote:Time for a little code golf?
If you really do want to customize/minimize the column choices...Code: Select all
SortBy PopupMenu('Name|Extension|Size|Type|Created|Modified'), 'clk';
That's fine
W7(x64) SP1 German
( +WXP SP3 )
( +WXP SP3 )
-
- Posts: 195
- Joined: 21 Oct 2020 23:33
- Location: Through the Looking-Glass
Re: script to display menu
Nearly a decade later, this information is still gold! I'm trying to apply the same concept to View options, but for some reason when the command executes it quickly flashes the change then reverts to my default folder view. Any ideas what I'm doing wrong? I was looking through the docs, but I couldn't find a
Edit
Figured it out. The last line where I load $command gets screwy if using ID's. Unlike other commands that are returned as strings, ID's seem to get executed immediately. I'm going to have to parse the $command variable to see if it was an ID, and if it true skip the load block since the action was already performed. Thanks again for the instruction!
Sortby
equivalent for view options...Code: Select all
/*
A collection of the most-used right-click options...
*/
$menu = <<<MENU
0) Sort by...||
0) Date Modified|Sortby 'Modified', 'clk'|
1) Extension|Sortby 'Ext', 'clk'|
2) Size|Sortby 'Size', 'clk'|
3) Type|Sortby 'Type', 'clk'|
4) Date Created|Sortby 'Created', 'clk'|
1) View..||
0) Thumbnails Small|#306|
1) Thumbnails Medium|#307|
2) Thumbnails Large|#308|
3) List|#304|
4) Details + Thumbnails|#303|
2) Copy..||
0) Absolute path(s)|//placeholder|
1) Absolute Unix-style path(s)|//placeholder|
2) Absolute Parent path|//placeholder|
MENU;
// Get X/Y position of a control
$position = controlposition('A', 0);
$x_pos = gettoken($position, 1, '|');
$y_pos = gettoken($position, 2, '|');
// Display the context menu
$command = popupnested($menu, $x_pos, $y_pos,,,,,|);
// Run the selected command
if ($command != '') { load $command,, s; }
Edit
Figured it out. The last line where I load $command gets screwy if using ID's. Unlike other commands that are returned as strings, ID's seem to get executed immediately. I'm going to have to parse the $command variable to see if it was an ID, and if it true skip the load block since the action was already performed. Thanks again for the instruction!
Code: Select all
// Run the selected command
if ($command != '') {
if (regexmatches($command, '^\#\d+$') == '') { load $command,, s; }
}
Re: script to display menu
Code: Select all
if ($command && !regexmatches($command, '^\#\d+$')) { load $command,, s; }
One of my scripts helped you out? Please donate via Paypal