Power Opener [v3.40]   (formerly Power Launcher)

Discuss and share scripts and script files...
FluxTorpedoe
Posts: 855
Joined: 05 Oct 2011 13:15

Power Opener [v3.40]   (formerly Power Launcher)

Post by FluxTorpedoe »


• DOWNLOAD:

   — Latest version: Power Opener v3.40 — 2022-11-17 (publishing date)
   — Changelog and previous versions: Power Opener Changelog

———————————————————————————

• TL;DR PURPOSE:

   Assign various programs to open any file type, depending on the way you click on it or on Power Opener button.

   ☛ eg. on an image file:
      — Middle-click on it opens it in XYplorer fullscreen preview
      — Double-click on it opens it in FastStoneViewer fullscreen preview
      — Left-click on button (with file selected) opens it in your RAW editor
      — Right-click on button (with file selected) opens it in Photoshop

   NB: A secondary program will be tried if the first one is not found (eg you’re running a portable XYplorer from another computer). So that’s up to 8 possibilities, depending on the way you click, and the availability of the programs.

———————————————————————————

• FOREWORD:
   — This script is extremely easy to use
   — But the first installation is a bit heavy — and customization is mandatory (you need to define which app you want for which file type)…
   ⇒ So it’s currently recommended for power users, and users relying heavily on portability.

   More info below (work in progress), after the Install instructions.

———————————————————————————

• INSTALLATION:

⮞ A. Download the script (link above) and copy it into XYplorer scripts folder: <xyscripts>
⮞ B. Download the definition file (link above) and unzip it into XYplorer scripts folder: <xyscripts>
 ⇒ You will have PowerOpener.xys and PowerOpener.ini in your scripts folder.

⮞ C. Then, for the script (PowerOpener.xys),
 C1. To use it with a button (left and right click on button), either:
   C1a. add    load "PowerOpener.xys";    to "On left click:" and "On right click:" of your custom button, or
   C1b. use the following snippet:
      — Paste    ::snippet;    into the address bar and press ENTER. A text box will open.
      — Paste the following and press OK. A new button will be created at the right end of your toolbar.

Code: Select all

Snip: CTB 1
  XYplorer 11.60.0207, 05.10.2012 17:30:00
Action
  NewUserButton
Name
  Power Opener
Icon
  :steps
ScriptL
  load "PowerOpener.xys";
ScriptR
  load "PowerOpener.xys";
FireClick
  1
 C2. To use it via double-click on any file:
   XYplorer menu Tools > Customize File Associations… > New > paste this line
   *>::load "PowerOpener.xys";
 C3. To use it via middle-click on any file:
   XYplorer menu Tools > Configuration > General | Custom Event Actions > Clicking on Items | Middle-click on file >
   Action: Run script
   Script: load "PowerOpener.xys";

⮞ D. Then, edit the definition file (PowerOpener.ini):
   D1. Assign your favorite applications to the Left Click and/or Right Click (on button), and/or Double Click and/or Middle-Click (on file), for the various categories (image, audio,...). Detailed info available in PowerOpener.ini.
   D2. If needed, add other categories (spreadsheet, database,...), with their associated filetypes (xls,db,...)
   Tip: If you're using XYplorer on different computers (portable mode), Assign your favorite portable applications to the Secondary associations.

 
———————————————————————————
 

More detailed info and instructions [old, to be updated in 2023]

• FEATURES:
:arrow: If you regularly need to open files with something else than the default application (on double-click), PowerLauncher (PL) is for you!
When edited and assigned to a Custom Toolbar Button (CTB), this script will:
- detect the type of the selected file (audio, video, pdf,...),
- detect the left click (LC) or Right Click (RC) on PowerLauncher button,
- launch a specific application or script to open this file (different depending on LeftClick or RightClick)
:arrow: Use it also if you want to manage your Portable File Associations in the same place, with secondary associations in case the primary isn't found
Note: "open with" mode or "command-line arguments" mode are supported.

