@ECHO OFF ::*[obrunski.cmd]************************[http://code.google.com/p/obremsdk/]* :: :: NT Command Script: Build & Run Various Source Files :: Version 0.211 :: :: * ActionScript (*.as) :: * JScript (*.js) using Windows Script Host (cscript.exe) :: * PHP (*.php) using PHP5 :: * C/C++ (*.c;*.cpp) using Borland Builder :: * ObremSDK WSH Tools ([file|function]) :: ::-[Usage]-------------------------------------------------------------------- :: :: obrunski.cmd [debug|break] :: :: You can optionally specify either "debug" or "break" as an argument :: following the file to run, but those currently only work with CScript :: (//D and //X parameters respectively). :: :: TEXTPAD :: :: This is intended to be used for building and running files from TextPad. :: Open TextPad and create a new Tool with the following values, replacing :: "C:\Stuff\ObremSDK" with the location of your ObremSDK enlistment: :: :: Command: c:\windows\system32\cmd.exe :: Parameters: /C C:\Stuff\ObremSDK\obrunski.cmd "$File" :: Initial folder: $FileDir :: :: Also, you may need one or more of the following: :: :: ---> Flash 9 Debug Player: for ActionScript (*.as) files, this must be :: associated with SWF files. :: :: ---> Borland C++ Build 5.5: for C/C++, old school I know. I'll update :: this to use Microsoft Visual Studio at some point. :: :: No longer required, but worth mentioning: :: :: ---> Windows Resource Kit: contains command-line tools SLEEP, TAIL, etc. :: https://www.microsoft.com/downloads/details.aspx :: ?FamilyID=9d467a69-57ff-4ae7-96ee-b18c4790cffd&displaylang=en :: ::-[History]------------------------------------------------------------------ :: 2008-06-04 by NeilO .... v0.211: Fixed deletion of temp Flash Trust file. :: 2008-05-13 by NeilO .... v0.21: Flash Trust configuration written for :: ActionScript/MXML when DEBUG/BREAK args used. :: 2008-04-18 by NeilO .... v0.202: Temporary variables (_FN/_ARGS) deleted. :: 2008-04-18 by NeilO .... v0.201: Fixed CScript; arguments not being passed. :: 2008-04-18 by NeilO .... v0.20: Run ObremSDK tools by leaving the extension :: off the first argument; if it is found in the wsh/ :: directory as a file then that is run. Otherwise :: the wsh-run.wsf script is run which interprets it :: as a function name. :: 2008-01-24 by NeilO .... v0.123: Rolled back previous change for picking :: up MXMLC configuration file. Turns out MXMLC :: does this anyway looking for "-config.xml". :: 2008-01-04 by NeilO .... v0.122: MXMLC configuration files will be picked :: up automatically as long as they are named :: "swf.config" or "swc.config" (depending on what :: kind of output you're looking for). :: 2007-10-31 by NeilO .... v0.121: *.MXML files interpreted as ActionScript :: 2007-10-13 by NeilO .... v0.12: flashlog.txt is passed to 'TYPE' before :: 'TAIL' starts :: 2007-10-11 by NeilO .... v0.11: mm.cfg is auto-created if not found. :: : MXMLC.exe presence on PATH is detected, else :: tries standard install location of Flex 2 SDK :: 2007-10-10 by NeilO .... Created. :: :: (C)opyright 2007++ by Neil C. Obremski; New BSD License ::***********************[http://www.opensource.org/licenses/bsd-license.php]* :: switch based on extension; call specific file handler IF "%~x1" == ".as" GOTO ActionScript IF "%~x1" == ".mxml" GOTO ActionScript IF "%~x1" == ".js" GOTO CScript IF "%~x1" == ".vbs" GOTO CScript IF "%~x1" == ".wsf" GOTO CScript IF "%~x1" == ".php" GOTO Php IF "%~x1" == ".cpp" GOTO Bcc32 IF "%~x1" == ".c" GOTO Bcc32 IF "%~x1" == ".cmd" GOTO BatchFile IF "%~x1" == ".bat" GOTO BatchFile IF "%~x1" == "" GOTO ObremSDKTool ECHO.Unrecognized Extension: "%~x1" SET ERRORLEVEL=-1 GOTO :EOF ::_[ObremSDKTool]_____________________________________________________________ :: :: Special handler, the first argument is considered to be either a function :: or a file. If it's a file then it must be in the /wsh/ directory with an :: extension of .js, .vbs, or .wsf. :: :ObremSDKTool SET _FN= IF EXIST "%~p0wsh\%~1.js" IF "%_FN%" == "" SET _FN=%~p0wsh\%~1.js IF EXIST "%~p0wsh\%~1.vbs" IF "%_FN%" == "" SET _FN=%~p0wsh\%~1.vbs IF EXIST "%~p0wsh\%~1.wsf" IF "%_FN%" == "" SET _FN=%~p0wsh\%~1.wsf IF NOT "%_FN%" == "" SHIFT IF "%_FN%" == "" SET _FN=%~p0wsh\wsh-run.wsf IF "%~1" == "debug" SET _ARGS=%_ARGS% //D & SHIFT IF "%~1" == "break" SET _ARGS=%_ARGS% //X & SHIFT cscript //NOLOGO%_ARGS% %_FN% %1 %2 %3 %4 %5 %6 %7 %8 %9 SET _FN= GOTO :EOF ::_[BatchFile]__________________________________________________(*.cmd;*.bat)_ :: :: :BatchFile IF "%~2" == "debug" @ECHO ON IF "%~2" == "break" @ECHO ON CALL %1 @ECHO OFF GOTO :EOF ::_[CScript]_______________________________________________(*.js;*.vbs;*.wsf)_ :: :CScript SET _ARGS= IF "%~2" == "debug" SET _ARGS=%_ARGS% //D IF "%~2" == "break" SET _ARGS=%_ARGS% //X SHIFT /2 IF NOT "%~2" == "" GOTO CScript cscript //NOLOGO%_ARGS% %1 %2 %3 %4 %5 %6 %7 %8 %9 SET _ARGS= GOTO :EOF ::_[PHP]______________________________________________________________(*.php)_ :: :Php PHP -f %1 GOTO :EOF ::_[Bcc32]________________________________________________________(*.cpp;*.c)_ :: :Bcc32 ECHO. ECHO.: ECHO.: Building %~1 ECHO.: bcc32 %1 IF NOT "%ERRORLEVEL%" == "0" GOTO :EOF ECHO. ECHO.: ECHO.: Running %~n1.exe ECHO.: %~n1.exe GOTO :EOF ::_[ActionScript]______________________________________________________(*.as)_ :: :ActionScript :: Obrunski debugging option IF "%~2" == "debug" SET _ARGS=%_ARGS% -debug=true IF "%~2" == "break" SET _ARGS=%_ARGS% -debug=true :: Default is to compile SET FLEXCOMP=MXMLC.exe :: Trust configuration path SET FLASHTRUST=%USERPROFILE%\Application Data\Macromedia\Flash Player\#Security\FlashPlayerTrust\obrunski.cfg :: enable logging if mm.cfg isn't found IF NOT EXIST "%HOMEDRIVE%%HOMEPATH%\mm.cfg" CALL :MmCfg :: make sure we know where Flex's bin directory is IF "%FLEXBIN%" == "" %~d0%~p0bin\windows\where.exe mxmlc.exe 1>NUL 2>NUL IF NOT "%ERRORLEVEL%" == "0" CALL :FindFlexBin IF NOT "%ERRORLEVEL%" == "0" GOTO :EOF ECHO.: ECHO.: Building %~1 ECHO.: IF EXIST "%FLASHTRUST%" DEL "%FLASHTRUST%" "%FLEXBIN%%FLEXCOMP%" %_ARGS% %1 IF NOT "%ERRORLEVEL%" == "0" GOTO :EOF IF "%~2" == "debug" ECHO.%~d1%~p1>"%FLASHTRUST%" IF "%~2" == "break" ECHO.%~d1%~p1>"%FLASHTRUST%" :: SET _BASENAME=%_BASENAME:*.=% ECHO. ECHO.: ECHO.: Running %~n1.swf (press CTRL+BREAK to end) ECHO.: START %~n1%.swf IF NOT "%ERRORLEVEL%" == "0" GOTO :EOF %~d0%~p0bin\windows\sleep.exe 2 type "%APPDATA%\Macromedia\Flash Player\Logs\flashlog.txt" ECHO. ECHO. ... tailing ... ECHO. %~d0%~p0bin\windows\tail.exe -f "%APPDATA%\Macromedia\Flash Player\Logs\flashlog.txt" GOTO :EOF ::_[MmCfg]____________________________________________________________________ :: :: Creates mm.cfg file with tracing enabled. :: :MmCfg ECHO.ErrorReportingEnable^=^1>"%HOMEDRIVE%%HOMEPATH%\mm.cfg" ECHO.TraceOutputFileEnable^=^1>>"%HOMEDRIVE%%HOMEPATH%\mm.cfg" GOTO :EOF ::_[FindFlexBin]______________________________________________________________ :: :: Attempts to find MXMLC.exe and puts the location in an MXMLC variable. :: :FindFlexBin SET FLEXBIN=%ProgramFiles%\Adobe\Flex Builder 2\Flex SDK 2\bin\ IF EXIST "%FLEXBIN%\mxmlc.exe" GOTO :EOF SET FLEXBIN=C:\Flex\bin\ IF EXIST "%FLEXBIN%\mxmlc.exe" GOTO :EOF ECHO.Flex "bin" not found! Please install Flex 2 SDK or put its "bin" folder in your system PATH. SET ERRORLEVEL=1 GOTO :EOF