Jump to content

Where to begin?


 Share

Recommended Posts

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

online.png?theme=dark profile for Tom on Stack Exchange, a network of free, community-driven Q&A sites 

scientia potentia est

Link to comment
Share on other sites

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 Gude
How 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

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 by TechCoder
Link to comment
Share on other sites

  • Moderators

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

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.

Link to comment
Share on other sites

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?

online.png?theme=dark profile for Tom on Stack Exchange, a network of free, community-driven Q&A sites 

scientia potentia est

Link to comment
Share on other sites

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

online.png?theme=dark profile for Tom on Stack Exchange, a network of free, community-driven Q&A sites 

scientia potentia est

Link to comment
Share on other sites

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)
Link to comment
Share on other sites

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......

Link to comment
Share on other sites

  • Moderators

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

"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

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...