• WARNING - Preserquisites:
:!: This script MUST BE EDITED (at least to input the path of your applications) - it won't work as is.
=> You must know how to retrieve the path of your applications (and command-line if necessary).
:!: For the RightClick function to work, you must have the following tweak enabled (set to 1):
CTBNoRClickDefaultCommands=1
It enables "Direct RightClick" by removing the "Edit, Customize..." from RightClicks on CTB. They can still be accessed by CTRL+RightClick on CTB.

• USAGE:
• Install PowerLauncher and edit its Definitions INI file (procedure below)
• Select one or several similar files of your choice (e.g. "myvideo.avi" and "yourvideo.avi") then LC or RC on your PL button to have PowerLauncher open it with your associated application (e.g. VLC)...

• USAGE EXAMPLES:
Working example:
:arrow: Select one of your (meaningful) XYS scripts. LeftClick on PowerLauncher button, and see it running (without having to write "::load "MyOtherScriptsPath\blablabla"")
Other case scenarios:
• You want to show your videos at a party but aren't sure what player and codecs your friends have:
- On your flashdrive, put portable XYplorer and VLC (assigned to videos to the LC of PL)
=> now a LeftClick on PowerLauncher button will open all your videos through VLC.
• You like to have SumatraPDF as the default PDF viewer for its unmatched speed (I do!) but sometimes need more power:
- a regular DoubleClick can open your PDFs in SumatraPDF (assigned as the default PFA opener [Tools > Customize File Associations...])
- a PL-LC can open them in PDFXchange Viewer (assigned as PL-LC)
- a PL-RC can open them in Acrobat (assigned as PL-RC)
• You have to work on a friend/client computer and don't know if they have an archiver:
- a PL-LC can open all archives in the window of 7Zip portable (assigned as PL-LC)
- a PL-RC can extract your archives in place - as if you'd had the regular "Extract Here..." menu.


