Jump to content
Sign in to follow this  
RaisingHeart

How make a program which works in background?

Recommended Posts

RaisingHeart

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.

Share this post


Link to post
Share on other sites
GoogleDude

Define what you mean by "program works in background"? Do you mean a program that runs as a Windows Service or a program that does things that are not seen by the user?

GD

Share this post


Link to post
Share on other sites
RaisingHeart

Ah...

Just I want to run a program non-active.

For example, when I play a computer game, but program is writing a script in a word processor...

Share this post


Link to post
Share on other sites
Valuater

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

Share this post


Link to post
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
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.