[Windows 8 Development and Hacking] Deleted member 1890170:
Always was wondering how to run applications one can select from, hereby NOT using any 3rd party launchers as for example "Autorun CD Menu" and/or "Discstarter", etc.pp you have to pay for, if using Window's AUTORUN feature, which works with CD/DVD/BD/USB (USB only if follows U3-Standard) if not deactivated

So I had the idea to realize such a launcher with wellknown "MortScript", the most fantastic scripting tool, IMHO. This launcher of course is not very visually appealing.

How it works:

The folders/files structure on the storage medium basically looks like

AUTORUN.INF

MORTSCRIPT.EXE

AUTORUNMENU.EXE

AUTORUNMENU.MSCR

PROGRAM FILES

DRIVERS

WINDOWS

Note that folder PROGRAM FILES has the 2 subfolders BASE and CUSTOM. BASE contains portable apps that never should be missing, as for example "Firefox Portable"; CUSTOM contains all the portable apps you intend to be present, too.

FYI: A huge collection of portable apps you find HERE.

Also note that each folder/subfolder has the 2 subfolders x86 and x84 where the appropriate portable app goes to. If only a x86 version is available, then it should be copied to x84, too.

\PROGRAM FILES
\BASE
\x86
\CommandPrompt
\<exefile>
\RegistryEditor
\<exefile>
\x64
\CommandPrompt
\<exefile>
\RegistryEditor
\<exefile>
\CUSTOM
\x86
\FileManager
\<exefile>
\x64
\FileManager
\<exefile>

Contents of file AUTORUN.INF looks as

[Autorun]

ShellExecute=AUTORUNMENU.EXE

UseAutoplay=1

The launcher script is coded as follows:

// © 2013 jwoegerbauer
// GPL v2
//
local()
title=systempath("ScriptName")
// determine path
pth=systempath("ScriptPath")
// determine drive
drive=pth
pos=find(drive,":")
if(pos)
drive=substr(drive,1,pos)
else
bigmessage("^NL^Couldn't determine drive letter.^NL^Exiting...","["&title&"] Error")
// quit
exit
endif
is64bit=direxists("C:\Windows\Boot\EFI")
// preset folder paths
pthwindows=pth\"Windows"
pthdrivers=pth\"Drivers"
pthbase=pth\"Program Files\Base"
pthcustom=pth\"Program Files\Custom"
// adjust paths according to Windows's Bit version
if(NOT is64bit)
pthcustom&="\x86"
pthbase&="\x86"
pthdrivers&="\x86"
pthwindows&="\x86"
title&=" (x86)"
else
pthcustom&="\x64"
pthbase&="\x64"
pthdrivers&="\x64"
pthwindows&="\x64"
title&=" (x64)"
endif
if(NOT direxists(pthcustom))
bigmessage("^NL^Folder^NL^"&pthcustom&"^NL^is missing.^NL^Exiting...","["&title&"] Error")
// quit
exit
endif
cntcustom=0
if(direxists(pthcustom))
foreach dir in directories(pthcustom\"*")
if(dir NE "")
cntcustom+=1
endif
endforeach
endif
cntbase=0
if(direxists(pthbase))
foreach dir in directories(pthbase\"*")
if(dir NE "")
cntbase+=1
endif
endforeach
endif

// create and populate array that holds custom applications' path
appscustom=array()
if(cntcustom)
idx=0
foreach dir in directories(pthcustom\"*")
if(dir NE "")
foreach exe in files(dir\"*.exe")
if(exe NE "")
idx+=1
appscustom[idx]=exe
endif
endforeach
endif
sleep(1)
endforeach
endif

// create and populate array that holds base applications' path
appsbase=array()
if(cntbase)
idx=0
foreach dir in directories(pthbase\"*")
if(dir NE "")
foreach exe in files(dir\"*.exe")
if(exe NE "")
idx+=1
appsbase[idx]=exe
endif
endforeach
endif
sleep(1)
endforeach
endif

optscustom=array()
if(elementcount(appscustom))
// populate options menu
idx=0
foreach exe in array(appscustom)
if(fileexists(exe))
idx+=1
optscustom[idx]=toupper(filebase(exe))
endif
sleep(1)
endforeach
endif

optsbase=array()
if(elementcount(appsbase))
// populate options menu
idx=0
foreach exe in array(appsbase)
if(fileexists(exe))
idx+=1
optsbase[idx]=toupper(filebase(exe))
endif
sleep(1)
endforeach
endif

if((NOT elementcount(optscustom))||(NOT elementcount(optsbase)))
bigmessage("^NL^Neither custom nor base apps found.^NL^Exiting...","["&title&"] Error")
// quit
exit
endif

if(elementcount(optscustom)&&elementcount(optsbase))
// display and loop a main menu until cancel button pressed
hint="Please select app's category ...^NL^"
optsmain=array("Custom","Basic")
idx=1
while(idx<>0)
idx=choice(title,hint,0,0,optsmain)
if(idx<>0)
// display and loop category related submenu
if(idx=1)
@appsmenu(appscustom,optscustom,title)
else
@appsmenu(appsbase,optsbase,title)
endif
endif
sleep(1)
endwhile
// done
exit
endif

if(elementcount(optscustom))
@appsMenu(appscustom,optscustom,title)
else
@appmenu(appsbase,optsbase,title)
endif
// done
exit

sub appsmenu(apps,opts,title)
local()
hint="Please select app be run ...^NL^"
idx=1
while(idx<>0)
idx=choice(title,hint,0,0,opts)
if(idx<>0)
// run the app selected
runwait(apps[idx])
endif
sleep(1)
endwhile
endsub

As you might have noticed, all you have to do is to supply the apps to be potentially run on the storage medium. The rest is done by the laucher script.

For your convenience I have packed the files AUTORUN.INF, MORTSCRIPT.EXE, AUTORUNMENU.EXE and AUTORUNMENU.MSCR into a ZIP-file which is attached to this post.

HTH