• NOTES:
• The "Power" of this script depends on your ability to find the best apps and command lines to open your files. A few notes and examples are included in the default Definitions file.
• The Definitions file is a standard INI but it's not accepted by the board, so it's been renamed to XYS. You can leave it as is or rename its extension to ini as you see fit.
• Multiple items are directly supported through "OpenWith". They probably won't be processed through command-line (too much variation between apps).
:!: For direct SC access to specific Click/Associations (for Keyboard Shortcuts, etc.), the subs are "_LeftClick", "_RightClick" and "_DoubleClick", so use e.g.: load "PowerLauncher.xys", "_LeftClick";
:!: • PowerLauncher can be used to manage ALL your Double Click associations. Use at your own risk - though there's no reason it should break anything, and no slowdown can be noticed. Add the following entry on top in Tools > Customize File Associations: *>::load "PowerLauncher.xys";
(then copy your previous PFA associations to PL's Definition file).

But first and foremost: Enjoy & don't hesitate to post your questions, suggestions, comments... 8)
Flux

———————————————————————————

Some tips, etc.
- Try to use XYS as "direct openers" for your items. e.g. assign a Picture Metadata Renamer XYS to the right click of your folders, a specific virus command-line, etc.

Why Power Launcher?
Because with only 1 button you:
- clean your catalog from cluttering with OpenWith lines
- get the fastest extra-opener for your common files (e.g. have your pictures 2C-opened in XnView, and PL-opened in Photoshop)
- enhance your portability without having to modify then restore your PFA each time.
- And of course, because you can! :biggrin:

:arrow: Post your Best configs/combos!
Among my current favs/most-used are:
- LightAlloy as LC on videos (as my first portable ultralight player)
- Word as LC on docs (cause 2C runs the much faster TextMaker Viewer)
- MediaCoder as RC on audio
- XYS processed AntiVirus as RC on folders (cause I don't like resident AV)
Attachments
PowerLauncher-Definitions.xys
(2.36 KiB) Downloaded 486 times
PowerLauncher.xys
(6.06 KiB) Downloaded 486 times
Last edited by FluxTorpedoe on 17 Nov 2022 19:46, edited 12 times in total.

FluxTorpedoe
Posts: 855
Joined: 05 Oct 2011 13:15

• Power Opener Changelog •

Post by FluxTorpedoe »

 
• CHANGELOG:

v3.30 — 2022-10-09Pending
+++ MiddleClick now available as another way to open items (Note: CEA "Middle click on file" must be edited)
++ Direct script now possible in PowerOpener.ini via ::script
* Ini reference modified from self not working with external call (eg CollectionManager)
* Permanent variables renamed: $PL_* > $PO_*
* Detection if modifier pressed and coming from external script


v3.20 — 2021-01-14 (internal)
* Mediatype identification now without "*."

v3.10 — 2021-01-10 (internal)
+ Shift+DoubleClick on item launches preview (from PowerDisplay.xys)
! Reintroduced folder code (used by CTB)

v3.00 — 2020-12-26 (internal)
! Major fix of break code
! Removed folder code (folder not opened by CFA)
! Path not always parsed (use of resolvepath instead of eval)

v2.90 — 2020-05-24 (internal)
+++ Ability to define "default" opener to use system default app
! CL would not close (prevented successive launch)

v2.81 — 2018-08-21 (internal)
* Tried to add Shift+DoubleClick on item

v2.80 — 2018-07-10 (internal)
* Fix non lowercase extension items bypassing Power Opener (change in XY code)
* Huge amount of unlisted changes…

v1.6b1 — 2013-04-19Download Here
* use of the new var <pfaitem>
   I've everything opened by a PFA catchall:
   *.*>::load "PowerLauncher.xys";
* More unlisted changes

v1.5a4 — 2013-03-12Download Here
* Simplified association with XYS scripts
+ Added direct association to XYS subscripts (Labels)

v1.5a3 — 2013-03-12
+ Added direct access to Left/Right/Double Click subscripts (for Keyboard Shortcuts, etc.)
+++ Added Secondary association option as fallback, if Primary association unavailable
+++ Added DoubleClick detection. For use with PFA catch-all (See notes) or other scripts
...If no association found or available, falls back to System default association
+ Added ability to run & parse file from other script by reading perm var $EXTCLICK = item path\name(s), e.g.
...perm $EXTCLICK = "<curitem>"; load "PowerLauncher.xys"; unset $EXTCLICK;
+ Added optional alternate INI file path (in <xydata>\[User])

v1.01b1 — 2013-02-20
++ Added folder support
++ Added multiple items support
+ Added support for selected item(s) without focus
* Hugely optimized and streamlined code

v1.0 — 2013-02-19
Public release

v0.80 ~ 2013-02-18 (internal)
Initial stable release?
Last edited by FluxTorpedoe on 19 Oct 2022 18:39, edited 1 time in total.

Enternal
Posts: 1174
Joined: 10 Jan 2012 18:26

Re: Power Launcher [v1.0 beta1]

Post by Enternal »

Wow this is pretty neat! Thanks!

FluxTorpedoe
Posts: 855
Joined: 05 Oct 2011 13:15

Re: Power Launcher [v1.0 beta1]

Post by FluxTorpedoe »

Glad you found it useful!
It takes a few days to get accustomed to it, but -especially in a portable environment- there's no match for this Power of Three! :D
(2C PortableFileAssociations + LC PowerLauncher + RC PowerLauncher)

———————————————————————————

[Old info for versions < 2.0]

Hi'

=======================
Power Launcher v1.5alpha4 *Codename Bloater*
=======================

Foreword:
- Not (yet) for casual users who aren't into customization, sorry.
- Recommended to power users and users relying heavily on portability.


FEATURES:

:arrow: If you regularly need to open files with something else than the default application (on double-click), PowerLauncher (PL) is for you!
When edited and assigned to a Custom Toolbar Button (CTB), this script will:
- detect the type of the selected file (audio, video, pdf,...),
- detect the left click (LC) or Right Click (RC) on PowerLauncher button,
- launch a specific application or script to open this file (different depending on LeftClick or RightClick)
:arrow: Use it also if you want to manage your Portable File Associations in the same place, with secondary associations in case the primary isn't found
Note: "open with" mode or "command-line arguments" mode are supported.

WARNING - Prerequisites:

:!: This script MUST BE EDITED (at least to input the path of your applications) - it won't work as is.
=> You must know how to retrieve the path of your applications (and command-line if necessary).
:!: For the RightClick function to work, you must have the following tweak enabled (set to 1):
CTBNoRClickDefaultCommands=1
It enables "Direct RightClick" by removing the "Edit, Customize..." from RightClicks on CTB. They can still be accessed by CTRL+RightClick on CTB.

USAGE:

• Install PowerLauncher and edit its Definitions INI file (procedure below)
• Select one or several similar files of your choice (e.g. "myvideo.avi" and "yourvideo.avi") then LC or RC on your PL button to have PowerLauncher open it with your associated application (e.g. VLC)...

USAGE EXAMPLES:

Working example:
:arrow: Select one of your (meaningful) XYS scripts. LeftClick on PowerLauncher button, and see it running (without having to write "::load "MyOtherScriptsPath\blablabla"")
Other case scenarios:
• You want to show your videos at a party but aren't sure what player and codecs your friends have:
- On your flashdrive, put portable XYplorer and VLC (assigned to videos to the LC of PL)
=> now a LeftClick on PowerLauncher button will open all your videos through VLC.
• You like to have SumatraPDF as the default PDF viewer for its unmatched speed (I do!) but sometimes need more power:
- a regular DoubleClick can open your PDFs in SumatraPDF (assigned as the default PFA opener [Tools > Customize File Associations...])
- a PL-LC can open them in PDFXchange Viewer (assigned as PL-LC)
- a PL-RC can open them in Acrobat (assigned as PL-RC)
• You have to work on a friend/client computer and don't know if they have an archiver:
- a PL-LC can open all archives in the window of 7Zip portable (assigned as PL-LC)
- a PL-RC can extract your archives in place - as if you'd had the regular "Extract Here..." menu.


NOTES:

• The "Power" of this script depends on your ability to find the best apps and command lines to open your files. A few notes and examples are included in the default Definitions file.
• The Definitions file is a standard INI but it's not accepted by the board, so it's been renamed to XYS. You can leave it as is or rename its extension to ini as you see fit.
• Multiple items are directly supported through "OpenWith". They probably won't be processed through command-line (too much variation between apps).
:!: For direct SC access to specific Click/Associations (for Keyboard Shortcuts, etc.), the subs are "_LeftClick", "_RightClick" and "_DoubleClick", so use e.g.: load "PowerLauncher.xys", "_LeftClick";
:!: • PowerLauncher can be used to manage ALL your Double Click associations. Use at your own risk - though there's no reason it should break anything, and no slowdown can be noticed. Add the following entry on top in Tools > Customize File Associations: *>::load "PowerLauncher.xys";
(then copy your previous PFA associations to PL's Definition file).

• This script has become a terrible bloatware, I know... :oops: :mrgreen:

But first and foremost: Enjoy & don't hesitate to post your questions, suggestions, comments... 8)
Flux


---------------------
#############
### Update ###
#############

• Only download "PowerLauncher.xys" (if you already have "PowerLauncher-Definitions") and replace old.
• Have a look at the updated Definitions if you want to compare with yours.

• PL's Definitions file has been updated to use Primary and Secondary associations.
It's advised to download and use the new one, and copy/paste your associations from your old file.

• 1.5a3 > 1.5a4: Only comments about XYS have been updated in "PowerLauncher-Definitions", no need to update this file.

--------------------------
################
### Installation ###
################


I. INSTALLATION

To use this script, first, copy the two following files into XYplorer scripts folder: <xyscripts> ,
PowerLauncher.xys
PowerLauncher-Definitions.xys
then either:
1. add load "PowerLauncher.xys"; to the "on click" AND "on right-click" of your custom button, or

2. use the following snippet (with Don's litteral instructions):
-a) Paste ::snippet; into the address bar and press ENTER. A text box will open to enter snippet.
-b) And here comes the copy+paste ready snippet. It will create a new button at the right end of your toolbar.

Code: Select all

Snip: CTB 1
  XYplorer 11.60.0207, 05.10.2012 17:30:00
Action
  NewUserButton
Name
  Power Launcher
Icon
  :goprev
ScriptL
  load "PowerLauncher.xys";
ScriptR
  load "PowerLauncher.xys";
FireClick
  0
[/size]
II. EDITION

• Edit the Definitions file "PowerLauncher-Definitions.xys":
- Assign your favorite applications to the Left and/or Right Click and/or Double Click of the various categories (image, audio,...).
- If needed, add other categories (spreadsheet, database,...), with their associated filetypes (xls,db,...)
- If you're using XYplorer on different computers (portable mode), Assign your favorite portable applications to the Secondary associations.

———————————————————————————

@Work In Progress

Some tips, etc.
- Try to use XYS as "direct openers" for your items. e.g. assign a Picture Metadata Renamer XYS to the right click of your folders, a specific virus command-line, etc.

Why Power Launcher?
Because with only 1 button you:
- clean your catalog from cluttering with OpenWith lines
- get the fastest extra-opener for your common files (e.g. have your pictures 2C-opened in XnView, and PL-opened in Photoshop)
- enhance your portability without having to modify then restore your PFA each time.
- And of course, because you can! :biggrin:

:arrow: Post your Best configs/combos!
Among my current favs/most-used are:
- LightAlloy as LC on videos (as my first portable ultralight player)
- Word as LC on docs (cause 2C runs the much faster TextMaker Viewer)
- MediaCoder as RC on audio
- XYS processed AntiVirus as RC on folders (cause I don't like resident AV)
Last edited by FluxTorpedoe on 15 Nov 2022 17:23, edited 1 time in total.

kunkel321
Posts: 645
Joined: 10 Jun 2012 03:45
Location: Near Seattle

Re: Power Launcher [v1.0 beta1]

Post by kunkel321 »

Pretty cool!

A while back someone had a feature request to add hotkey combos to button clicks.
i.e. not just <click> a button, but <ctrl+click>, <alt+click> etc.

This sortof adds that same type of thing to the PFA "Open With" button. :appl: :biggrin:
ste(phen|ve) kunkel

highend
Posts: 13274
Joined: 06 Feb 2011 00:33

Re: Power Launcher [v1.0 beta1]

Post by highend »

I'd like to use it with keyboard shortcuts instead of clicking on a button.

I know that looking for get("trigger") is a smarter detection for left/right mouse click but it doesn't allow
to execute the script with keyboard shortcuts (and emulate the left or right click).

Beginning of the script:

Code: Select all

"_LeftClick"
  global $Trigger;
  $Trigger = "LeftClick";
  sub "_Main";

"_RightClick"
  global $Trigger;
  $Trigger = "RightClick";
  sub "_Main";

"_Main"
  global $Trigger;
... Already existent code...

The "Input detection" part could be removed.

Ofc the snippet would have to replace with:

Code: Select all

Snip: CTB 1
  XYplorer 11.60.0207, 05.10.2012 17:30:00
Action
  NewUserButton
Name
  Power Launcher
Icon
  :goprev
ScriptL
  load "PowerLauncher.xys", "_LeftClick";
ScriptR
  load "PowerLauncher.xys", "_RightClick";
FireClick
  0
But it would allow the use of two different keyboard shortcuts to get both functionalites.

Comments?
One of my scripts helped you out? Please donate via Paypal

FluxTorpedoe
Posts: 855
Joined: 05 Oct 2011 13:15

Re: Power Launcher [v1.5 alpha3]

Post by FluxTorpedoe »

Good idea!
:arrow: Implemented.
But I didn't use a hidden "_Main" so no need to change the default button or snippet.

@all
I was a bit frightened the first time I used PL as the default runner for all files -with the "*" catchall from PFA- but I haven't noticed the slightest change in performance (on a crappy computer). A testimony to the robustness and flexibility of XYplorer!
So I'm getting used to having all associations managed in PL now - especially useful with the secondary possibilities... :wink:

Have a nice day, 8)
Flux

highend
Posts: 13274
Joined: 06 Feb 2011 00:33

Re: Power Launcher [v1.5 alpha3]

Post by highend »

Another idea: Let PowerLauncher call xys scripts (as apps for filetyes).

E.g. for video files:
Doubclick = just play with application
Rightclick = execute a .xys script, which converts this video

Possiblities are endless.

PowerLauncher.xys:

Code: Select all

*** D:\Users\Highend\Downloads\PowerLauncher.xys 2013-03-12 23:11:33.000000000 +0100
--- D:\Users\Highend\Tools\XYplorer\Data\Scripts\PowerLauncher.xys 2013-03-13 00:02:35.000000000 +0100
***************
*** 135,154 ****
--- 135,166 ----
  					$CL = replace($CL, '<curitem>', '$CurPath');
  				} else {
  					$CL = $App;
  				}
  				$CL = gettoken(eval("""$CL"""), 3, "|");
  				$App = gettoken(eval("""$App"""), 2, "|");
+ 			} elseif (gettoken(eval("""$App"""), 1, "|") == "SC") { // If application is a xys script
+ 				if isset($EXTCLICK) {
+ 					$SC = replace($App, '<curitem>', '$CurItem');
+ 					$SC = replace($SC, '<curitem>', '$CurPath');
+ 				} else {
+ 					$SC = $App;
+ 				}
+ 				$Type = "Script";
+ 				$SC = gettoken(eval("""$SC"""), 3, "|"); // Script label
+ 				$App = gettoken(eval("""$App"""), 2, "|");
  			} else {
  				$App = eval("""$App""");
  			}
  
  			if exists($App) { // If application exists
  
  				if isset($CL) { // If application has command line
  					run "$App $CL", "<curpath>", 2, 1;
+ 				} elseif ($Type == "Script") { // If application is a xys script
+ 					load "$App", "$SC"; // Empty labels are allowed
  				} else {
  					$items = regexreplace(<selitems>, '"\s"', "|");
  					$items = isset($EXTCLICK)? $EXTCLICK : regexreplace($items, '"', "");
  					openwith "$App", , $items;
  				}
  
and the "; --- 3 ---" part of the PowerLauncher-Definitions.xys file could be extended with:
; --- 3 ---
; Add path to executable for PL-LC or PL-RC or PFA-2C all (remove comment ";" when necessary)
;
; For apps with command-line, precede with 'CL|' and append with '| CommandLineArguments ""ItemOrPath""'
; !!! Enclose command-line vars with ""double quotes""
; !!! <selitems> is not supported
; arc=CL|<xypath>\..\PortableApps\7Zip\7za.exe| x ""<curitem>"" -o<curbase>
;
; To call xys scripts, precede with 'SC|' and append with '|LabelName'
; The appendix can be omitted if you call a script without a label
; vid=SC|<xyscripts>\VideoConvert.xys|HiQuality
I didn't test the "if isset($EXTCLICK) {" part of the "} elseif (gettoken(eval("""$App"""), 1, "|") == "SC") {" condition!
If you like, review the changes and incorporate them.

Regards,
Highend
One of my scripts helped you out? Please donate via Paypal

FluxTorpedoe
Posts: 855
Joined: 05 Oct 2011 13:15

Re: Power Launcher [v1.5 alpha4]

Post by FluxTorpedoe »

Another good idea, thanks! :)

