maed Posted December 16, 2005 Share Posted December 16, 2005 This is my first post here but hopefully most of the future ones will not be for help lol Im mkaing just a little tool that will copy and paste something into my firefox to go there. Its practically an Outwar Crew Inviter if u know what that is. But im making a little personal one. This is my first try at anything and ill post my stuff. I have a text file with the names of the people that i want to invite and i have it open and resized to half screen and then mozilla open and resized to half screen so it can do its thing. MouseClick ( "left" , 795, 81, 2, 10 ) Sleep ( 1000 ) Send ( "{CTRLDOWN}") Sleep ( 500 ) Send ( "C") Sleep ( 500 ) Send ( "{CTRLUP}") Sleep ( 500 ) Send ( "{BACKSPACE}") Send ( "{BACKSPACE}") Sleep ( 500 ) MouseClick ( "left", 683, 562, 1, 10 ) Sleep ( 500 ) Send ( "{BACKSPACE}") Sleep ( 500 ) MouseClick ( "left", 683, 562, 1, 10 ) Sleep ( 500 ) MouseClick ( "right", 683, 562, 1, 10 ) Send ( "P") Sleep ( 500 ) Send ( "{ENTER}") I got that all right and everything having it CTRL + V (to paste) wasnt working so i made it right click and P for paste. So my problem with that is i want it to start over after its done but i cant get it right with all the things i tried. I need help making it restart or loop as i think the term is called Also i need help making the GUI. All i want is a simple small window that says Run and Close. When you click on Run it will run the script i posted above over and over but it needs to be able to loop first, and Close will stop the script and close the GUI window. I have been tinkering with it but i cant even get the buttons in the right place, i just modified the sample gui that came with autoit ; AutoIt 3.0.103 example ; 17 Jan 2005 - CyberSlug ; This script shows manual positioning of all controls; ; there are much better methods of positioning... #include <GuiConstants.au3> ; GUI GuiCreate("Sample GUI", 400, 250) GuiSetIcon(@SystemDir & "\mspaint.exe", 0) ; ICON GuiCtrlCreateIcon("shell32.dll", 1, 175, 120) GuiCtrlCreateLabel("Icon", 180, 160, 50, 20) ; BUTTON GuiCtrlCreateButton("Run", -1, -1, 100, 100) GuiCtrlCreateButton("Close", -2, -2, 100, 100) ; GUI MESSAGE LOOP GuiSetState() While GuiGetMsg() <> $GUI_EVENT_CLOSE WEnd Link to comment Share on other sites More sharing options...
erebus Posted December 16, 2005 Share Posted December 16, 2005 (edited) So my problem with that is i want it to start over after its done but i cant get it right with all the things i tried. I need help making it restart or loop as i think the term is called Consider putting the code you want to loop into user-Functions. For example: MyFunc() ;other code here MyFunc() ;more code here too MyFunc() ;end of your program Func MyFunc() MsgBox(0,"title","This message must be repeated.") EndFunc As far as the GUI part is concerned, check the 'GUICtrlCreateButton' in the help file. It says all you want to know. Edited December 16, 2005 by erebus Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted December 16, 2005 Moderators Share Posted December 16, 2005 Try Koda for the GUI... ; GUI GuiCreate("Sample GUI", 400, 250) GuiSetIcon(@SystemDir & "\mspaint.exe", 0) ; ICON GuiCtrlCreateIcon("shell32.dll", 1, 175, 120) GuiCtrlCreateLabel("Icon", 180, 160, 50, 20) ; BUTTON $RUN_1 = GuiCtrlCreateButton("Run", -1, -1, 100, 100) GuiCtrlCreateButton("Close", -2, -2, 100, 100) ; GUI MESSAGE LOOP GuiSetState() While 1 $MSG = GuiGetMsg() Select Case $MSG = $GUI_EVENT_CLOSE Exit Case $MSG = $RUN_1 Run("NotePad.exe") EndSelect WEnd Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
maed Posted December 16, 2005 Author Share Posted December 16, 2005 MouseClick ( "left" , 795, 81, 2, 10 ) Sleep ( 1000 ) Send ( "{CTRLDOWN}") Sleep ( 500 ) Send ( "C") Sleep ( 500 ) Send ( "{CTRLUP}") Sleep ( 500 ) Send ( "{BACKSPACE}") Send ( "{BACKSPACE}") Sleep ( 500 ) MouseClick ( "left", 683, 562, 1, 10 ) Sleep ( 500 ) Send ( "{BACKSPACE}") Sleep ( 500 ) MouseClick ( "left", 683, 562, 1, 10 ) Sleep ( 500 ) MouseClick ( "right", 683, 562, 1, 10 ) Send ( "P") Sleep ( 500 ) Send ( "{ENTER}") Consider putting the code you want to loop into user-Functions. For example: CODE MyFunc() ;other code here MyFunc() ;more code here too MyFunc() ;end of your program Func MyFunc() MsgBox(0,"title","This message must be repeated.") EndFuncIm looking into how to do this but just in case i cant figure it out can u give a little more detail how to do it? All i got is the autoit help file and that has helped me alot. Its pretty good for a help file As far as the GUI part is concerned, check the 'GUICtrlCreateButton' in the help file. It says all you want to know. I know how to make a button just not how to make it do stuff when u press it lol. Like i said this is my first project and im kind of stumped Link to comment Share on other sites More sharing options...
Valuater Posted December 16, 2005 Share Posted December 16, 2005 rthis is a combination of everyting they gave you expandcollapse popup#include <GUIConstants.au3> Dim $t = 0 ; GUI GUICreate("Sample GUI", 400, 250) ; BUTTON $RUN_1 = GUICtrlCreateButton("Run/Stop", 150, 100, 100, 50) ; GUI MESSAGE LOOP GUISetState() While 1 $MSG = GUIGetMsg() Select Case $MSG = $GUI_EVENT_CLOSE Exit Case $MSG = $RUN_1 If $t = 1 Then $t = 0 Else $t = 1 EndIf EndSelect If $t = 1 Then run_script() WEnd Func run_script() MouseClick("left", 795, 81, 2, 10) Sleep(1000) Send("{CTRLDOWN}") Sleep(500) Send("C") Sleep(500) Send("{CTRLUP}") Sleep(500) Send("{BACKSPACE}") Send("{BACKSPACE}") Sleep(500) MouseClick("left", 683, 562, 1, 10) Sleep(500) Send("{BACKSPACE}") Sleep(500) MouseClick("left", 683, 562, 1, 10) Sleep(500) MouseClick("right", 683, 562, 1, 10) Send("P") Sleep(500) Send("{ENTER}") EndFunc ;==>run_script not tested 8) Link to comment Share on other sites More sharing options...
maed Posted December 16, 2005 Author Share Posted December 16, 2005 rthis is a combination of everyting they gave you expandcollapse popup#include <GUIConstants.au3> Dim $t = 0 ; GUI GUICreate("Sample GUI", 400, 250) ; BUTTON $RUN_1 = GUICtrlCreateButton("Run/Stop", 150, 100, 100, 50) ; GUI MESSAGE LOOP GUISetState() While 1 $MSG = GUIGetMsg() Select Case $MSG = $GUI_EVENT_CLOSE Exit Case $MSG = $RUN_1 If $t = 1 Then $t = 0 Else $t = 1 EndIf EndSelect If $t = 1 Then run_script() WEnd Func run_script() MouseClick("left", 795, 81, 2, 10) Sleep(1000) Send("{CTRLDOWN}") Sleep(500) Send("C") Sleep(500) Send("{CTRLUP}") Sleep(500) Send("{BACKSPACE}") Send("{BACKSPACE}") Sleep(500) MouseClick("left", 683, 562, 1, 10) Sleep(500) Send("{BACKSPACE}") Sleep(500) MouseClick("left", 683, 562, 1, 10) Sleep(500) MouseClick("right", 683, 562, 1, 10) Send("P") Sleep(500) Send("{ENTER}") EndFunc ;==>run_script not tested 8) Wow thanks it works good i just have to lower delays cuz its too slow for me but i know how to lower them! But one thing is i couldnt get it to stop! lol if the delays were shorter i wuld have never got it closed cuz the mouse wuld have been moving alot. Thanks it works perfect except for it doesnt stop Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted December 16, 2005 Moderators Share Posted December 16, 2005 Val... will probably write it for you... but I'll just tell you what to look at since you stated earlier that you "looked everywhere". HotKeySet() in the help file. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Valuater Posted December 16, 2005 Share Posted December 16, 2005 to fix the sleep place this at the top of the script Dim $timer = 500 ; change to the "sleep" time you want and replace the function with this Func run_script() MouseClick("left", 795, 81, 2, 10) Sleep($timer * 2) Send("{CTRLDOWN}") Sleep($timer) Send("C") Sleep($timer) Send("{CTRLUP}") Sleep($timer) Send("{BACKSPACE}") Send("{BACKSPACE}") Sleep($timer) MouseClick("left", 683, 562, 1, 10) Sleep($timer) Send("{BACKSPACE}") Sleep($timer) MouseClick("left", 683, 562, 1, 10) Sleep($timer) MouseClick("right", 683, 562, 1, 10) Send("P") Sleep($timer) Send("{ENTER}") EndFunc ;==>run_script 8) Link to comment Share on other sites More sharing options...
maed Posted December 16, 2005 Author Share Posted December 16, 2005 Val... will probably write it for you... but I'll just tell you what to look at since you stated earlier that you "looked everywhere". HotKeySet() in the help file.Ok im looking for it now!Val thanks for all your help but dont tell me how to find this lol! I just added the sleep you posted and it works good too, and i added a message box with instructions on how to use. Actually this "program" will work with pasting a lot of links into a browser not just a inviter to this game... Its probably a very bad design but lol maybe ill get good enough to make it do all of this for you like get the names of the people and then add it to the end of the link by its self. Meh oh well this will do for now! Link to comment Share on other sites More sharing options...
maed Posted December 16, 2005 Author Share Posted December 16, 2005 Ok I tried HotKeySet("{PAUSE}", "run_1")and i triedHotKeySet("{PAUSE}", "run_script")Run_1 would return an error when i opened it and Run_Script would start it all over again lol not stop it!Still trying different things but not coming up with anything, im also searching forums but nothing has helpedHere is the whole codeMsgBox ( 0, "Instructions", "To use this you must have 2 things. 1. An open browser page with you logged in 2. A txt file with a list of links, example http://torax.outwar.com/managecrew.php?playername=Maedhros ===Note=== Can be used on any server, just replace torax with your server ------------How To Use-------------- You must resize the page and the txt file so that you can see them both at same time preferably each half screen size (might only work on 1024 x 768 resolution) You will have to do trial and error a few tiems to get the clickign right but the First click MUST click on any line of the txt file but the first. Second Click MUST click on the address bar of your browser. That is all you need to know about using this. I know its alot of work But some people are lazy like me O.o Oh and last thing. This is my first attempt at making anything, I will get better and my next thing wont be as sucky as this one!" )#include <GUIConstants.au3>Dim $timer = 300 ; change to the "sleep" time you wantDim $t = 0; GUIGUICreate("Auto Inviter", 200, 150); BUTTON$RUN_1 = GUICtrlCreateButton("Run/Stop", 50, 50, 100, 50)HotKeySet("{PAUSE}", "run_script"); GUI MESSAGE LOOPGUISetState()While 1 $MSG = GUIGetMsg() Select Case $MSG = $GUI_EVENT_CLOSE Exit Case $MSG = $RUN_1 If $t = 1 Then $t = 0 Else $t = 1 EndIf EndSelect If $t = 1 Then run_script()WEndFunc run_script() MouseClick("left", 830, 81, 2, 10) Sleep($timer * 2) Send("{CTRLDOWN}") Sleep($timer) Send("C") Sleep($timer) Send("{CTRLUP}") Sleep($timer) Send("{BACKSPACE}") Send("{BACKSPACE}") Sleep($timer) MouseClick("left", 683, 497, 1, 10) Sleep($timer) Send("{BACKSPACE}") Sleep($timer) MouseClick("left", 684, 497, 1, 10) Sleep($timer) MouseClick("right", 684, 497, 1, 10) Send("P") Sleep($timer) Send("{ENTER}")EndFunc ;==>run_script Link to comment Share on other sites More sharing options...
JSThePatriot Posted December 16, 2005 Share Posted December 16, 2005 Ok I tried and i tried Run_1 would return an error when i opened it and Run_Script would start it all over again lol not stop it! Still trying different things but not coming up with anything, im also searching forums but nothing has helped Here is the whole code You may want to copy and paste the whole of the code in the script. The function included. It toggle's the pause. To save you a little time here it is. HotKeySet("{PAUSE}", "TogglePause") Func TogglePause() $Paused = NOT $Paused While $Paused Sleep(100) WEnd EndFunc I removed the tool tip, I find it annoying. I hope this helps. JS AutoIt Links File-String Hash Plugin Updated! 04-02-2008Â Plugins have been discontinued. I just found out. ComputerGetInfo UDF's Updated! 11-23-2006 External Links Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more) Link to comment Share on other sites More sharing options...
maed Posted December 16, 2005 Author Share Posted December 16, 2005 You may want to copy and paste the whole of the code in the script. The function included. It toggle's the pause. To save you a little time here it is. HotKeySet("{PAUSE}", "TogglePause") Func TogglePause() $Paused = NOT $Paused While $Paused Sleep(100) WEnd EndFunc I removed the tool tip, I find it annoying. I hope this helps. JS When i tried it it woked fine untill i hot the hotkey lol. instead of pausing an error popped up and closed it Line 16 $Paused = NOT $Paused $Paused=NOT ^ ERROR Error: Variable used without being declared Link to comment Share on other sites More sharing options...
JSThePatriot Posted December 16, 2005 Share Posted December 16, 2005 When i tried it it woked fine untill i hot the hotkey lol. instead of pausing an error popped up and closed it Line 16 $Paused = NOT $Paused $Paused=NOT ^ ERROR Error: Variable used without being declared Right inside the function type... Local $Paused That way it is declared. The function should still work otherwise. I assume you are using SciTE? JS AutoIt Links File-String Hash Plugin Updated! 04-02-2008Â Plugins have been discontinued. I just found out. ComputerGetInfo UDF's Updated! 11-23-2006 External Links Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more) Link to comment Share on other sites More sharing options...
maed Posted December 16, 2005 Author Share Posted December 16, 2005 (edited) Ok now i want to do something else. How can i have it do this Copy line 1 in "file.txt" Paste line 1 from "file.txt" into address bar of my mozilla firefox and then press Enter (to go to the link) Copy line 2 in "file.txt" Paste line 2 from "file.txt" into address bar of my mozilla firefox and then press Enter (to go to the link) and so on doing these steps without having the txt file open but having my firefox open so it can go to the link in the same tab over and over The reason for this is that it will be too much of a hassle for peopel to get the coordinates right so that it can click on the line then copy paste and w/e the way i have now. Im trying out different things right now but i t hought maybe i can get it done before i go to bed, or atleast set me up to finish tomorrow Edit: I just seen your previous post above mine.....I didnt make any changes to what you said, i copied it exaclty...and all i am using is the help file in auto it, im just right clicking on the file and clicking edit. I do not know what scite is o.o Edit again: Ok the pause hotkey now works thanks Edited December 16, 2005 by maed Link to comment Share on other sites More sharing options...
JSThePatriot Posted December 16, 2005 Share Posted December 16, 2005 Ok now i want to do something else. How can i have it do thisCopy line 1 in "file.txt"Paste line 1 from "file.txt" into address bar of my mozilla firefox and then press Enter (to go to the link)Copy line 2 in "file.txt"Paste line 2 from "file.txt" into address bar of my mozilla firefox and then press Enter (to go to the link)and so on doing these steps without having the txt file open but having my firefox open so it can go to the link in the same tab over and overThe reason for this is that it will be too much of a hassle for peopel to get the coordinates right so that it can click on the line then copy paste and w/e the way i have now.Im trying out different things right now but i t hought maybe i can get it done before i go to bed, or atleast set me up to finish tomorrowEdit: I just seen your previous post above mine.....I didnt make any changes to what you said, i copied it exaclty...and all i am using is the help file in auto it, im just right clicking on the file and clicking edit. I do not know what scite is o.oLook at the helpfile for the following File*() functions. FileOpen(), FileReadLine(), FileClose(). Also while you are at it you should look up looping in the helpfile. You need it. There are a few types of looping in AutoIt. The two most common I have seen/use are While...WEnd, and For...Next. For your case you might be able to also use _FileReadToArray() (it is a UDF, but included in the helpfile).Let me know if you have any specific questions about those functions.JS AutoIt Links File-String Hash Plugin Updated! 04-02-2008Â Plugins have been discontinued. I just found out. ComputerGetInfo UDF's Updated! 11-23-2006 External Links Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more) Link to comment Share on other sites More sharing options...
maed Posted December 16, 2005 Author Share Posted December 16, 2005 Look at the helpfile for the following File*() functions. FileOpen(), FileReadLine(), FileClose(). Also while you are at it you should look up looping in the helpfile. You need it. There are a few types of looping in AutoIt. The two most common I have seen/use are While...WEnd, and For...Next. For your case you might be able to also use _FileReadToArray() (it is a UDF, but included in the helpfile).Let me know if you have any specific questions about those functions.JSYea im reading up and hopefully ill learn it. Im probably goign to read a bit more then hit the hay. Thanks for all your help and im sure ill be back posting in this thread when i wake up lol Link to comment Share on other sites More sharing options...
JSThePatriot Posted December 16, 2005 Share Posted December 16, 2005 Yea im reading up and hopefully ill learn it. Im probably goign to read a bit more then hit the hay. Thanks for all your help and im sure ill be back posting in this thread when i wake up lolNP Hitting the hay sounds soo good, but at the same time I wanna stay up. LOL Decisions, decisions.GN and I hope to be able to assist you further. I know the helpfile is one of the best I have ever seen. It should have most if not all of your answers.JS AutoIt Links File-String Hash Plugin Updated! 04-02-2008Â Plugins have been discontinued. I just found out. ComputerGetInfo UDF's Updated! 11-23-2006 External Links Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more) Link to comment Share on other sites More sharing options...
maed Posted December 16, 2005 Author Share Posted December 16, 2005 (edited) I messed aroudn with all of them but _Filereadtoarray... i need help figuring that one out. When it uses ReadFileLine does it automatically copy it? if so i must not be using it right because it pastes whatever i already had on the clipboard... expandcollapse popupMsgBox ( 0, "Instructions", "To use this you must have 2 things. 1. An open browser page with you logged in 2. A txt file with a list of links, example [url=http://torax.outwar.com/managecrew.php?playername=Maedhros]http://torax.outwar.com/managecrew.php?playername=Maedhros[/url] ===Note=== Can be used on any server, just replace torax with your server ------------How To Use-------------- You must resize the page and the txt file so that you can see them both at same time preferably each half screen size (might only work on 1024 x 768 resolution) You will have to do trial and error a few tiems to get the clickign right but the First click MUST click on any line of the txt file but the first. Second Click MUST click on the address bar of your browser. That is all you need to know about using this. I know its alot of work But some people are lazy like me O.o Oh and last thing. This is my first attempt at making anything, I will get better and my next thing wont be as sucky as this one!" ) #include <GUIConstants.au3> Dim $timer = 300; change to the "sleep" time you want Dim $t = 0 ; GUI GUICreate("Auto Inviter", 200, 150) ; BUTTON $RUN_1 = GUICtrlCreateButton("Run/Stop", 50, 50, 100, 50) HotKeySet("{PAUSE}", "TogglePause") Func TogglePause() Local $Paused $Paused = NOT $Paused While $Paused Sleep(100) WEnd EndFunc HotKeySet("{ESC}", "Terminate") Func Terminate() Exit 0 EndFunc ; GUI MESSAGE LOOP GUISetState() While 1 $MSG = GUIGetMsg() Select Case $MSG = $GUI_EVENT_CLOSE Exit Case $MSG = $RUN_1 If $t = 1 Then $t = 0 Else $t = 1 EndIf EndSelect If $t = 1 Then run_script() WEnd Func run_script() FileReadLine ( "Names.txt", 1 ) MouseClick("left", 683, 497, 1, 10) Sleep($timer) Send("{BACKSPACE}") Sleep($timer) MouseClick("left", 684, 497, 1, 10) Sleep($timer) MouseClick("right", 684, 497, 1, 10) Send("P") Sleep($timer) Send("{ENTER}") EndFunc ;==>run_script Edited December 16, 2005 by maed Link to comment Share on other sites More sharing options...
maed Posted December 16, 2005 Author Share Posted December 16, 2005 One quick thing. I know how to make the mouse move down to a certain position but how can i make it move down a certain amount like this example. the mouse is at x coord 65 move mous down by 5 x coord now the mouse is at 70 x coord. Can this be done? the only thing im finding is move to a specific coord not move down a certain amount Link to comment Share on other sites More sharing options...
Valuater Posted December 16, 2005 Share Posted December 16, 2005 maybe this $pos = MouseGetPos() MsgBox(0, "Mouse x,y:", $pos[0] & "," & $pos[1]) MouseMove($pos[0] + 5, $pos[1] + 5) 8) 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