ndw Posted October 25, 2011 Posted October 25, 2011 (edited) Hello. I found created a long time ago of exactly the thing i'm trying to do, but its resolution isn't working for me. I would like to write some text back to the commandline that executed my compilied AutoIT script. Nothing complicated and i did a search and found ConsoleWrite. My code currently looks like this but, nothing is written back in to the cmd window. Case $CmdLine[$i] = "-spath" If $i == $CmdLine[0] Then ConsoleWrite("-spath requires a path to be specified" & @CRLF) Msgbox(0,"Test", "-spath requires a path to be specified") Exit Endif So when -spath is not supplied with a path to a file, it writes back to the cmdline "there was no path". The msgbox is just there to show me it's got to the right part of the code. Edited October 25, 2011 by ndw
spudw2k Posted October 25, 2011 Posted October 25, 2011 (edited) If you want to use ConsoleWrite to output to a CMD console window you must change the GUI to a CUI. You can use a wrapper flag but the specific syntax and command are eluding me right now. Something to the effect of AutoItWrapperChangetoCUI=Y (must be compiled)Alternatively check this out. Edited October 25, 2011 by spudw2k Spoiler Things I've Made: Always On Top Tool ◊ AU History ◊ Deck of Cards ◊ HideIt ◊ ICU ◊ Icon Freezer ◊ Ipod Ejector ◊ Junos Configuration Explorer ◊ Link Downloader ◊ MD5 Folder Enumerator ◊ PassGen ◊ Ping Tool ◊ Quick NIC ◊ Read OCR ◊ RemoteIT ◊ SchTasksGui ◊ SpyCam ◊ System Scan Report Tool ◊ System UpTime ◊ Transparency Machine ◊ VMWare ESX Builder Misc Code Snippets: ADODB Example ◊ CheckHover ◊ Detect SafeMode ◊ DynEnumArray ◊ GetNetStatData ◊ HashArray ◊ IsBetweenDates ◊ Local Admins ◊ Make Choice ◊ Recursive File List ◊ Remove Sizebox Style ◊ Retrieve PNPDeviceID ◊ Retrieve SysListView32 Contents ◊ Set IE Homepage ◊ Tickle Expired Password ◊ Transpose Array Projects: Drive Space Usage GUI ◊ LEDkIT ◊ Plasma_kIt ◊ Scan Engine Builder ◊ SpeeDBurner ◊ SubnetCalc Cool Stuff: AutoItObject UDF ◊ Extract Icon From Proc ◊ GuiCtrlFontRotate ◊ Hex Edit Funcs ◊ Run binary ◊ Service_UDF
ndw Posted October 25, 2011 Author Posted October 25, 2011 After replacing the batteries in this keyboard, i really want another go at typing that horrible title again... Thank you for your reply, i'll look in to this now.
ndw Posted November 2, 2011 Author Posted November 2, 2011 Sorry to be a pain but i don't understand what i need to do with this. With StdInWrite, i'm confused about the "child process" bit. Sorry for sounding like a noob but, is that asking for the process id of the command window that launched the program? From what i can see, it looks to be used for if i run something within my script, but i'm running an .exe version of my AutoIT script, not a command window from within it. What i'm doing is running my AutoIT script from the command line which i would like to pass some switches in eg AutoITScript.exe -spath "C:\blah\blah" -v -p 46 And to that command window, i want to output if a switch has incorrect data like -v wasn't specificed. Ugh, i'm confusing myself with this, i can explain it again if it's unclear.
hannes08 Posted November 2, 2011 Posted November 2, 2011 Hi ndw, like spudw2k already stated you need to add the following line at the top of your script: #AutoIt3Wrapper_Change2CUI=y But you'll need to compile it from Scite script editor. Please make sure you've installed the latest version. Running the script from Scite: the ConsoleWrites are displayed in the output pane. Running the script from CMD: The ConsoleWrites are displayed in the command window. Running the script by double-click: The ConsoleWrites are displayed in a temp. command window, that will disappear after program termination. Regards,Hannes[spoiler]If you can't convince them, confuse them![/spoiler]
ndw Posted November 2, 2011 Author Posted November 2, 2011 Thats great. Got it in there, compiled and works nicely now. Thank you to you both
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