Jump to content

Recommended Posts

Posted

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 :)

Posted (edited)

If your script doesn't have a GUI or run other programs(with GUIs), #NoTrayIcon should be enough.

If you post your code is much better, we can help you more.

Edited by Andreik
Posted

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 :)

Posted (edited)

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
Posted

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.

Posted (edited)

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
Posted

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?

Posted (edited)

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
Posted

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

Posted

@helzin

Take a look to FF.au3 udf (firefox udf) in example scripts forum, then you will be able to do what you want with firefox :)

Cheers, FireFox.

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...