I tried to keep things simple, so XYS can be used like standard apps, w/ or w/o CL.
(I ended adding only this crappy detection in the middle of the code)

Code: Select all

	if ($App Like "*.xys") {
		$CL = isset($CL)? $CL : "";
		load "$App", "$CL";
		end 1==1, , 1;
	}
[/size]
As you said, with 3 Clicks running (Exe | Scripts^Labels), possibilities really are endless! :biggrin:
Well, go ahead if you have other ideas!... 8)

highend
Posts: 13274
Joined: 06 Feb 2011 00:33

Re: Power Launcher [v1.5 alpha4]

Post by highend »

Well, go ahead if you have other ideas
Well...

There is one more thing that I'd like to have:
The ability to define several different applications for a filetype.

Either by adding a second divider (because it should still work with command line applications / scripts with labels) to a file type definition like:
vid=<xydrive>\Tools\VLC\vlc.exe!<xydrive>\Tools\LightAlloy\LA.exe
or by doubling that line like:
vid=<xydrive>\Tools\VLC\vlc.exe
vid=<xydrive>\Tools\LightAlloy\LA.exe
I'd prefer the first method ;)

Atm it's possible to define an application with double / left and rightclick, so you could have 3 variations at max. But it's probably hard to remember which application was associated with which click.

