onlineth Posted January 14, 2014 Author Share Posted January 14, 2014 in every _GUI function in AutoIt you will see something like this While 1 $GUIMsg = GUIGetMsg() Switch $GUIMsg Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd that is needed to be able to close the window when clicking on the red X in the corner. Also, I don't know about others, but I think you should post your code in this forum, not on another where things need to be downloaded, etc. Sorry, here is my code, run("notepad.exe") WinWaitActive("Untitled - Notepad") Send("This is some text." & @CRLF & "This is on a new line!") WinClose("Untitled - Notepad") WinWaitActive("Notepad") Send("!n")Again this script works great until I compile it to an exe and then it starts to have problems scientia potentia est Link to comment Share on other sites More sharing options...
BrewManNH Posted January 14, 2014 Share Posted January 14, 2014 in every _GUI function in AutoIt you will see something like this While 1 $GUIMsg = GUIGetMsg() Switch $GUIMsg Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd that is needed to be able to close the window when clicking on the red X in the corner. Also, I don't know about others, but I think you should post your code in this forum, not on another where things need to be downloaded, etc. That's only true if you're not using the AutoIt option OnEventMode set to 1, so it's not EVERY GUI function, just most of them. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
TechCoder Posted January 14, 2014 Share Posted January 14, 2014 (edited) Sorry, here is my code, run("notepad.exe") WinWaitActive("Untitled - Notepad") Send("This is some text." & @CRLF & "This is on a new line!") WinClose("Untitled - Notepad") WinWaitActive("Notepad") Send("!n") Again this script works great until I compile it to an exe and then it starts to have problems EDIT: (I tried the code - it works like JLogan3o13 says. - even complied) Edited January 14, 2014 by TechCoder onlineth 1 Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted January 14, 2014 Moderators Share Posted January 14, 2014 onlinethlive, what version of AutoIt are you using? I confirmed the code, as you have it written, will create duplicates of itself under 3.3.8.1. It does not exhibit this behavior under the latest version, however. "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
TechCoder Posted January 14, 2014 Share Posted January 14, 2014 That's only true if you're not using the AutoIt option OnEventMode set to 1, so it's not EVERY GUI function, just most of them. thanks for the correction on that. I'm pretty new to AutoIt and only used the 'most' option so far, though I read about the OnEventMode and will, one day, mess around with it to see how it works (my latest project is rather large - porting over a package of tools from .php to run on a local machine with GUI, etc...) and OnEventMode looks like it may be a good choice for my programming style, though trying to learn the basics right now. onlineth 1 Link to comment Share on other sites More sharing options...
onlineth Posted January 14, 2014 Author Share Posted January 14, 2014 onlinethlive, what version of AutoIt are you using? I confirmed the code, as you have it written, will create duplicates of itself under 3.3.8.1. It does not exhibit this behavior under the latest version, however. I am using the newest version, does anyone get the problem that I get, it could be my computer, does anyone have any suggestioins? scientia potentia est Link to comment Share on other sites More sharing options...
michaelslamet Posted January 14, 2014 Share Posted January 14, 2014 I am using the newest version, does anyone get the problem that I get, it could be my computer, does anyone have any suggestioins? Are you save the compiled script as "notepad.exe" ? Try to save it as another name onlineth 1 Link to comment Share on other sites More sharing options...
onlineth Posted January 14, 2014 Author Share Posted January 14, 2014 Are you save the compiled script as "notepad.exe" ? Try to save it as another name It worked, you have solved my problem, thank you so much! scientia potentia est Link to comment Share on other sites More sharing options...
michaelslamet Posted January 14, 2014 Share Posted January 14, 2014 It worked, you have solved my problem, thank you so much! You're welcome onlineth 1 Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted January 15, 2014 Moderators Share Posted January 15, 2014 LMAO Totally missed it, great catch michaelslamet. onlineth 1 "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
onlineth Posted January 16, 2014 Author Share Posted January 16, 2014 ok, I have another question, I want to send a script to cmd to execute but I don't want to see the cmd window This is the script I want to send to cmd- Taskkill /IM explorer.exe /F This is the autoit stuff i made- run("cmd.exe") WinWaitActive("{ENTER}") Send("Taskkill /IM explorer.exe /F") Send("{ENTER}") Thanks for your help, onlinethlive scientia potentia est Link to comment Share on other sites More sharing options...
TechCoder Posted January 16, 2014 Share Posted January 16, 2014 I believe this is better suited to what you want to do...... https://www.autoitscript.com/autoit3/docs/functions/ProcessClose.htm onlineth 1 Link to comment Share on other sites More sharing options...
michaelslamet Posted January 16, 2014 Share Posted January 16, 2014 ok, I have another question, I want to send a script to cmd to execute but I don't want to see the cmd window This is the script I want to send to cmd- Taskkill /IM explorer.exe /F This is the autoit stuff i made- run("cmd.exe") WinWaitActive("{ENTER}") Send("Taskkill /IM explorer.exe /F") Send("{ENTER}") Thanks for your help, onlinethlive Try this: Run("Taskkill /IM explorer.exe /F", @ScriptDir, @SW_HIDE) onlineth 1 Link to comment Share on other sites More sharing options...
michaelslamet Posted January 16, 2014 Share Posted January 16, 2014 LMAO Totally missed it, great catch michaelslamet. I know this because I've seen many time Melba's replying this kind of topic (infinite loop that caused by the compiled script name) onlineth 1 Link to comment Share on other sites More sharing options...
onlineth Posted January 16, 2014 Author Share Posted January 16, 2014 I believe this is better suited to what you want to do...... https://www.autoitscript.com/autoit3/docs/functions/ProcessClose.htm ok, I see that this works for other windows or processes but for windows explorer it keeps restarting, is there a way around this? scientia potentia est Link to comment Share on other sites More sharing options...
onlineth Posted January 16, 2014 Author Share Posted January 16, 2014 Try this: Run("Taskkill /IM explorer.exe /F", @ScriptDir, @SW_HIDE) Thank you again, you have solved this problem too:) scientia potentia est Link to comment Share on other sites More sharing options...
onlineth Posted January 17, 2014 Author Share Posted January 17, 2014 I'm trying to learn more about CMD. Where is a good beginners guide for CMD? scientia potentia est Link to comment Share on other sites More sharing options...
TechCoder Posted January 17, 2014 Share Posted January 17, 2014 I used to have a bookmark for dos command prompt commands, though can't seem to find it - haven't used it in a long ( L O N G ) time...... but a quick search on Google came up with dozens of 'how to' links. first one I looked at seems about as 'standard' as any (you really should try those searches - loads of great data and by reading several sites, you will always get your own 'best' knowledge - some sites may have wrong or missing data, but you hit 4-5 of them and you will find the 'common thread' of information. Doing a bit of reading on each site will get you tons of knowledge fast. And, you may find one that just happens to have a new command you never saw (though DOS has been out so long with no changes it is very well documented) - that is how I learned to program php years ago - and still constantly search for various ways to do things. want more direct info? then formulate an idea of what you want to achieve (not just 'learn about CMD' - that is very vague....) - then ask yourself a question about getting it done. put that question in the search engine - you will be amazed...... onlineth 1 Link to comment Share on other sites More sharing options...
michaelslamet Posted January 17, 2014 Share Posted January 17, 2014 ss64.com onlineth 1 Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted January 17, 2014 Moderators Share Posted January 17, 2014 I prefer this one, straight from the horse's mouth so to speak. Goes up through Windows 8 and Server 2012. http://technet.microsoft.com/en-us/library/cc754340.aspx onlineth 1 "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! 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