Lemonadez Posted August 6, 2005 Share Posted August 6, 2005 Is it possible to do macro on certain program? Example: I run the autoit and the command just press ctrl+x and the exe name of the program WoW.exe then im on other games like counter strike...can autoit still pressing ctrl+x on WoW.exe? and the Ctrl+X -> must not work on counter strike...only on wow.exe is that possible.... thanks Link to comment Share on other sites More sharing options...
kabalarian Posted August 6, 2005 Share Posted August 6, 2005 (edited) DELETE ME...I READ THE POST WRONG Edited August 6, 2005 by kabalarian Link to comment Share on other sites More sharing options...
boogieoompa Posted August 7, 2005 Share Posted August 7, 2005 Yup try the Winactive command, it detects what app you are currently in so if you put an if statment you can get... Func FunCommand() If WinActive("Wow") Then mouseclick("Right") Send("{Down},{Down},{Right},{Enter}") mouseclick("Left") Else HotKeySet("^x") Send("^x") HotKeySet("^x", "FunRuler") Endif Endif Endif EndFunc This is assuming that ^x fires off the function "FunCommand". The second portion of the if the statement basically send ^x to the screen so any app you are using that actually uses ctrl+x would still fire off. Hope this helps Link to comment Share on other sites More sharing options...
Lemonadez Posted August 7, 2005 Author Share Posted August 7, 2005 (edited) confusing....but i go try..tyEDIT:give me errorCan we do it like? im playing counter strike and my other game is minimized but still it keep pressing ctrl+x on that game...i try to remove endif...but the program dont open at all...just close fast. Edited August 7, 2005 by Lemonadez Link to comment Share on other sites More sharing options...
Thatsgreat2345 Posted August 7, 2005 Share Posted August 7, 2005 (edited) Func FunCommand() If WinActive("Wow") Then mouseclick("Right") Send("{Down},{Down},{Right},{Enter}") mouseclick("Left") Else HotKeySet("^x") Send("^x") HotKeySet("^x", "FunRuler") Endif EndFunc ... u had 3 endifs Edited August 7, 2005 by thatsgreat2345 Link to comment Share on other sites More sharing options...
GaryFrost Posted August 7, 2005 Share Posted August 7, 2005 removed the extra endif statements Func FunCommand() If WinActive("Wow") Then MouseClick("Right") Send("{Down},{Down},{Right},{Enter}") MouseClick("Left") Else HotKeySet("^x") Send("^x") HotKeySet("^x", "FunRuler") EndIf EndFunc ;==>FunCommand SciTE for AutoItDirections for Submitting Standard UDFs  Don't argue with an idiot; people watching may not be able to tell the difference.  Link to comment Share on other sites More sharing options...
Lemonadez Posted August 7, 2005 Author Share Posted August 7, 2005 this script doesnt work at all it just close down everytime u run it...example Func FunCommand() If WinActive("Notepad") Then MouseClick("Right") Send("{Down},{Down},{Right},{Enter}") MouseClick("Left") Else HotKeySet("x") Send("x") HotKeySet("x", "FunRuler") EndIf EndFunc ;==>FunCommand i minimize my notepad....it doesnt and went to im browsing on internet...on notepad it doesnt even type xxxxxxxxxx and also the script just close down...I copy it and save it as blabla.au3 ->then run script...it doesnt run at all Link to comment Share on other sites More sharing options...
Thatsgreat2345 Posted August 7, 2005 Share Posted August 7, 2005 (edited) what are you trying to do i thought this was for wow the proper script is Func FunCommand() If WinActive("Wow") Then MouseClick("Right") Send("{Down},{Down},{Right},{Enter}") MouseClick("Left") Else HotKeySet("^x") Send("^x") HotKeySet("^x", "FunRuler") EndIf EndFunc;==>FunCommand u forgot the ^x for the ctrl x but what are u doing and for notepad it wouldnt be notepad it would be Untitled - Notepad or whatever the title of that window is Edited August 7, 2005 by thatsgreat2345 Link to comment Share on other sites More sharing options...
Lemonadez Posted August 8, 2005 Author Share Posted August 8, 2005 (edited) k the game called Monster and me...and active windows its "Monster&Me" without the "....i try to load it..but it doesnt work (i mean it just close by it self) it doesnt run at all Func FunCommand() If WinActive("Monster&Me") Then MouseClick("Right") Send("{Down},{Down},{Right},{Enter}") MouseClick("Left") Else HotKeySet("^x") Send("^x") HotKeySet("^x", "FunRuler") EndIf EndFunc;==>FunCommand Edited August 8, 2005 by Lemonadez Link to comment Share on other sites More sharing options...
LxP Posted August 8, 2005 Share Posted August 8, 2005 That's because your script isn't programmed to do anything -- you define a function so that AutoIt knows about it when you call it.Add this above your current code:HotkeySet("^z", "FunCommand") HotkeySet("^x", "Quit") While (1) Sleep(0x7FFFFFFF) WEnd Func Quit() Exit EndFunc ; Remaining code goes hereCtrl+Z calls FunCommand(); Ctrl+X quits the script. Feel free to change the keys. Link to comment Share on other sites More sharing options...
MSLx Fanboy Posted August 8, 2005 Share Posted August 8, 2005 (edited) LxP, ^x is sent by that one function...so setting it to close may not help him. #region functions Func FunCommand() If WinActive("Wow") Then MouseClick("Right") Send("{Down},{Down},{Right},{Enter}") MouseClick("Left") Else HotKeySet("^x") Send("^x") HotKeySet("^x", "FunCommand") EndIf EndFunc;==>FunCommand Func Quit() Exit EndFunc #endregion HotkeySet("^x", "FunCommand") HotkeySet("^z", "Quit") While (1) Sleep(0x7FFFFFFF) WEnd ; Remaining code goes here I reversed the hotkeys, I would check to make sure none of those games use the Ctrl-z in game, else Ctrl+Shift+Del maybe? Edited August 8, 2005 by MSLx Fanboy Writing AutoIt scripts since _DateAdd("d", -2, _NowCalcDate()) Link to comment Share on other sites More sharing options...
boogieoompa Posted August 8, 2005 Share Posted August 8, 2005 Huh, sorry about that extra endif. I accidently copied a little too far into my code . As far as "doing something" I put that little snit bit of code as an example the Send command should be removed and replaced with your own stuff. Link to comment Share on other sites More sharing options...
Lemonadez Posted August 8, 2005 Author Share Posted August 8, 2005 i got error about this line HotKeySet("^x", "FunRuler") Link to comment Share on other sites More sharing options...
MSLx Fanboy Posted August 8, 2005 Share Posted August 8, 2005 Change the FunRuler to FunCommand, I'll fix that above too Writing AutoIt scripts since _DateAdd("d", -2, _NowCalcDate()) Link to comment Share on other sites More sharing options...
boogieoompa Posted August 8, 2005 Share Posted August 8, 2005 Sorry about the confusion here is code that, when you are in a program called Wow a dialoge box will pop up if you press i. If you are not in wow you will simply type i. HotKeySet("i", "FunCommand") While 1 Sleep(100) WEnd Func FunCommand() If WinActive("Wow") Then MsgBox(0,"Test", "You are in Wow!!!") Else HotKeySet("i") Send("i") HotKeySet("i", "FunCommand") Endif Endfunc Link to comment Share on other sites More sharing options...
Lemonadez Posted August 8, 2005 Author Share Posted August 8, 2005 thanks now its working i appreciate for all ur help...dunno how to spell i suck at english spelling .... thanks! Link to comment Share on other sites More sharing options...
Thatsgreat2345 Posted August 8, 2005 Share Posted August 8, 2005 lol u spelled appreciate right Link to comment Share on other sites More sharing options...
Lemonadez Posted August 8, 2005 Author Share Posted August 8, 2005 lol u spelled appreciate right<{POST_SNAPBACK}>cuz i google it LOL :D Link to comment Share on other sites More sharing options...
Thatsgreat2345 Posted August 8, 2005 Share Posted August 8, 2005 it would be googled it not google it lol 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