helzin Posted January 25, 2009 Share Posted January 25, 2009 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 More sharing options...
Andreik Posted January 25, 2009 Share Posted January 25, 2009 (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 January 25, 2009 by Andreik When the words fail... music speaks. Link to comment Share on other sites More sharing options...
helzin Posted January 25, 2009 Author Share Posted January 25, 2009 CODEWhile 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 More sharing options...
Andreik Posted January 25, 2009 Share Posted January 25, 2009 (edited) CODEWhile 1Sleep(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 ExitloopEndIfsend($x)sleep(800)Send("{enter}")$section = $section + 1WEndThat's my simple code Now define what mean for you "run in background". What should be hide? Edited January 25, 2009 by Andreik When the words fail... music speaks. Link to comment Share on other sites More sharing options...
helzin Posted January 25, 2009 Author Share Posted January 25, 2009 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 More sharing options...
Andreik Posted January 25, 2009 Share Posted January 25, 2009 (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 January 25, 2009 by Andreik When the words fail... music speaks. Link to comment Share on other sites More sharing options...
helzin Posted January 25, 2009 Author Share Posted January 25, 2009 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 More sharing options...
helzin Posted January 25, 2009 Author Share Posted January 25, 2009 (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: CODEControlClick ( "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 January 25, 2009 by helzin Link to comment Share on other sites More sharing options...
Developers Jos Posted January 25, 2009 Developers Share Posted January 25, 2009 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 More sharing options...
helzin Posted January 25, 2009 Author Share Posted January 25, 2009 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 More sharing options...
Developers Jos Posted January 25, 2009 Developers Share Posted January 25, 2009 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 More sharing options...
FireFox Posted January 25, 2009 Share Posted January 25, 2009 @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. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now