Jump to content
kcvinu

How can i run scripts from my own IDE

Recommended Posts

kcvinu

Hi all,

I am planning to make an IDE for autoit in vb.net. Now i am practicing how to run my scripts from my new IDE. I have successully ran some one or two line scripts. But i can't run scripts using any kind of loops. This is my vb.net code;

Private Sub BTN_Run_Click(sender As Object, e As EventArgs) Handles BTN_Run.Click

        Dim AutoitCmd As String = "C:\Program Files\AutoIt3\Autoit3.exe "
        Dim path As String = Application.StartupPath
        Dim tempName As String = "\Untitled.au3"
        Dim Filename As String = path & tempName

        Dim procID As Integer
        Dim Proc As New Process
        Proc.StartInfo.FileName = AutoitCmd
        Proc.StartInfo.Arguments = """" & Filename & """"
        Proc.StartInfo.CreateNoWindow = True
        Proc.StartInfo.UseShellExecute = False
        Proc.StartInfo.RedirectStandardOutput = True
        Proc.Start()

        procID = Proc.Id
        Dim outrd As StreamReader = Proc.StandardOutput
        Dim out As String = outrd.ReadToEnd

        cc1.WriteOutput("==> " & out, Color.GreenYellow)


        If Proc.HasExited = True Then
            Proc.Close()
        Else
       		Proc.WaitForExit()
            cc1.WriteOutput("==> Running" & Filename, Color.GreenYellow)
        End If
        

    End Sub

 

Edited by kcvinu

My Contributions

UDF Link Viewer   --- A tool to visit the links of some most important UDFs 

 Includer_2  ----- A tool to type the #include statement automatically 

 Digits To Date  ----- date from 3 integer values

PrintList ----- prints arrays into console for testing.

 Alert  ------ An alternative for MsgBox 

 MousePosition ------- A simple tooltip display of mouse position

GRM Helper -------- A littile tool to help writing code with GUIRegisterMsg function

Access_UDF  -------- An UDF for working with access database files. (.*accdb only)

 

Share this post


Link to post
Share on other sites
BrewManNH

Are you trying to execute the script one line at a time? Why not just run the script?


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites
kcvinu

Yes, i am trying to run the whole script


My Contributions

UDF Link Viewer   --- A tool to visit the links of some most important UDFs 

 Includer_2  ----- A tool to type the #include statement automatically 

 Digits To Date  ----- date from 3 integer values

PrintList ----- prints arrays into console for testing.

 Alert  ------ An alternative for MsgBox 

 MousePosition ------- A simple tooltip display of mouse position

GRM Helper -------- A littile tool to help writing code with GUIRegisterMsg function

Access_UDF  -------- An UDF for working with access database files. (.*accdb only)

 

Share this post


Link to post
Share on other sites
TheDcoder

It should be easy enough, I don't know VB.Net so I wrote a AutoIt Script:

Global Const $32BIT_PROGRAMFILES = @CPUArch = 'X64' ? 'C:\Program Files (x86)' : 'C:\Program Files'

Global Const $AUTOIT = $32BIT_PROGRAMFILES & '\AutoIt3\AutoIt3.exe' ; You can change this to the 64 bit interpreter's path if you want

Global Const $SCRIPT = "" ; Location of the .au3 file you want to run

Global $iExitCode = RunWait($AUTOIT & ' "' & $SCRIPT & '"')

MsgBox(0, "AutoIt Script's Exit Code", "The AutoIt Script exited with exit code " & $iExitCode)

You can translate it into VB.Net and try it. (Make sure you try it out first though)

  • Like 1

AutoIt.4.Life Clubrooms - Life is like a Donut (secret key)

Spoiler

My contributions to the AutoIt Community

Some messages & Apologizes:

If I hurt you, Please accept my apologies, I never (regardless of the situation) mean to hurt anybody!!!

Also, I am very busy with my project so I will appear in the last row of the online list, if you want to contact me: Email@TheDcoder.xyz

