Search the Community
Showing results for tags 'build with batch file'.
-
This isn't really an example script nor is it useful at all but it's related to autoit and it's something nice to play with so hope someone who doesn't know much about batch files finds it interesting at the most. Basically, all you gotta do is copy and past this into the header of your script and rename the script from "script.au3" to 'script.bat" or "script.cmd" and run it to compile the script. ;@ECHO OFF ;COLOR 0A & TITLE Terminal AutoIt Compiler Interface ;SET THIS=%0 ;SET REGKEY="HKLMSoftwareAutoIt v3AutoIt" ;SET REGVAL=InstallDir ;SET AUTWRPR=SciTEAutoIt3WrapperAutoIt3Wrapper.exe ;SET INST_DIR= ;ECHO +^>Querying registry value... ;REG QUERY %REGKEY% /v %REGVAL% 2>NUL || (COLOR 0C & ECHO !^>Error getting registry value! & PAUSE & EXIT /b 1) ;FOR /f "tokens=2,*" %%a IN ('REG QUERY %REGKEY% /v %REGVAL% ^| FINDSTR %REGVAL%') DO (SET INST_DIR=%%<img src='http://www.autoitscript.com/forum/public/style_emoticons/<#EMO_DIR#>/cool.png' class='bbc_emoticon' alt='B)' /> ;IF NOT DEFINED INST_DIR (ECHO !^>Error setting value! & PAUSE & EXIT /b 1) ;SET AUTWRPR="%INST_DIR%%AUTWRPR%" ;IF EXIST %AUTWRPR% (ECHO +^>AutoIt3Wrapper Found.) ELSE (COLOR 0C & ECHO !^>AutoIt3Wrapper Not Found. & PAUSE & EXIT /b 1) ;ECHO +^>Initiating compilation procedure! & %AUTWRPR% /prod /in %THIS% ;ECHO +^>Compilation procedure has finished! & PAUSE & EXIT Example ;@ECHO OFF ;COLOR 0A & TITLE Terminal AutoIt Compiler Interface ;SET THIS=%0 ;SET REGKEY="HKLMSoftwareAutoIt v3AutoIt" ;SET REGVAL=InstallDir ;SET AUTWRPR=SciTEAutoIt3WrapperAutoIt3Wrapper.exe ;SET INST_DIR= ;ECHO +^>Querying registry value... ;REG QUERY %REGKEY% /v %REGVAL% 2>NUL || (COLOR 0C & ECHO !^>Error getting registry value! & PAUSE & EXIT /b 1) ;FOR /f "tokens=2,*" %%a IN ('REG QUERY %REGKEY% /v %REGVAL% ^| FINDSTR %REGVAL%') DO (SET INST_DIR=%%<img src='http://www.autoitscript.com/forum/public/style_emoticons/<#EMO_DIR#>/cool.png' class='bbc_emoticon' alt='B)' /> ;IF NOT DEFINED INST_DIR (ECHO !^>Error setting value! & PAUSE & EXIT /b 1) ;SET AUTWRPR="%INST_DIR%%AUTWRPR%" ;IF EXIST %AUTWRPR% (ECHO +^>AutoIt3Wrapper Found.) ELSE (COLOR 0C & ECHO !^>AutoIt3Wrapper Not Found. & PAUSE & EXIT /b 1) ;ECHO +^>Initiating compilation procedure! & %AUTWRPR% /prod /in %THIS% ;ECHO +^>Compilation procedure has finished! & PAUSE & EXIT #AutoIt3Wrapper_Icon=au3.ico #AutoIt3Wrapper_Outfile=test build 1.exe #AutoIt3Wrapper_Compression=4 #AutoIt3Wrapper_UseUpx=n #AutoIt3Wrapper_Res_Comment=test app #AutoIt3Wrapper_Res_Description=built with a batch file #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 112, 21, 192, 124) $Label1 = GUICtrlCreateLabel("HELLO WORLD", 0, 0, 83, 17) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Only tested on XP, not sure if works on x64 systems.