Jump to content

Make the script run in background


helzin
 Share

Recommended Posts

Hello everyone!

I've just started to learn AutoIt, and I'm not very good at it, so I need some help with a script. I've build this scrit that pressing buttoms in Firefox, it mostly uses MouseClick and Send, so it's really easy made, so here to my question, how do I make this script work in the background? (So I can do other stuff meanwhile the script is running) If you need to see the code I can post it aswell :)

Link to comment
Share on other sites

CODE
While 1

Sleep(1000)

MouseClick("Main", 404, 501)

Sleep(2000)

MouseClick("Main", 396, 66)

Sleep(200)

$x = Iniread("links.ini", $section, "x", 9999)

sleep(200)

if $x = 9999 Then

Exitloop

EndIf

send($x)

sleep(800)

Send("{enter}")

$section = $section + 1

WEnd

That's my simple code :)

Link to comment
Share on other sites

CODE
While 1

Sleep(1000)

MouseClick("Main", 404, 501)

Sleep(2000)

MouseClick("Main", 396, 66)

Sleep(200)

$x = Iniread("links.ini", $section, "x", 9999)

sleep(200)

if $x = 9999 Then

Exitloop

EndIf

send($x)

sleep(800)

Send("{enter}")

$section = $section + 1

WEnd

That's my simple code :)

Now define what mean for you "run in background". What should be hide? Edited by Andreik

When the words fail... music speaks.

Link to comment
Share on other sites

I want the whole script to run in the background, so I can for example look at movie or do anything I want. So the script should be able to do stuff in the background without that I get disturbed, as it is now it moves the mouse, so I can't do anything while the script is running. I've been thinking of use ("{tab}") to no have to use MouseClick, but I don't think that's the best way to do it. And I still don't know how to do it so it can run in background.

Thank you for helping.

Link to comment
Share on other sites

I want the whole script to run in the background, so I can for example look at movie or do anything I want. So the script should be able to do stuff in the background without that I get disturbed, as it is now it moves the mouse, so I can't do anything while the script is running. I've been thinking of use ("{tab}") to no have to use MouseClick, but I don't think that's the best way to do it. And I still don't know how to do it so it can run in background.

Thank you for helping.

If the place where you want to click are some control you can use ControlClick() instead MouseClick() and ControlSend() instead Send(). Edited by Andreik

When the words fail... music speaks.

Link to comment
Share on other sites

Hmm, seems to work, partially, I get it to work sometimes, it works in skype, then it can write stuff to my friends, and I don't notice it. But when I'm trying to use it in Internet Explorer nothing happends, do you know why?

Link to comment
Share on other sites

I wonder if you can give me an example if this commands, like how to use it in Mozilla firefox. It should target the box where you enter the address to a homepage, then enter the address and press enter to enter the page. I'm trying to use this, but without success.

CODE

ControlClick ( "Mozilla Firefox", "text", controlID [, "main" [, 1 [, 537 [, 68 ]]]] )

Sleep(12)

ControlSend ( "Mozilla Firefox", "", controlID, "www.google.se" [, flag = 0] )

Sleep(12)

I get a error:

CODE
ControlClick ( "Mozilla Firefox", "text", [, "main" [, 1 [, 537 [, 68 ]]]] )

ControlClick ( "Mozilla Firefox", "text", ^ ERROR

And there is no controlID in Window Info when I'm targeting Mozilla, why?

Edited by helzin
Link to comment
Share on other sites

  • Developers

You are supposed to remove the Square brackets. They are an indication for optional parameters...

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Thanks, I'm still not getting it to work thought, this is what I've done, I have opened Mozilla Firefox and wrote in google.com, now I want the script to search on stuff for me, just to write in something and then press enter. This is what I've tryed with;

ControlClick ( "Google - Mozilla Firefox", "", controlID , main, 1, 566, 383)

Sleep(100)

ControlSend ( "Google - Mozilla Firefox", "", controlID, "help me")

Sleep(12)

controlsend ( "Google - Mozilla Firefox", "",controlID, "{enter}")

This is the error I get:

>"C:\Program\AutoIt3\SciTE\..\autoit3.exe" /ErrorStdOut "C:\Documents and Settings\didbjo01\Skrivbord\asd.au3"

C:\Documents and Settings\********\Skrivbord\asd.au3 (1) : ==> Missing separator character after keyword.:

ControlClick ( "Google - Mozilla Firefox", "", controlID , main, 1, 566, 383)

ControlClick ( "Google - Mozilla Firefox", "", controlID , main^ ERROR

>Exit code: 1 Time: 0.210

Link to comment
Share on other sites

  • Developers

Maybe it helps when you study the examples shown in the helpfile.

where you have controlID and main you should specify a proper value or variable.

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

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