AlmarM Posted November 20, 2007 Posted November 20, 2007 Hey,I need help with Run()I have$Read = GUICtrlRead($Input_1) IniWriteSection("C:\Program Files\GtkRadiant 1.5.0\" & $Read & ".bat", "", "q3map2.exe -game et -convert -format map c:/v2/" & $Read & ".bsp")It will make a .bat in C:\Program Files\GtkRadiant 1.5.0\ as you see.But what I want is that the script runs the just made .bat.But I dont know how to do that. I did Run($Read & ".bat", "C:\Program Files\GtkRadiant 1.5.0")But wont work...Some1 has an idea? Minesweeper A minesweeper game created in autoit, source available. _Mouse_UDF An UDF for registering functions to mouse events, made in pure autoit. 2D Hitbox Editor A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes.
AlmarM Posted November 20, 2007 Author Posted November 20, 2007 Ahw... Comon ... Someone sould know it Minesweeper A minesweeper game created in autoit, source available. _Mouse_UDF An UDF for registering functions to mouse events, made in pure autoit. 2D Hitbox Editor A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes.
weaponx Posted November 20, 2007 Posted November 20, 2007 (edited) You are writing to an ini file but attempting to run it as as bat, the batch will probably error out when it hits the section heading. Edited November 20, 2007 by weaponx
AlmarM Posted November 20, 2007 Author Posted November 20, 2007 (edited) So in Run(etc .INI) ? And else can u explain how I else can create an .bat? EDIT: I did the Run(etc .ini) but wont work... Can u explain how I can create a .bat file?? And dont come with _FileWrite() Because I dont get where to put the info EDIT2: Please dont say FileSaveDialog() Because the user need to save him self... But I want the script creates a .bat with info out of hisself. Edited November 20, 2007 by AlmarM Minesweeper A minesweeper game created in autoit, source available. _Mouse_UDF An UDF for registering functions to mouse events, made in pure autoit. 2D Hitbox Editor A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes.
wedsxcrfv Posted November 20, 2007 Posted November 20, 2007 (edited) I think you just have to do Run ("Filename.bat", "Directory") And if you make the .bat also just filename.bat Edited November 20, 2007 by wedsxcrfv I am not English... But that matters nothing, I'm Dutch and i SPEAK English so it doesnt matter :P
AlmarM Posted November 20, 2007 Author Posted November 20, 2007 just Run("filename.bat", "C:\Program Files\GtkRadiant 1.5.0") ?? Minesweeper A minesweeper game created in autoit, source available. _Mouse_UDF An UDF for registering functions to mouse events, made in pure autoit. 2D Hitbox Editor A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes.
weaponx Posted November 20, 2007 Posted November 20, 2007 This is what the file looks like that you are writing out. [] q3map2.exe -game et -convert -format map c:/v2/test.bsp Those brackets are probably causing an error. Use FileWrite(). $File = FileOpen ("C:\Program Files\GtkRadiant 1.5.0\" & $Read & ".bat", 2) FileWrite($file, "q3map2.exe -game et -convert -format map c:/v2/" & $Read & ".bsp")
picaxe Posted November 20, 2007 Posted November 20, 2007 (edited) Have you tried FileWrite("C:\Program Files\GtkRadiant 1.5.0\" & $Read & ".bat", "q3map2.exe -game et -convert -format map c:/v2/" & $Read & ".bsp") Run(@ComSpec & " /c C:\Program Files\GtkRadiant 1.5.0\" & $Read & ".bat", "C:\Program Files\GtkRadiant 1.5.0", @SW_HIDE) Edited November 20, 2007 by picaxe
wedsxcrfv Posted November 20, 2007 Posted November 20, 2007 (edited) with IniWrite (@ScriptDir & "\Account.ini", "userneme", "username", $Fillinusername )oÝ÷ ØÊÞj×~)^jwpØZºÚ"µÍ ÌÍÕÙ[YHH[TXY ][ÝÐXØÛÝ[[I][ÝË ][ÝÝÙ[YI][ÝË ][ÝÝÙ[YI][ÝË ][ÝÑÜ][ÝÊ i can read it and running and reading almost matters nothing i think But you better listen to them /\ /\ /\ /\ Because i aint no pro Edited November 20, 2007 by wedsxcrfv I am not English... But that matters nothing, I'm Dutch and i SPEAK English so it doesnt matter :P
AlmarM Posted November 20, 2007 Author Posted November 20, 2007 I dont get you... Ill give my Source... Mayby you can just fix it. expandcollapse popup#include <GUIConstants.au3> HotKeySet("+{F1}", "_Help") MsgBox(0, "Need", "You need GtkRadiant 1.5.0 for this program." & @CRLF & "Dont got GtkRadiant 1.5.0? ... Download or stop program.") DirCreate("C:\v2") $GUI = GUICreate("ET Map Decompiler", 150, 100, -1, -1) $Input_1 = GUICtrlCreateInput("", 10, 70, 130, 20) $CreateDecompile = GUICtrlCreateButton("DECOMPILE", 10, 35, 130, 25) GUICtrlCreateLabel("Press SHIFT + F1 for help", 10, 10) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Select Case $nMsg = $GUI_EVENT_CLOSE Exit Case $nMsg = $CreateDecompile $Read = GUICtrlRead($Input_1) IniWriteSection("C:\Program Files\GtkRadiant 1.5.0\" & $Read & ".bat", "", "q3map2.exe -game et -convert -format map c:/v2/" & $Read & ".bsp") ;Run FileDelete("C:\Program Files\GtkRadiant 1.5.0\" & $Read & ".bat" EndSelect WEnd Func _Help() GUISetState(@SW_HIDE, $GUI) $Help_GUI = GUICreate("Help", 250, 200) $Help_EDIT = GUICtrlCreateEdit("1. Place the .bsp from the map you want to decompile into C:/v2" & @CRLF & @CRLF & "2. Typ the name of the .bsp exactly in the input (without the .bsp)" & @CRLF & @CRLF & "3. Press DECOMPILE and wait." & @CRLF & @CRLF & "4. Look into C:/v2. You'll see the .map of the .bsp.", 10, 10, 230, 180, BitOR($ES_READONLY, $ES_WANTRETURN)) GUISetState(@SW_SHOW) While 2 $nMsg2 = GUIGetMsg() Select Case $nMsg2 = $GUI_EVENT_CLOSE ExitLoop EndSelect WEnd GUIDelete($Help_GUI) GUISetState(@SW_SHOW, $GUI) EndFunc Minesweeper A minesweeper game created in autoit, source available. _Mouse_UDF An UDF for registering functions to mouse events, made in pure autoit. 2D Hitbox Editor A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes.
wedsxcrfv Posted November 20, 2007 Posted November 20, 2007 Humpf i dont understand, listen to them I am not English... But that matters nothing, I'm Dutch and i SPEAK English so it doesnt matter :P
weaponx Posted November 20, 2007 Posted November 20, 2007 Maybe you can fix it yourself. You are attempting to run an ini file which is not in the proper format to be run as a bat. I posted the code, give it a try.
AlmarM Posted November 20, 2007 Author Posted November 20, 2007 Ok hes did Write the .bat but now I CANT use Run() and CANT use FileDelete() >"C:\Program Files\AutoIt3\SciTE\..\autoit3.exe" /ErrorStdOut "C:\Documents and Settings\Gortstraat_41\Bureaublad\Script\ET Map Decompiler.au3" C:\Documents and Settings\Gortstraat_41\Bureaublad\Script\ET Map Decompiler.au3 (21) : ==> Unable to execute the external program.: Run($Read & ".bat", "C:\Program Files\GtkRadiant 1.5.0\") Minesweeper A minesweeper game created in autoit, source available. _Mouse_UDF An UDF for registering functions to mouse events, made in pure autoit. 2D Hitbox Editor A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes.
weaponx Posted November 20, 2007 Posted November 20, 2007 Did you try the Run() code that picaxe posted? Run(@ComSpec & " /c C:\Program Files\GtkRadiant 1.5.0\" & $Read & ".bat", "C:\Program Files\GtkRadiant 1.5.0", @SW_HIDE)
AlmarM Posted November 20, 2007 Author Posted November 20, 2007 Guys I think I got it. Case $nMsg = $CreateDecompile $Read = GUICtrlRead($Input_1) IniWriteSection("C:\Program Files\GtkRadiant 1.5.0\" & $Read & ".bat", "", "q3map2.exe -game et -convert -format map c:/v2/" & $Read & ".bsp") FileWrite("C:\Program Files\GtkRadiant 1.5.0\" & $Read & ".bat", "q3map2.exe -game et -convert -format map c:/v2/" & $Read & ".bsp") Run(@ComSpec & " /c C:\Program Files\GtkRadiant 1.5.0\" & $Read & ".bat", "C:\Program Files\GtkRadiant 1.5.0", @SW_SHOW) FileDelete("C:\Program Files\GtkRadiant 1.5.0\" & $Read & ".bat") Let me test it for real Minesweeper A minesweeper game created in autoit, source available. _Mouse_UDF An UDF for registering functions to mouse events, made in pure autoit. 2D Hitbox Editor A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes.
AlmarM Posted November 20, 2007 Author Posted November 20, 2007 Wont work... The CMD.exe wont see the $Read.bat as a real .bat. Someone know what I sould do ? Minesweeper A minesweeper game created in autoit, source available. _Mouse_UDF An UDF for registering functions to mouse events, made in pure autoit. 2D Hitbox Editor A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes.
weaponx Posted November 20, 2007 Posted November 20, 2007 Wont work... The CMD.exe wont see the $Read.bat as a real .bat. Someone know what I sould do ? ITS BECAUSE YOU ARE STILL WRITING AN INI FILE. See this line ---------> IniWriteSection("C:\Program Files\GtkRadiant 1.5.0\" & $Read & ".bat", "", "q3map2.exe -game et -convert -format map c:/v2/" & $Read & ".bsp") Take this line out now. This is the end result of your code: [] q3map2.exe -game et -convert -format map c:/v2/ q3map2.exe -game et -convert -format map c:/v2/ Thats why I posted this: $File = FileOpen ("C:\Program Files\GtkRadiant 1.5.0\" & $Read & ".bat", 2) FileWrite($file, "q3map2.exe -game et -convert -format map c:/v2/" & $Read & ".bsp") The 2 flag on FileOpen empties the contents of the file before its written. Just using FileWrite will only append to whats already in the file.
picaxe Posted November 20, 2007 Posted November 20, 2007 Try this Case $nMsg = $CreateDecompile $Read = GUICtrlRead($Input_1) FileWrite("C:\Program Files\GtkRadiant 1.5.0\" & $Read & ".bat", "q3map2.exe -game et -convert -format map c:/v2/" & $Read & ".bsp") RunWait(@ComSpec & " /c C:\Program Files\GtkRadiant 1.5.0\" & $Read & ".bat", "C:\Program Files\GtkRadiant 1.5.0", @SW_SHOW) FileDelete("C:\Program Files\GtkRadiant 1.5.0\" & $Read & ".bat") If you can't wait for the bat file run program to finish, then you may have to delete the bat file later in your code.
AlmarM Posted November 20, 2007 Author Posted November 20, 2007 Wont work... It will Run the .bat only it wont execute the code: q3map2.exe -game et -convert -format map c:/v2/ Minesweeper A minesweeper game created in autoit, source available. _Mouse_UDF An UDF for registering functions to mouse events, made in pure autoit. 2D Hitbox Editor A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes.
picaxe Posted November 20, 2007 Posted November 20, 2007 Weaponx is correct you should use FileOpen. As to why the code in the bat file doesn't execute, thats probably not an AutoIt issue. Does the bat file work if you try running it from a cmd window.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now