; ; AutoHotkey Version: 1.x ; Language: English ; Platform: Win9x/NT ; Author: A.N.Other ; ; Script Function: ; To use filenames in WIHU (Windows Installation Helper Utility) ; with wildcards like * (asterisk) and ? (question mark)folder) ; http://www.kalytta.com/wihu.php ; ; Related forum thread: ; http://www.msfn.org/board/WIHU-Helper-t118045.html ; ; Readme: ; http://www.autohotkey.net/xfm/?a=edit&d=WIHU_Helper/WIHU_Helper.ahk ; ; SetBatchLines -1 ; #NoTrayIcon #SingleInstance force ; Run script only one time in memory #NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases. SendMode Input ; Recommended for new scripts due to its superior speed and reliability. ; SetWorkingDir , %A_ScriptDir% ; Ensures a consistent starting directory. ParamCount = %0% ; check quantity of parameters If ParamCount = 0 _ERROR_EXIT("No parameters passed there should be at least one parameter!") ; split path InFile = %1% SplitPath, InFile , InFileName, InDir, InExtension, InNameNoExt, InDrive SetWorkingDir , %InDir% ; working dir = setup file's dir ; check if InFile isn't empty If (InFile = "") _ERROR_EXIT("There was no filename in " . InFile . "!") ; resolve file pattern OutFile := "" Loop , %InFileName% { OutFile := A_LoopFileName } ; check if a matching file was found If (OutFile = "") _ERROR_EXIT("No matching setup file for the file pattern " . InFileName . " in " . InDir . " found!") If ParamCount > 1 Loop , %ParamCount% { If A_Index = 1 continue CurrentParam := %A_Index% Params .= CurrentParam . " " ; Msgbox , %CurrentParam%`n%Params% } ; Msgbox , %Outfile% %Params% ; execute the file RunWait , %Outfile% %Params% , %A_WorkingDir% , UseErrorLevel If ErrorLevel _ERROR_EXIT(A_LoopFileName . " failed with ErrorLevel: " . ErrorLevel . "`nThe ErrorCode is: " . A_LastError , ErrorLevel) return _ERROR_EXIT(sMSG , ErrorCode = 42) { Msgbox , 262160 , Error , %sMSG% , 10 ExitApp , %ErrorCode% }