Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
App Paths Registry Run Command
#1
I love run command (⊞ Win+R) to launch programs.  Most of the time programs will automatically put an entry into the registry when installing (i.e. qm, chrome, firefox, etc) while other programs do not.

So I wrote this little function to use a tab separated multiline string containing the alias I'd like to use to launch a program from the run command and the path to the exe.  Pretty simple stuff here:

Function AppPaths
Code:
Copy      Help
out
str Data=
;FL    "$program files$\Image-Line\FL Studio 12\FL (scaled).exe"
;Arduino    "C:\arduino-1.8.5\arduino.exe"
;iview    "$program files$\IrfanView\i_view32.exe"
;audacity    "C:\Audacity\audacity.exe"
;audition    "$program files$\Adobe\Audition 1.5\Audition.exe"
;mp3    "$common music$\Sample Music\Kalimba.mp3"

str RegFile="C:\AppPaths.reg"
str RegData="Windows Registry Editor Version 5.00[][]"

ICsv v._create
v.Separator="[9]"

v.FromString(Data)

str Alias Path RegEntry

for int'r 0 v.RowCount
,Alias=v.Cell(r 0)
,Path=v.Cell(r 1)
,Path.expandpath
,Path.findreplace("\" "\\")
,RegEntry=
,F
,;[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\{Alias}.exe]
,;@="{Path}"
,;
,RegData.addline(RegEntry)
,
out RegData
RegData.setfile(RegFile)
;ret
run "regedit.exe" F"/s ''{RegFile}''"
#2
Thank you for this.

You might get error at 'v.FromString(Data)'  if you copy and run this code.

The error:
Quote:Error (RT) ....  0x80070057, The parameter is incorrect

The tabs in string "Data" might be converted to single spaces after you copy and paste it in QM.

But it works after copying and pasting the code then replace the spaces with one tab.
Or change 'v.Separator="[9]"' to pipe   =>   v.Separator="|" and then delimit the string "Data" with pipe in stead of tab.
Thanks.


Forum Jump:


Users browsing this thread: 1 Guest(s)