kcvinu Posted June 5, 2016 Share Posted June 5, 2016 (edited) 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 June 6, 2016 by kcvinu Spoiler My Contributions Glance GUI Library - A gui library based on Windows api functions. Written in Nim programming language. 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) Link to comment Share on other sites More sharing options...
BrewManNH Posted June 5, 2016 Share Posted June 5, 2016 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 GudeHow 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 Link to comment Share on other sites More sharing options...
kcvinu Posted June 5, 2016 Author Share Posted June 5, 2016 Yes, i am trying to run the whole script Spoiler My Contributions Glance GUI Library - A gui library based on Windows api functions. Written in Nim programming language. 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) Link to comment Share on other sites More sharing options...
TheDcoder Posted June 6, 2016 Share Posted June 6, 2016 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) kcvinu 1 EasyCodeIt - A cross-platform AutoIt implementation - Fund the development! (GitHub will double your donations for a limited time) DcodingTheWeb Forum - Follow for updates and Join for discussion Link to comment Share on other sites More sharing options...
kcvinu Posted June 6, 2016 Author Share Posted June 6, 2016 Um, I need to find the equalent function of RunWait() in vb.net. Thanks @TheDcoder Spoiler My Contributions Glance GUI Library - A gui library based on Windows api functions. Written in Nim programming language. 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) Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted June 6, 2016 Moderators Share Posted June 6, 2016 IIRC the only thing you can really do is a .WaitForExit() on the process. kcvinu 1 "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
TheDcoder Posted June 6, 2016 Share Posted June 6, 2016 @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 EasyCodeIt - A cross-platform AutoIt implementation - Fund the development! (GitHub will double your donations for a limited time) DcodingTheWeb Forum - Follow for updates and Join for discussion Link to comment Share on other sites More sharing options...
kcvinu Posted June 6, 2016 Author Share Posted June 6, 2016 THanks @TheDcoder, Actually, i was used it in my code. (see my first post). But i am not sure it is the correct usage Spoiler My Contributions Glance GUI Library - A gui library based on Windows api functions. Written in Nim programming language. 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) Link to comment Share on other sites More sharing options...
TheDcoder Posted June 6, 2016 Share Posted June 6, 2016 Oh, yeah, true. I did not look at the script because is was VB.Net :-/ kcvinu 1 EasyCodeIt - A cross-platform AutoIt implementation - Fund the development! (GitHub will double your donations for a limited time) DcodingTheWeb Forum - Follow for updates and Join for discussion Link to comment Share on other sites More sharing options...
kcvinu Posted June 6, 2016 Author Share Posted June 6, 2016 Thanks @JLogan3o13 Spoiler My Contributions Glance GUI Library - A gui library based on Windows api functions. Written in Nim programming language. 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) Link to comment Share on other sites More sharing options...
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