Jump to content

AutoIt and the command prompt usability?


Recommended Posts

I've been wanting to make a text-based rpg like game from the command prompt, but have failed at finding a language I'm fairly familiar with to do so. Is it at all possible to use AutoIt for such a thing? Meaning having the command prompt as the GUI and still be able to have all of the programming accessories available (Variables, functions, la-de-da). If so, how do I approach this so the script is connected to a command prompt and when opened opens the said prompt?

Thank you.

Link to comment
Share on other sites

Yes this is possible.

You can use ConsoleRead() and ConsoleWrite()

in conjuction with new compile option for make console output application instead of GUI one.

I don't remember exact name of this option so look into documentation of latest Scite4AutoIt3.

EDIT: It's

#AutoIt3Wrapper_Change2CUI=y

(Y/N) Change output program to CUI in stead of GUI. Default=N

Edited by Zedna
Link to comment
Share on other sites

Whilst looking in the help file at ConsoleWrite, it says the following:

The purpose for this function is to write to a console which many popular text editors can read.

This does not write to a DOS console.

I'm not quite sure I understand now. How do I send information to the console if "the console" isn't the DOS console. I'm a bit lost.

Also, do I simply include the #Wrapper statement at the beginning of my script? I've never used them before.

Link to comment
Share on other sites

Try this (compile this script by F7 from Scite4AutoIt3 and run compiled EXE from DOS box command prompt):

#AutoIt3Wrapper_Change2CUI=y

#include <string.au3>

For $i = 1 to 79
    $part1 = _StringRepeat(Chr(219), $i)
    $part2 = _StringRepeat(Chr(177), 79 - $i)
    ConsoleWrite(@CR & $part1 & $part2)
    Sleep(50)
Next

; uncomment this if you want to preserve finished progressbar
;~ ConsoleWrite(@CRLF & "DONE!")

; comment this if you want to preserve finished progressbar
ConsoleWrite(@CR & _StringRepeat(' ', 79))
ConsoleWrite(@CR & "DONE!")
Link to comment
Share on other sites

I'm running AutoIt version 3.2.12.0 and Scite4AutoIt version 1.76.

How do you want me to run it from the command prompt? I've been dragging and dropping the file on it and pressing enter, but that dosen't do the trick..

Edit

I downloaded the full editor and it works now. I presume the problem was caused by using the lite version that comes with AutoIt.

One question: How do I ensure the command prompt dosen't close at the end? Use a loop?

Edited by Yata
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...