Or you can have a nice chat with me in freenode, I use the same nick on freenode too!

3fHNZJ.gif

PLEASE JOIN ##AutoIt AND HELP THE IRC AUTOIT COMMUNITY!

Share this post


Link to post
Share on other sites
kcvinu

Um, I need to find the equalent function of RunWait() in vb.net. Thanks @TheDcoder


My Contributions

UDF Link Viewer   --- A tool to visit the links of some most important UDFs 

 Includer_2  ----- A tool to type the #include statement automatically 

 Digits To Date  ----- date from 3 integer values

PrintList ----- prints arrays into console for testing.

 Alert  ------ An alternative for MsgBox 

 MousePosition ------- A simple tooltip display of mouse position

GRM Helper -------- A littile tool to help writing code with GUIRegisterMsg function

Access_UDF  -------- An UDF for working with access database files. (.*accdb only)

 

Share this post


Link to post
Share on other sites
JLogan3o13

IIRC the only thing you can really do is a .WaitForExit() on the process.

  • Like 1

√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites
TheDcoder

@kcvinu I think I found an alternative:

Use the Process class's WaitForExit method and read the ExitCode property of the object. The reference page I used is: https://msdn.microsoft.com/en-us/library/system.diagnostics.process(v=vs.110).aspx

 

P.S @JLogan3o13 was faster than me  :P


AutoIt.4.Life Clubrooms - Life is like a Donut (secret key)

Spoiler

My contributions to the AutoIt Community

Some messages & Apologizes:

If I hurt you, Please accept my apologies, I never (regardless of the situation) mean to hurt anybody!!!

Also, I am very busy with my project so I will appear in the last row of the online list, if you want to contact me: Email@TheDcoder.xyz

Or you can have a nice chat with me in freenode, I use the same nick on freenode too!

3fHNZJ.gif

PLEASE JOIN ##AutoIt AND HELP THE IRC AUTOIT COMMUNITY!

Share this post


Link to post
Share on other sites
kcvinu

THanks @TheDcoder, Actually, i was used it in my code. (see my first post).  But i am not sure it is the correct usage


My Contributions

UDF Link Viewer   --- A tool to visit the links of some most important UDFs 

 Includer_2  ----- A tool to type the #include statement automatically 

 Digits To Date  ----- date from 3 integer values

PrintList ----- prints arrays into console for testing.

 Alert  ------ An alternative for MsgBox 

 MousePosition ------- A simple tooltip display of mouse position

GRM Helper -------- A littile tool to help writing code with GUIRegisterMsg function

Access_UDF  -------- An UDF for working with access database files. (.*accdb only)

 

Share this post


Link to post
Share on other sites
TheDcoder

Oh, yeah, true. I did not look at the script because is was VB.Net :-/

  • Like 1

AutoIt.4.Life Clubrooms - Life is like a Donut (secret key)

Spoiler

My contributions to the AutoIt Community

Some messages & Apologizes:

If I hurt you, Please accept my apologies, I never (regardless of the situation) mean to hurt anybody!!!

Also, I am very busy with my project so I will appear in the last row of the online list, if you want to contact me: Email@TheDcoder.xyz

Or you can have a nice chat with me in freenode, I use the same nick on freenode too!

3fHNZJ.gif

PLEASE JOIN ##AutoIt AND HELP THE IRC AUTOIT COMMUNITY!

Share this post


Link to post
Share on other sites
kcvinu

Thanks @JLogan3o13 


My Contributions

UDF Link Viewer   --- A tool to visit the links of some most important UDFs 

 Includer_2  ----- A tool to type the #include statement automatically 

 Digits To Date  ----- date from 3 integer values

PrintList ----- prints arrays into console for testing.

 Alert  ------ An alternative for MsgBox 

 MousePosition ------- A simple tooltip display of mouse position

GRM Helper -------- A littile tool to help writing code with GUIRegisterMsg function

Access_UDF  -------- An UDF for working with access database files. (.*accdb only)

 

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

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.