nitro322 Posted December 18, 2005 Share Posted December 18, 2005 I have a rather odd problem that I'm hoping someone can help me out with. How I can tell from within AutoIt whether a given .exe file is a console or GUI application? I searched the forum and found several dicussions on the technical differences between the two, but I haven't found anything to help me actually do it in AutoIt. Any suggestions? Thanks. http://www.legroom.net/ Link to comment Share on other sites More sharing options...
erebus Posted December 18, 2005 Share Posted December 18, 2005 The only simple way to do this is by using WinExists(). I am not aware of any other way (a macro or something) that gives you such an ability. Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted December 18, 2005 Moderators Share Posted December 18, 2005 The only simple way to do this is by using WinExists(). I am not aware of any other way (a macro or something) that gives you such an ability. WinExists() would work, but what happens if the window is hidden?... If you know the 'Class' names of the programs GUI(s), you could always find them scribing for a control handle. While 1 $FindGui = ControlGetHandle('classname=AutoIt v3 GUI', "", "") If $FindGui <> "" Then MsgBox(48, "Found", "There is an AuotIt GUI running") Sleep(100) WEnd ***Note... Most programs always have the same Class... the Afx: class(s) change the last 6 characters, but if you know the first so many... you can find them... but you could run into errors with them. Generally with the above method... no window is truly 'hidden'. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
w0uter Posted December 18, 2005 Share Posted December 18, 2005 open it in hex and check the byte wich tells if it is a GUI or Console app. My UDF's:;mem stuff_Mem;ftp stuff_FTP ( OLD );inet stuff_INetGetSource ( OLD )_INetGetImage _INetBrowse ( Collection )_EncodeUrl_NetStat_Google;random stuff_iPixelSearch_DiceRoll Link to comment Share on other sites More sharing options...
nitro322 Posted December 18, 2005 Author Share Posted December 18, 2005 erebus and SmOke, thanks for the suggestions, but I actually need to determine this before I run the program.w0uter, can offer any tips on how to do that? I've actually tried this approach, but failed pretty miserably. Specifically, I tried using the Binary Read/Write UDFs provided by Larry in another thread, but couldn't figure out how exactly to use it. The example that was provided didn't work. http://www.legroom.net/ Link to comment Share on other sites More sharing options...
erebus Posted December 18, 2005 Share Posted December 18, 2005 And I imagine that you also want to know if a random (and not standard) exe is a GUI or console application before running it, right?No, this is beyond my knowledge. Link to comment Share on other sites More sharing options...
nitro322 Posted December 18, 2005 Author Share Posted December 18, 2005 (edited) And I imagine that you also want to know if a random (and not standard) exe is a GUI or console application before running it, right?I'm not sure what you mean by a random .exe, but yes, I need to know if a given .exe that is passed to my AutoIt program is a GUI or console application. The reason for this is that I need to treat it differently depending on what kind of program it is. Currently, I have a checkbox in the GUI to allow the user to select whether or not it's a console app. It works, but it's kind of clunky. Auto-detecting this would help make this more user-friendly. Edited December 18, 2005 by nitro322 http://www.legroom.net/ Link to comment Share on other sites More sharing options...
erebus Posted December 19, 2005 Share Posted December 19, 2005 Yes I agree with you and I understand the reason you want to do it. Of course everybody that wants to do something abnormal (as far as the capabilities of AU3 is concerned) doesn't mean that it is not necessary or useful. However I cannot see how you can determinate this except of the idea that w0uter dropped on the table. 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