By adding the possibility to define more than one app for a filetype, you can let the user select the one he wants.
Either by inputselect() (preferred method) or by popupmenu().

And that's where the possibilities are really becoming endless :)

A real world example (I've removed the "-PRIMARY" part, it wouldn't be needed anymore):
[PowerOpenerLeftClick]
vid=<xydrive>\Tools\VLC\vlc.exe!<xydrive>\Tools\LightAlloy\LA.exe!<xydrive>\Tools\MediaPlayer Classic\mpc-hc.exe
Parsing that line would lead to (if all three applications really exist):
Unbenannt1.png
Unbenannt1.png (13.28 KiB) Viewed 17190 times
The first app in that list (that exists) should be prefixed with a "+" to select it by default, so that you can always put the most wanted application at the first place.

Btw, this would allow you / us to get rid of the -SECONDARY categories in the PowerLauncher-Definitions...

Regards,
Highend
One of my scripts helped you out? Please donate via Paypal

FluxTorpedoe
Posts: 855
Joined: 05 Oct 2011 13:15

Re: Power Launcher [v1.5 alpha4]

Post by FluxTorpedoe »

Well, I think this function would especially make sense with PL's RC, either for those extra apps that can't fit, or simply as a reminder of the apps that can be run... Thanks highend for those ideas, but before I release it,

