Jump to content

Recommended Posts

Posted

Hi all,

I want to run my compiled application I made in AutoIt in the command prompt and get feedback in the command prompt itself.

How am I able to do this?

Regards,

lrstndm

 

Posted

Compile your script as CLI and start it from a command prompt.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Posted (edited)

Here is a practical example of what water said: :)
you can pass parameters to your console program by command-line arguments and "get feedback in the command prompt itself" simply by using consolewrite()

This little script will multiply 2 numbers passed to it by command line arguments,

compile this script and then run the produced exe  (multiply.exe) from a command prompt passing 2 numbers as command-line arguments (for example multiply.exe 15 7), you will get the result on the command prompt itself.

#AutoIt3Wrapper_outfile=multiply.exe
#AutoIt3Wrapper_Change2CUI=y

; the $CmdLine array is automatically generated by AutoIt
; and contains command-line parameters passed to the compiled program
;
If $CmdLine[0] = 2 Then ; check presence of 2 arguments

    ConsoleWrite($CmdLine[1] * $CmdLine[2] & @CRLF) ; multiply argument 1 by argument 2
    Exit

EndIf

ConsoleWrite("Parameters error: pass 2 arguments please." & @CRLF)
Exit 0

 

Edited by Chimp
added comments

 

image.jpeg.9f1a974c98e9f77d824b358729b089b0.jpeg Chimp

small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

Posted

There are some old UDFs available to help you to also give you an the user of your CLI application an way to give some input.

 

Im too lazy to search for it, but it is called the console UDF.

Posted (edited)

A list of UDFs (including the mentioned Console UDF) can be found in the wiki: https://www.autoitscript.com/wiki/User_Defined_Functions

Edited by water

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

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
×
×
  • Create New...