noobcracker99 Posted July 18, 2008 Share Posted July 18, 2008 I would like to make a script so that, it won't activate on it's own and instead I can have it "running" then just hit a certain key and my mouse will click on a certain x/y position for a game of mine. Is it possible to make a key so like I turn on the script then go in my game and hit the insert key, and it'll click at x/y position on my screen once. Then I click Home key and it'll click at a different x/y position once etc. I don't want it to exec and run instantly, instead I am just trying to make it so I can keep the script running and then just hit the individual key and it'll do that function once and then I am going to have 4 keys for 4 different mouse clicks. I am pretty sure for the function part it'll look something like MouseClick("left", x,y position or something. If it isn't possible to make it so that it won't auto exec the functions/ make it so I can just leave the script active and then hit keys manually I guess I can try a different program. Link to comment Share on other sites More sharing options...
Mobius Posted July 18, 2008 Share Posted July 18, 2008 HotKeySET("{HOME}","_HKhome") HotKeySET("{ESC}","_HKesc") WHILE 1 $tMsg = TrayGetMsg() SWITCH $tMsg CASE 0 CONTINUELOOP CASE ELSE EXIT ENDSWITCH WEND ; Should click on the SysMenu icon of a maximized window using win classic theme. FUNC _HKhome() MouseClick("Left",10,10); Check out the Documentation & experiment. ENDFUNC ; Should click on the close button of a maximized window using same theme. FUNC _HKesc() MouseClick("Left",@DESKTOPWIDTH - 10,5) EXIT ENDFUNC Just a quick n dirty example but you get the idea. AutoIt3 has excellent documentation & functions, Check em out. Plenty of scripting langs support mouse manipulation so the choice is really up to you. muttley Link to comment Share on other sites More sharing options...
noobcracker99 Posted July 21, 2008 Author Share Posted July 21, 2008 (edited) Probably a stupid noob question, but I took your hotkeys and did one for each (insert, home, pgup, pgdn, end). I am assuming I make it HKInsert, HKHome, HKPGUP, HKPGDN, HKEND. For all of them, then do the functions for each and change the positions. Also, how exactly will I get to turn on the script to where it'll be on and I can just go into my screen and hit the keys? I assume just exec the script and it'll stay on by itself? All I have is the 5 HotkeySet commands, then the 5 Func for each individual hotkey set up properly. And if I attempt to execute it nothing happens. So I guess, I just need help as to how to actually get the rest to work. By the way, is it even possible to have the script "active" but not be automated? So like I just turn it on and then it stays on but doesn't do anything until I hit the key and it clicks the spot I want? HotKeySet("{INSERT}","_HKInsert") HotKeySet("{HOME}","_HKHome") HotKeySet("{PGUP}", "_HKPGUP") HotKeySet("{PGDN}","_HKPGDN") HotKeySet("{END}","_HKEND") FUNC _HKInsert() MouseClick("Left",685,285); Check out the Documentation & experiment. ENDFUNC FUNC _HKHome() MouseClick("Left",825,355); Check out the Documentation & experiment. ENDFUNC FUNC _HKPGUP() MouseClick("Left",600,280); Check out the Documentation & experiment. ENDFUNC FUNC _HKPGDN() MouseClick("Left",810,670); Check out the Documentation & experiment. ENDFUNC FUNC _HKEND() MouseClick("Left",755,165); Check out the Documentation & experiment. ENDFUNC Edited July 21, 2008 by noobcracker99 Link to comment Share on other sites More sharing options...
enaiman Posted July 21, 2008 Share Posted July 21, 2008 Nothing happens because your script is not running (it ends its executions in fractions of second). You forgot to add a very important part from the script above: WHILE 1 $tMsg = TrayGetMsg() SWITCH $tMsg CASE 0 CONTINUELOOP CASE ELSE EXIT ENDSWITCH WEND This part of the script makes it loop until a certain event occured (have a look at "TrayGetMsg" function). SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script wannabe "Unbeatable" Tic-Tac-Toe Paper-Scissor-Rock ... try to beat it anyway :) Link to comment Share on other sites More sharing options...
noobcracker99 Posted July 21, 2008 Author Share Posted July 21, 2008 Thank you very much, and very sorry for my humiliating stupidity lol. Link to comment Share on other sites More sharing options...
noobcracker99 Posted July 21, 2008 Author Share Posted July 21, 2008 Very sorry, my game is the one having the problem. Basically I made it so insert is the command to pick a flag, then made the script so it would click in the proper spot. However, in game when I click insert the game doesn't recognize it ever being pressed so it just clicks in the right spot without planting the flag. I tried making the code so it would send the key once before it clicks, but it seems like it does it in a constant loop and doesn't quite work. FUNC _HKInsert() Send("{INSERT}") MouseClick("Left",685,285); Check out the Documentation & experiment. ENDFUNC So, if I could get some last bit of advice, as to how to make it so it'll just send 1 insert and then mouse click like normal it would be appreciated. Link to comment Share on other sites More sharing options...
Cha0sBG Posted July 21, 2008 Share Posted July 21, 2008 what do u want it to do Continue sending those codes ? if so here FUNC _HKInsert() While 1 Send("{INSERT}") MouseClick("Left",685,285); Check out the Documentation & experiment. continueloop wend ENDFUNC Have Questions About GUI (Graphical User Interface) ? Post Them Here :GUI Help And Support ForumHave Questions About General AutoIt ? Post Them Here : General Help And Support ForumNew To AutoIt ? Be Shure To Check Out The FaQ's (Frequently Asked Questions) Or FaQ ¹ There You May Find Great Help That Will Guide You True The Wonderful Programming Language AutoItOthere Good Place To Get Some Knolage Of AutoIt Is The Example Script ForumNotice A Bug ? Please Go And Report it At Bug Report Section And Help The Devolepers Of AutoIt Update And Fix The Programming LanguageWant To Thank The People For This Great Forum And Programming Language ? Then DonateWhen You Found The Answer Your Looking For Please Add [Resolved] To The Thread's Name That Will Show Otheres That You Have Found What Your Looking For And They Whount Have To Enter The Thread. Link to comment Share on other sites More sharing options...
noobcracker99 Posted July 21, 2008 Author Share Posted July 21, 2008 (edited) All I was attempting, was to make it so it would send the key once, then click right after. But it seems like by adding the send code and key, that it would stop my clicking from working afterward or something. It just seemed like by adding the one send command it ends up sending it in a loop, instead of my desired effect which would just be a single send and then mouse click. Edited July 21, 2008 by noobcracker99 Link to comment Share on other sites More sharing options...
Cha0sBG Posted July 21, 2008 Share Posted July 21, 2008 MouseClick Dousnt Make your code not working must be something othere Have Questions About GUI (Graphical User Interface) ? Post Them Here :GUI Help And Support ForumHave Questions About General AutoIt ? Post Them Here : General Help And Support ForumNew To AutoIt ? Be Shure To Check Out The FaQ's (Frequently Asked Questions) Or FaQ ¹ There You May Find Great Help That Will Guide You True The Wonderful Programming Language AutoItOthere Good Place To Get Some Knolage Of AutoIt Is The Example Script ForumNotice A Bug ? Please Go And Report it At Bug Report Section And Help The Devolepers Of AutoIt Update And Fix The Programming LanguageWant To Thank The People For This Great Forum And Programming Language ? Then DonateWhen You Found The Answer Your Looking For Please Add [Resolved] To The Thread's Name That Will Show Otheres That You Have Found What Your Looking For And They Whount Have To Enter The Thread. Link to comment Share on other sites More sharing options...
Cha0sBG Posted July 21, 2008 Share Posted July 21, 2008 (edited) FUNC FuncHKI() Send("{INSERT}") MouseClick("",685,285); Check out the Documentation & experiment. ENDFUNC Try This Maybe It Will Work now i Tryed it and well the name of the func gave me error i changed it and changed some litle stuff aswell try it now and tell me does it work Edited July 21, 2008 by Cha0sBG Have Questions About GUI (Graphical User Interface) ? Post Them Here :GUI Help And Support ForumHave Questions About General AutoIt ? Post Them Here : General Help And Support ForumNew To AutoIt ? Be Shure To Check Out The FaQ's (Frequently Asked Questions) Or FaQ ¹ There You May Find Great Help That Will Guide You True The Wonderful Programming Language AutoItOthere Good Place To Get Some Knolage Of AutoIt Is The Example Script ForumNotice A Bug ? Please Go And Report it At Bug Report Section And Help The Devolepers Of AutoIt Update And Fix The Programming LanguageWant To Thank The People For This Great Forum And Programming Language ? Then DonateWhen You Found The Answer Your Looking For Please Add [Resolved] To The Thread's Name That Will Show Otheres That You Have Found What Your Looking For And They Whount Have To Enter The Thread. 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