@all
If you wanna try:
• Just after

Code: Select all

		if $App { // If application defined
add this:

Code: Select all

			if (eval("""$App""") Like "*[?]*") { // If multiple applications
				set $l_Apps;
				foreach($x_App, eval("""$App"""), "?") {
					if ((exists($x_App)) || (exists(gettoken($x_App, 2, "|"))) || (exists("<xyscripts>\$x_App")) || (exists("<xyscripts>\".gettoken($x_App, 2, "|")))) {
						$x_App = replace($x_App, "CL|", "");
						$x_App = replace($x_App, "|", "<tab>");
						$l_Apps = $l_Apps.$x_App."?";";<tab>", ";")."?";
					}
				}
				$App = ($l_Apps)? inputselect("Select application to open:<crlf>   $CurItem<crlf>", $l_Apps, "?", 1, , , , "PowerOpener") : "";
				$AppTmp = replace($App, "<tab>", "|");
				$App = ($AppTmp != $App)? "CL|$AppTmp" : $App;
			}
• In you Definitions file, add several apps separated by a question mark "?", or just add a question mark at the end of a line to have a reminder of a rarely-used app, e.g.
vid=<xydrive>\Tools\VLC\vlc.exe?<xydrive>\Tools\LightAlloy\LA.exe
unk=%temp%\ShowMeYourNamePlease.exe?


@highend
That said, I certainly wouldn't discard the Primary/Secondary approach, because interface-wise, I tend to favor efficiency before all, and/or have some logic to support it, i.e. to be able to act without thinking or choosing. :P
And that's why I implemented this duality: I know what a DoubleClick will launch (I guess we all do :wink: ), and if it's not available, I know I want the next best thing to launch - and not a Menu.
Same goes for PowerLauncher's LeftClick which I use mainly for "heavy" apps; available or not, I don't want to choose, I want it now! 8)

But for PL's RC (which I use mainly as a ContextMenu supplement), a multi-choice makes sense!
So I jumped on your idea, I used the "?" instead of "!" (less risky, can't be used in paths) and inputselect without checkboxes so only one app can be chosen (the first gets auto-focused but not auto-selected unfortunately).

Tell me what you think...

EDIT: Fixed detection of CommandLine Apps and scripts
Last edited by FluxTorpedoe on 14 Mar 2013 14:58, edited 6 times in total.

highend
Posts: 13274
Joined: 06 Feb 2011 00:33

Re: Power Launcher [v1.5 alpha4]

Post by highend »

@FluxTorpedoe

I agree with you that it makes more sense to use multiple application assignments for the rightclick, instead of left or doubleclick.
I (personally) use 95% portable applications by default, so I don't really need the -SECONDARY category but I'm probably not the average user ;)
Just leave it as it is, maybe there are enough people who can make use of a "fallback" application when running XY from a stick.

You need to revise the code for the multiple applications parsing.
Problems:
1. A .xys script won't be found at all if you don't define a path for it
2. A .xys script with a label doesn't work because it won't find the script (because of the label which is treated like part of the full filename)

Regards,
Highend
One of my scripts helped you out? Please donate via Paypal

FluxTorpedoe
Posts: 855
Joined: 05 Oct 2011 13:15

Re: Power Launcher [v1.5 alpha4]

Post by FluxTorpedoe »

Funny, I was just updating the code to support multiple scripts with labels... ;)
So I just extended this line (I updated my previous post with it):

