Geo0w Posted August 21, 2009 Posted August 21, 2009 (edited) Well,I discovered the AutoIt langage two days ago thanks to a friend, and the first thing that I wanted to do is a sample script that displays "Hello World" in a command line interface (cmd.exe). But it wasn't working, even if I compiled the script...I found a solution - maybe you've found it and I don't look for 'cause I'm lost in this forum... - to make the script working.First, you have a sample code :#cs ---------------------------------------------------------------------------- AutoIt Version: 3.3.0.0 Author: myName Script Function: Template AutoIt script. #ce ---------------------------------------------------------------------------- ; Script Start - Add your code below here ConsoleWrite("Foobar!")You save a file named "hello.au3" ; then a right click & "Compile File" to Compile it...Now, when you try to launch the program in the cli, it fails... Why ?Simply because there's a flag in the header of the program which means that the program is a "GUI". You simply have to edit this flag in order to mean that it's a console program.Take an hexadecimal editor, and you see the "02" value at the offset 0x154. Set "03" and your script will perfectly work!In fact, 02 and 03 are represented by a constant in many langages like C ; 02 means GUI & 03 means CUI.For a next release, why don't implementing a feature that generate an exe file with the appropriate constant ?That's all.PS : I'm French, I wish I could explain it better if it's not very clean. Edited August 21, 2009 by Geo0w
Mobius Posted August 22, 2009 Posted August 22, 2009 (edited) That's such a fantastic feature that it has been present since AutoIt 3.2.12.1Take a look at the Aut2Exe gui or commandline switches, to build to a cui capable program.What version are you using? Edited August 22, 2009 by Mobius
CodyBarrett Posted August 22, 2009 Posted August 22, 2009 (edited) its fairly clean lol... you should read some of the other posts (including some of mine) on these forums... WAY worse, but uh... isnt there an option on scite --> tools --> compile --> and then the checkbox (Create CUI instead of GUI exe) EDIT mobius beat me to it XD Edited August 22, 2009 by CodyBarrett [size="1"][font="Tahoma"][COMPLETED]-----[FAILED]-----[ONGOING]VolumeControl|Binary Converter|CPU Usage| Mouse Wrap |WinHide|Word Scrammbler|LOCKER|SCREEN FREEZE|Decisions Decisions|Version UDF|Recast Desktop Mask|TCP Multiclient EXAMPLE|BTCP|LANCR|UDP serverless|AIOCR|OECR|Recast Messenger|AU3C|Tik-Tak-Toe|Snakes & Ladders|BattleShips|TRON|SNAKE_____________________[u]I love the Helpfile it is my best friend.[/u][/font][/size]
Geo0w Posted August 22, 2009 Author Posted August 22, 2009 (edited) I didn't know. I apologize. >_< I use the latest version. Edited August 22, 2009 by Geo0w
Mobius Posted August 22, 2009 Posted August 22, 2009 (edited) what you posted was pretty sound. Just remember that the subsystem byte offset is relative to the 'PE' word(17744) hex(5045) within the Executable header, and is not static throughout all win32 binaries / versions of AutoIt3. Check it out for yourself, take 2 totally different programs (notepad and an Au3 binary for example) and pop em into your hex editor, note down the offsets of the 'PE' word in each of the headers. Are they the same? Still in your hex editor, read 91 bytes from the end of the 'PE' word for both programs, it is here you will find the subsystem byte flag, which should be a value between 1 & 14 . Or like you pointed out, the most likely values are 2(win) & 3(con). Ed: fuzzy Edited August 22, 2009 by Mobius
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