Jump to content

How make a program which works in background?


Recommended Posts

Hello.

I'm beginner of AutoIt.

So I want some help about making a program in AutoIt.

Now I make a program which inputs some keystrokes on web browser or a word processor.

It's easy to making program which just input some keystrokes. but I want this program works in background.

Please help me.

P.S. I'm korean. So I'm poor in English. Although This writing have a some mistakes, Please read the writing and give a piece of advice.

Link to comment
Share on other sites

Lesson #9 from "Welcome to Autoit 1-2-3... in my signature below

; This is a demonstration for AU3Info and Notepad using ControlSend.


; Wait time after each action.
$Wait = 5000 

AutoItSetOption("WinTitleMatchMode", 4) ; see "options" in help for title match mode

; From Au3Info we can get
$Win_Title = "Untitled - Notepad" 
$Win_Text = "" 
$Control_ID = "Edit1"
Sleep($Wait)

; re-size the info window
WinMove("AutoIt v3 Active Window Info", "", 200, 100, 250, 300)

; Now lets open notepad.
Sleep($Wait)
Run("Notepad.exe")

WinWaitActive("Untitled - Notepad") 
$variable = '; Wait until the window is active.'
ControlSend($Win_Title, $Win_Text, $Control_ID, $variable & @CRLF)
Sleep($Wait)

$variable = '; Change the Title Name to AutoIt 1-2-3'
ControlSend($Win_Title, $Win_Text, $Control_ID, $variable & @CRLF)
$New_Title = "Welcome to AutoIt 1-2-3"
WinSetTitle($Win_Title, $Win_Text, $New_Title)
Sleep($Wait)

$variable = '; Lets use the Window Handle for controlling Notepad.'
ControlSend($New_Title, $Win_Text, $Control_ID, $variable & @CRLF)
Sleep($Wait)
$Note_win = WinGetHandle($New_Title, "")

$variable = '; Resize the Notepad window, and move it, see help for details.'
ControlSend($New_Title, $Win_Text, $Control_ID, $variable & @CRLF)
Sleep($Wait)
WinMove($Note_win, "", 500, 100, 400, 500)


$variable = '; Important, The ControlSend Command works with the control, Not the active window.'
ControlSend($New_Title, $Win_Text, $Control_ID, $variable & @CRLF)
Sleep($Wait)

$variable = '; Now for a test, lets Hide the Notepad.'
ControlSend($New_Title, $Win_Text, $Control_ID, $variable & @CRLF)
Sleep($Wait)

WinSetState($Note_win, "", @SW_HIDE)

$variable = '; Lets send some text to the hidden window '
ControlSend($New_Title, $Win_Text, $Control_ID, $variable & @CRLF)
Sleep($Wait)

$variable = '; Lets bring back Notepad and check it to be sure. '
ControlSend($New_Title, $Win_Text, $Control_ID, $variable & @CRLF)
WinSetState($Note_win, "", @SW_SHOW)
Sleep($Wait)



$variable = '; Now lets Close the Windows. However the control IDs are Hidden'
ControlSend($New_Title, $Win_Text, $Control_ID, $variable & @CRLF)
Sleep($Wait)
WinClose("AutoIt v3 Active Window Info") ; Win Close
ControlSend($New_Title, "", "","!FX")
Sleep($Wait)
ControlClick("Notepad", "The text in the Untitled file has changed", "Button2") ; Control Click


; there is no GUI or loop in this Demo.
Exit

8)

NEWHeader1.png

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