Code: Select all

	if (exists($x_App) || ($x_App Like "*.xys") || (gettoken($x_App, 2, "|") Like "*.xys")) {
I don't know if that solves the issues you were mentioning, let me know. Working good here... Well, except it looks ugly in InputSelect. :) Maybe later for some cosmetics.

As for portability, I'm a big fan too cause I need it, but I'm stuck at about 75%, the rest being un-portable for me (usually because the performance trade-off on a small computer is too big). :?
Anyway, the Secondary fallback is checked only if Primary app is not found, so no slowdown.

Edit: Code wasn't strong enough - Updated previous post and added "cosmetics"

highend
Posts: 13274
Joined: 06 Feb 2011 00:33

Re: Power Launcher [v1.5 alpha4]

Post by highend »

Updated code looks good so far.

Hint:
You could easily replace 3 lines by one...

Code: Select all

$x_App = replace($x_App, "CL|", "");
$x_App = replace($x_App, "|", "<tab>");
$l_Apps = $l_Apps.$x_App."?";
With:

Code: Select all

$l_Apps = $l_Apps.replacelist($x_App, "CL|;|", ";<tab>", ";")."?";
One of my scripts helped you out? Please donate via Paypal

highend
Posts: 13274
Joined: 06 Feb 2011 00:33

Re: Power Launcher [v1.5 alpha4]

Post by highend »

Just stumbled upon an issue...

Just one PFA: *>::load "PowerLauncher.xys";

I have defined one (among several) commands via:
User - Manage Commands...
Open
Item: "D:\Tools\AutoHotKey_L\AutoHotkey.exe" "D:\Tools\AutoHotKey_L\.Scripts\.Startup\AHK_startup.ahk"

Which was working fine before I added the PowerLauncher PFA.

When I want to invoke that command I get
"No item selected to open" in the status bar.

Sure, that's correct, no item is / was selected...

Any workaround available?
One of my scripts helped you out? Please donate via Paypal

Post Reply