Jump to content
Sign in to follow this  
AlmarM

Run()

Recommended Posts

AlmarM

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.

Share this post


Link to post
Share on other sites
AlmarM

Ahw... Comon ... :P 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.

Share this post


Link to post
Share on other sites
weaponx

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 by weaponx

Share this post


Link to post
Share on other sites
AlmarM

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 :P

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 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.

Share this post


Link to post
Share on other sites
wedsxcrfv

I think you just have to do

Run ("Filename.bat", "Directory")

And if you make the .bat also just filename.bat

Edited by wedsxcrfv

I am not English... But that matters nothing, I'm Dutch and i SPEAK English so it doesnt matter :P

Share this post


Link to post
Share on other sites
AlmarM

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.

Share this post


Link to post
Share on other sites
weaponx

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")

Share this post


Link to post
Share on other sites
picaxe

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 by picaxe

Share this post


Link to post
Share on other sites
wedsxcrfv

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 :P

Edited by wedsxcrfv

I am not English... But that matters nothing, I'm Dutch and i SPEAK English so it doesnt matter :P

Share this post


Link to post
Share on other sites
AlmarM

I dont get you...

Ill give my Source... Mayby you can just fix it.

#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.

Share this post


Link to post
Share on other sites
wedsxcrfv

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

Share this post


Link to post
Share on other sites
weaponx

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.

Share this post


Link to post
Share on other sites
AlmarM

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.

Share this post


Link to post
Share on other sites
weaponx

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)

Share this post


Link to post
Share on other sites
AlmarM

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.

Share this post


Link to post
Share on other sites
AlmarM

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.

Share this post


Link to post
Share on other sites
weaponx

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.

Share this post


Link to post
Share on other sites
picaxe

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.

Share this post


Link to post
Share on other sites
AlmarM

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.

Share this post


Link to post
Share on other sites
picaxe

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.

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×