To conclude, here is the final script (available with next mGalaxy version).
With this script, no need to specify your local path to Daemon Tools v10, mGalaxy will find it by itself!
;----------========== Parsing (common to every scripts) ==========----------
;
; There has been a call from mGalaxy to AutoIt and a commandline has been passed to it:
; Structure:/AutoIt3ExecuteScript "Path_to_script(between quotes)" Path_to_emu Emu_parameters(including a "Path_to_rom"(between quotes))
; Example:/AutoIt3ExecuteScript "C:\...\MESS [Script].au3" C:\...\mess64.exe a800 -flop1 "C:\...\Boulder_Dash.zip" -skip_gameinfo -nowindow
;
; 1. We don't need the part related to AutoiIt anymore [/AutoIt3ExecuteScript "Path to script (between quotes)"], the rest is assigned to '$commandline'
; 2. '$commandline' is then split in two: [Path_to_emu] goes to '$app', [parameters(including a "Path to rom" (between quotes))] goes to '$command'
; 3. Some apps (MESS for instance, when it searchs for a system Bios) need to know the path to their 'Working Directory'. We do 'extract' it from the full app path
;
; 1
Local $count = StringInStr($CmdLineRaw, '.au3"', 0 , 1, 1)
Local $commandline = StringTrimLeft( $CmdLineRaw, $count + 5 )
; 2
Local $count2 = StringInStr($commandline, '.exe', 0 , 1, 1)
local $app = StringLeft ($commandline, $count2 + 3 )
local $command = StringTrimLeft($commandline, $count2 + 4 )
if not $command then exit 0
; 3
Local $workingDir = StringRegExpReplace($app, "\\[^\\]*$", "")
FileChangeDir($workingDir)
;---------------------------------------------------------------------------
;Get path to DTAgent.exe
Local $pathdaemon = RegRead("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run", "DAEMON Tools Lite Automount")
If not $pathdaemon Then
MsgBox(4096, "Search error", "DAEMON Tools Lite not found. Please install it!")
exit 0
Endif
$pathdaemon = StringTrimRight ( $pathdaemon, 9 )
RunWait($pathdaemon & ' -mount dt,0,' & $command )
RunWait('"' & $app & '"')
RunWait($pathdaemon & ' -unmount dt,0')
Exit 0