Unexplained error when running dart2js.bat - dart

Attempting to generate JavaScript from my Dart application yields the following message and no JavaScript:
--- Jun 21, 2013 9:50:51 PM Running dart2js... ---
C:\Program Files (x86)\Dart\dart-sdk\bin\dart2js.bat --suppress-warnings
--out=C:\Users\nledon\dart\UnityPlayer\web\unityplayer.dart.js
C:\Users\nledon\dart\UnityPlayer\web\unityplayer.dart\Dart\dart-sdk\" was unexpected at this time.
Any idea what might be going on here?
Thanks.
dart2js.bat
#echo off
REM Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
REM for details. All rights reserved. Use of this source code is governed by a
REM BSD-style license that can be found in the LICENSE file.
setlocal
rem Handle the case where dart-sdk/bin has been symlinked to.
set DIR_NAME_WITH_SLASH=%~dp0
set DIR_NAME=%DIR_NAME_WITH_SLASH:~0,-1%%
call :follow_links "%DIR_NAME%", RETURNED_BIN_DIR
rem Get rid of surrounding quotes.
for %%i in ("%RETURNED_BIN_DIR%") do set BIN_DIR=%%~fi
rem Get absolute full name for SDK_DIR.
for %%i in ("%BIN_DIR%\..\") do set SDK_DIR=%%~fi
rem Remove trailing backslash if there is one
IF %SDK_DIR:~-1%==\ set SDK_DIR=%SDK_DIR:~0,-1%
set DART2JS=%SDK_DIR%\lib\_internal\compiler\implementation\dart2js.dart
set DART=%BIN_DIR%\dart
set SNAPSHOT=%BIN_DIR%\snapshots\utils_wrapper.dart.snapshot
set EXTRA_OPTIONS=
set EXTRA_VM_OPTIONS=
if _%DART2JS_DEVELOPER_MODE%_ == _1_ (
set EXTRA_VM_OPTIONS=%EXTRA_VM_OPTIONS% --checked
)
if exist "%SNAPSHOT%" (
set EXTRA_OPTIONS=%EXTRA_OPTIONS% "--library-root=%SDK_DIR%"
)
rem See comments regarding options below in dart2js shell script.
set EXTRA_VM_OPTIONS=%EXTRA_VM_OPTIONS% --heap_growth_rate=512
if exist "%SNAPSHOT%" (
"%DART%" %EXTRA_VM_OPTIONS% "%SNAPSHOT%" "dart2js" %EXTRA_OPTIONS% %*
) else (
"%DART%" %EXTRA_VM_OPTIONS% "%DART2JS%" %EXTRA_OPTIONS% %*
)
endlocal
exit /b %errorlevel%
:follow_links
setlocal
for %%i in (%1) do set result=%%~fi
set current=
for /f "tokens=2 delims=[]" %%i in ('dir /a:l ^"%~dp1^" 2^>nul ^
^| find "> %~n1 ["') do (
set current=%%i
)
if not "%current%"=="" call :follow_links "%current%", result
endlocal & set %~2=%result%
goto :eof
:end
Dart Version & OS:
Dart Editor version 0.6.17_r26023
Dart SDK version 0.6.17.2_r26023
Windows 7 Enterprise

I resolved the issue by moving my dart editor installation to *C:\Program Files*
The Dart Editor doesn't seem to understand the *C:\Program Files (x86)* path.
Filed Issue #12452: https://code.google.com/p/dart/issues/detail?id=12452&thanks=12452&ts=1376491330

Related

For loop in batch file dies calling Windows conversion tool

ParseRat is an old program that I have had a long time. I need to transpose text files in c:\wherefilesare.
I run the below and it just dies:
echo on
setlocal EnableDelayedExpansion
cd c:\wherefilesare
SET progdir=C:\program files (x86)\ParseRat
for%%x in (*.txt) do ("%%progdir%\parserat.exe" "%%x.txt" "%%progdir%\test.prz" "%%x.csv"
As #Squashman says:
"You (have) an extra percent symbol for all your (environment) variables. You are also not using the FOR meta-variable correctly. Essentially %%x expands to the actual file name with the extension. So it will see file1.txt.txt and file1.txt.csv. You need to use the command modifiers. %%~nx to get just the file name without the extension."
Also, you are missing a closing parenthesis...
echo on
setlocal EnableDelayedExpansion
cd c:\wherefilesare
SET progdir=C:\program files (x86)\ParseRat
for %%x in (*.txt) do (
"%progdir%\parserat.exe" "%%~nx.txt" "%progdir%\test.prz" "%%~nx.csv"
)

How to get relative path from current folder?

This is what i currently get with FOR loop:
FOR /R "ProgramFolder" %%P in (*) do (
echo %%P
)
C:\Folder\Folder2\ProgramFolder\Managed\bolt.dll
C:\Folder\Folder2\ProgramFolder\Resources\fmodstudio.dll
C:\Folder\Folder2\ProgramFolder\Plugins\dll\DynamicWaterNativeWrapper.dll
How to get pathes like this?
Managed\bolt.dll
Resources\fmodstudio.dll
Plugins\dll\DynamicWaterNativeWrapper.dll
edited on dbenham comments
#echo off
setlocal enableextensions disabledelayedexpansion
pushd c:\somewhere\ProgramFolder
for /f "tokens=1,* delims=\" %%a in (
'xcopy . "%temp%" /l /s'
) do if not "%%b"=="" echo(%%b
popd
The basic idea behind this code is to use the xcopy command not to copy, but to retrieve a list (/l) of the files that should be processed with relative paths. For it to work, it is necessary to first change the current active directory to the required one (pushd) and use a relative reference to the current folder (.)
The output of xcopy command with this configuration will be in the form
.\folder\folder\file.ext
To remove the prefixing dot and backslash the for /f is configured to use the slashes as delimiters and to retrieve the first token (the dot) before the first backslash and the rest of the line as the second token, that is, the relative paths
As the xcopy command output includes an aditional line with the total number of files, and this line will result in an aditional blank line in the output of the script, an aditional if is included to discard this line.

How to compile an MQL4 file with a command-line tool?

Now I am compiling my MetaTrader .mq4 files to .ex4 files with MetaEditor.
But my .mq4 files are generated by a Java-process, and I would like to automate the compilation process.
Is there a command-line compiler tool I could call programmatically?
To compile a source code file from a command line, you can use MetaEditor for that. For example:
metaeditor.exe /compile:"C:\Program Files\Platform\MQL5\Scripts\myscript.mq5"
For 64-bit use metaeditor64.exe instead.
In Linux/macOS, this can be achieved using Wine, e.g.:
wine metaeditor.exe /compile:"MQL4/Experts/MACD Sample.mq4"
For mass compilation, you can specify folder, like:
metaeditor.exe" /compile:"MQL5\Scripts"
To specify custom MQL5/MQL4 folder with include files, you can use /inc parameter, for example:
metaeditor.exe /compile:"./Scripts" /inc:"C:\Program Files\TradingPlatform 2\MQL5"
For additional information about the compilation process, you can use /log:
metaeditor.exe /compile:"C:\Program Files\Platform\MQL5\Scripts\myscript.mq5" /log
To check for the syntax only, add extra /s.
If the compilation fails, the MQL4.log file would be created in the platform folder with the relevant details. It's going to be in UTF-16 format, so you may need a special tool for it (such as Vim, Ruby, findstr or rg).
To specify the custom compilation log file, use /log:file.log parameter, e.g.
metaeditor.exe /log:errors.log /compile:.
Note: Display to the standard output is not supported (although on Linux you can use: /log:CON).
For more information, check: Compilation from the Command Line
Some time ago you could download the compiler of MQL4/MQL5 programs that runs separately from MetaEditor — MQL.exe. It was distributed separately from the terminal and you could download it at the following addresses:
https://download.mql5.com/cdn/web/metaquotes.software.corp/mt5/mql.exe
https://download.mql5.com/cdn/web/metaquotes.software.corp/mt5/mql64.exe
Usage (as per MQL4/MQL5 Compiler build 1162 from 02 Jul 2015):
mql.exe [<flags>] filename.mq5
/mql5 - compile mql5 source
/mql4 - compile mql4 source
/s - syntax check only
/i:<path> - set working directory
/o - use code optimizer
However the standalone compiler was intentionally removed, so now links point to the installer in favor of MetaEditor.
Much older version of MetaTrader prior to build 600 had metalang.exe included with the platform.
However in build 616, MetaQuotes intentionally has removed the compiler (mql.exe/mql64.exe) from the standard MetaTrader installation.
This means if you upgrade your MT platform (>616), the compiler executable will be removed.
This is a little late, but since I wrote a little script for UltraEdit/UEStudio and have received heaps of help from stackoverflow, here is my script. It compiles then copies the ex4 to a number of test MT4 installations:
The "Compile" button on UE does:
"MT4Compile.bat" "%FilePath" "%FileName"
Start in path eg: D:\Development\MQ4 (Location of MT4Compile.bat)
Normally my source code is in a library tree under D:\Development\MQ4[Group][ExpertName][FileName].mq4
Contents of D:\Development\MQ4\MT4Compile.bat:
#echo off
rem Version: 1.1
rem Date: 24 Sep 2013
rem Author: Shawky
rem Refer to HELP: for info
SET XC=xcopy /D /Y /V /F /I
SET PROGDIR=D:\Development\Go Pro Demo (MQ4 Testing)
SET DSTPATH=%PROGDIR%\experts
SET SIMPATH1=G:\Apps\MT4\BackTest IC (Recent)\experts
SET SIMPATH2=G:\Apps\MT4\BackTest IC (All)\experts
SET SIMPATH3=G:\Apps\MT4\BackTest Go (All)\experts
SET DEPLOYPATH=D:\Development\Deployment\experts
SET SRCPATH=%1
SET SRCPATH=%SRCPATH:"=%
IF "%SRCPATH%"=="" (
SET SRCPATH=[Arg1]
)
SET APPNAME=%2
SET APPNAME=%APPNAME:"=%
IF "%APPNAME%"=="" (
SET APPNAME=[Arg2]
)
SET SRCFILE=%APPNAME%.mq4
SET DSTFILE=%APPNAME%.ex4
SET CMD="%PROGDIR%\metalang.exe" "%SRCFILE%" "%DSTFILE%"
IF "%SRCPATH%"=="[Arg1]" GOTO HELP
IF "%APPNAME%"=="[Arg2]" GOTO HELP
cd %SRCPATH%
IF NOT EXIST "%SRCFILE%" (
SET ERROR=Error: File "%SRCFILE%" does not exist in %SRCPATH%
GOTO HELP
)
echo .
echo Compiling %SRCFILE% to %DSTPATH%\%DSTFILE%
echo .
DEL *.log
%CMD%
IF EXIST "%DSTFILE%" (
echo .
echo Distributing executable to SIM and Deployment paths
%XC% "%DSTFILE%" "%DSTPATH%\"
IF EXIST "%SIMPATH1%" %XC% "%DSTFILE%" "%SIMPATH1%\"
IF EXIST "%SIMPATH2%" %XC% "%DSTFILE%" "%SIMPATH2%\"
IF EXIST "%SIMPATH3%" %XC% "%DSTFILE%" "%SIMPATH3%\"
IF EXIST "%DEPLOYPATH%" copy /B /Y "%DSTFILE%" "%DEPLOYPATH%\%APPNAME% (Dev).ex4"
)
goto END
:HELP
echo . Metatrader 4 Command Line utility for compiling MT4 programmes.
echo .
echo . This batch files allows MT4 applications to be compiled from a directory other than .\experts.
echo . The output will be copied to experts after compilation.
echo .
echo . [Arg1] = Path to MT4 application directory
echo . [Arg2] = Name (without extension) of the main MQ4 source code to compile.
echo .
echo . Example:
echo . MT4Compile.bat "D:\Development\MQ4\MyExpert\" "PrimaryMQ4FileName"
echo .
echo . Programme Directory: %PROGDIR%
echo . Source Path: %SRCPATH%
echo . Source File: %SRCFILE%
echo . Destination File: %DSTFILE%
echo . Target Path: %DSTPATH%
echo .
echo . Argument 1: %SRCPATH%
echo . Argument 2: %APPNAME%
echo .
echo . Commands to execute would be:
echo .
echo . %CMD%
echo . %XC% "%DSTFILE%" "%DSTPATH%\"
echo .
echo . %ERROR%
echo .
pause
:END
All the best.
Shawky
Yes, there is an executable in the install directory of the terminal. It is called metalang.exe.

Noobs approach to automate x264 cmd

so here is my script to loop through specific video extensions » add a manual profile » generate necessary *.bat & finally a final 'loader' batch file to execute previous *.bat files sequentially & necessary logging (this gives quiet a deal of freedom if you so want)
::==
:: gets lines into vars c1 v2 v...
#echo off
:: user input required
cd /d "d:\Trainers\out\"
setLocal EnableDelayedExpansion
dir /B /O:N | findstr ".wmv$ " >filename.txt
echo. >log.txt
:: user input required
for /f "tokens=* delims= " %%a in ('type filename.txt ^|findstr ".wmv$"') do (
set /a n+=1
echo. >file!n!.bat
set in=%in%%%a
:: user input required
set out=!in:.wmv=.mp4!
:: user input required
set v=x264 --crf 23 --level 3.1 --tune film -o "d:\Trainers\out\!in!" "d:\Trainers\out\!out!"
echo. !v!>file!n!.bat
)
dir /B /O:N | findstr ".bat$ " >x264_home.txt
for /f "tokens=* delims= " %%a in (x264_home.txt) do (
set /a n+=1
:: mtee is an external library Google it
set "z=call %%a | mtee /d/c/t/+ log.txt"
echo. !z! >> x264_home.bat
)
echo. #echo off > newFile.bat
type x264_home.bat >> newFile.bat
type newFile.bat > x264_home.bat
del newFile.bat,x264_home.txt,filename.txt
echo. pause >> x264_home.bat
echo. #echo All Operation done... >> x264_home.bat
:: user input required
move "d:\Trainers\out\*.bat" "d:\Program Files\x264_auto\test\"
:: user input required
move "d:\Trainers\out\log.txt" "d:\Program Files\x264_auto\test\"
::==
Now the above code which is fairly easy to understand (bcz its written by a noob) run perfectly & create necessary files. For instance one of the file1.bat looks like this:
x264 --crf 23 --level 3.1 --tune film --preset veryslow --deblock -2:-1 --zones 24233,25324,q=20 --acodec aac --abitrate 80 -o "d:\Trainers\out\1.wmv" "d:\Trainers\out\1.mp4"
...& the loader .bat file looks like
#echo off
call file1.bat | mtee /d/c/t/+ log.txt
call file2.bat | mtee /d/c/t/+ log.txt
call file3.bat | mtee /d/c/t/+ log.txt
#echo All Operation done...
You see this is a quiet flexible approach in that you can use special filestr » set another loop » set another profile. Furthermore every batch file can be latter edited especiialy when you heavily use --zone x264 feature
I am successful because there is no error in any output ...but its the x264.exe (provider/compiler x264GUI) throws error which it otherwise don't?
d:\Program Files\x264_auto\test>x264 --crf 23 --level 3.1 --tune film --preset
veryslow --deblock -2:-1 --zones 24233,25324,q=20 --acodec aac --abitrate 80 -o
"d:\Trainers\out\1.wmv" "d:\Trainers\out\1.mp4"
ffms [error]: could not create index
lavf [error]: could not open input file
raw [error]: raw input requires a resolution.
x264 [error]: could not open input file `d:\Trainers\out\1.mp4' via any method!
its the x264 thats the culprit perhaps a senior guide is required here
Is your x264 compiled with mp4 input support? (I believe that needs lavc/lavformat, just download precompiled x264 from x264.nl which has all extras)
Do you get the same error if you run the same command directly? (not through bat files)
If yes, does it only happen when you use zones? (if it does, then post an example of your command line as x264 bug to x264-devel mailing list)
If no, are you sure you are running the exact same x264? (perhaps there are several in different places on your system)
I recommend doing what you're doing either (a) in python with subprocess.call(...) or (b) in cygwin/bash/shell script, or . bat files are pretty much the wrong answer to any problem :) The nice thing about either of those two is that they have simple, regular escaping rules for program arguments.

Executing bat file and returning the prompt

I have a problem with cruisecontrol where an ant scripts executes a bat file that doesn't give me the prompt back. As a result, the project in cruisecontrol keeps on bulding forever until I restart cruisecontrol. How can I resolve this?
It's a startup.bat from wowza (Streaming Server) that I'm executing:
#echo off
call setenv.bat
if not %WMSENVOK% == "true" goto end
set _WINDOWNAME="Wowza Media Server 2"
set _EXESERVER=
if "%1"=="newwindow" (
set _EXESERVER=start %_WINDOWNAME%
shift
)
set CLASSPATH="%WMSAPP_HOME%\bin\wms-bootstrap.jar"
rem cacls jmxremote.password /P username:R
rem cacls jmxremote.access /P username:R
rem NOTE: Here you can configure the JVM's built in JMX interface.
rem See the "Server Management Console and Monitoring" chapter
rem of the "User's Guide" for more information on how to configure the
rem remote JMX interface in the [install-dir]/conf/Server.xml file.
set JMXOPTIONS=-Dcom.sun.management.jmxremote=true
rem set JMXOPTIONS=%JMXOPTIONS%
-Djava.rmi.server.hostname=192.168.1.7
rem set JMXOPTIONS=%JMXOPTIONS%
-Dcom.sun.management.jmxremote.port=1099
rem set JMXOPTIONS=%JMXOPTIONS%
-Dcom.sun.management.jmxremote.authenticate=false
rem set JMXOPTIONS=%JMXOPTIONS%
-Dcom.sun.management.jmxremote.ssl=false
rem set JMXOPTIONS=%JMXOPTIONS%
-Dcom.sun.management.jmxremote.password.file=
"%WMSCONFIG_HOME%/conf/jmxremote.password"
rem set JMXOPTIONS=%JMXOPTIONS% -Dcom.sun.management.jmxremote.access.file=
"%WMSCONFIG_HOME%/conf/jmxremote.access"
rem log interceptor com.wowza.wms.logging.LogNotify
- see Javadocs for ILogNotify
%_EXESERVER% "%_EXECJAVA%" %JAVA_OPTS% %JMXOPTIONS%
-Dcom.wowza.wms.AppHome="%WMSAPP_HOME%"
-Dcom.wowza.wms.ConfigURL="%WMSCONFIG_URL%"
-Dcom.wowza.wms.ConfigHome="%WMSCONFIG_HOME%"
-cp %CLASSPATH% com.wowza.wms.bootstrap.Bootstrap start
:end
From a first look it seems that adding a start command to the line where the server is started might help, i.e.:
start "" %_EXESERVER% "%_EXECJAVA%" %JAVA_OPTS% %JMXOPTIONS%
-Dcom.wowza.wms.AppHome="%WMSAPP_HOME%"
-Dcom.wowza.wms.ConfigURL="%WMSCONFIG_URL%"
-Dcom.wowza.wms.ConfigHome="%WMSCONFIG_HOME%"
-cp %CLASSPATH% com.wowza.wms.bootstrap.Bootstrap start

Resources