cheez13ii Posted November 29, 2010 Share Posted November 29, 2010 OK! Hi guys.. I'm really new to AutoIt. I just downloaded it and play around for a few hours. "I DID" search google and read up some tutorials but for this i don't know what should i put as a keyword to find my answer. So i hope posting this question in here will help me out. This is my script so far ( lol ) WinWaitActive("eco") HotKeySet("{END}", "close") While 1 Sleep(1000) Send("{F1}") WEnd My purpose is this: = To let it keep 'reapeating' by pressing "F1" every 1 secs. --> yes it work ! However, my problem is this: = This program ( eco.exe ) , i needed it to be open at least 2 or more (multi-client). When i changed from my original.exe to another .exe... the F1 also follow... and it follows everywhere (to IE, firefox, etc.) and i don't want that to happen! What I want to ask and need help is = is there a way for me to rename the process like e.g. eco1 / eco2/ eco3 so i can basically choose the ".exe" that i want the F1 to repeat itself, but not others? and one last question.. the code HotKeySet("{END}", "close")doesn't work for me. What i want is just pressing 'hotkeys' and the script pause (not exit) Thank you ! : ) Link to comment Share on other sites More sharing options...
Realm Posted November 29, 2010 Share Posted November 29, 2010 (edited) Hello cheez13ii, First, Welcome to the AutoIt Forums You really don't need to change the process name in order to achieve what you ask. Just change the Window title which can easily be done with WinSetTitle(). Second, HotKeySet() does not do the action you ask. Rather it assigns a hotkey that will call a custom function within your script. So in your example when the hotkey is being pressed it attempts to look for a function called 'close'. I added this function to your script. I made a few other changes to your script, and commented behind the changes to help you understand what I did. WinSetTitle('eco','','My New Title') ;changes the window title 'eco' to 'My New Title HotKeySet("{END}", "close") ;need to write the function 'close', which it attempts to call. While 1 Sleep(1000) _WinWaitActivate('My New Title') ;this calls my handy little function that I provided below Send("{F1}") WEnd Func close() ;note how the title of this function is the same as the the title the hotkeyset calls for Exit EndFunc Func _WinWaitActivate($title,$text="",$timeout=0) ;I use this function for activating windows, it is a little more handy. WinWait($title,$text,$timeout) ;waits till window process is present If Not WinActive($title,$text) Then WinActivate($title,$text) ;If the window is not active, it will activate it WinWaitActive($title,$text,$timeout) ;waits until window is active and in focus Return WinGetHandle($title,$text) ;if you find a need for the window handle, this function will return the handle. EndFunc Or if you want to rename all the windows but only use F1 on one process then you could do something like this: HotKeySet("{END}", "close") ;need to write the function 'close', which it attempts to call. Local $instances_to_run = 3 For $i = 1 To $instances_to_run Run('eco.exe') _WinWaitActivate('eco') WinSetTitle('eco','','eco' & $i) ;changes the window title 'eco' to 'My New Title Next While 1 Sleep(1000) _WinWaitActivate('eco2') ;this calls my handy little function that I provided below Send("{F1}") WEnd Func close() ;note how the title of this function is the same as the the title the hotkeyset calls for Exit EndFunc Func _WinWaitActivate($title,$text="",$timeout=0) ;I use this function for activating windows, it is a little more handy. WinWait($title,$text,$timeout) ;waits till window process is present If Not WinActive($title,$text) Then WinActivate($title,$text) ;If the window is not active, it will activate it WinWaitActive($title,$text,$timeout) ;waits until window is active and in focus Return WinGetHandle($title,$text) ;if you find a need for the window handle, this function will return the handle.EndFunccHowever, this will attempt to focus, or check to make sure the focus of the window is present every second, so attempting to use your pc while this script is running, while be a challenge, or in otherwords impossible since it utilizes your keyboard. If you are planning on using your pc while this script runs, you may want to look into some Control Funtions such as ControlSend() which does not utilize your keyboard or mouse, allowing you to simultaneously work on the same pc. Good Luck Realm Edited November 29, 2010 by Realm My Contributions: Unix Timestamp: Calculate Unix time, or seconds since Epoch, accounting for your local timezone and daylight savings time. RegEdit Jumper: A Small & Simple interface based on Yashied's Reg Jumper Function, for searching Hives in your registry. Link to comment Share on other sites More sharing options...
cheez13ii Posted November 30, 2010 Author Share Posted November 30, 2010 Thanks a lot Realm, look forward to examine the new script XD. Now i understand about creating my own "close function" within the scripts so that when i recall the hotkeys, it close for me. Would you mind if i ask some more questions? Well what i stated up there is that basically when i run my 1st script (that i posted up there), when i change to firefox (i was using it + searching some information on google on the same time) F1 is the key to create "new tab" on firefox. Basically, tons of new tab come up. lol. What u say on the last bit of paragraph, you mean that if i still use that script and open some other process, the "F1" will keep going and the way to fix it is to look into some Control Functions right? And yeah, i got this renaming process from another person that made a script using Autoit program (he have a GUI interface too). What his script does, no matter how much "eco.exe" are open, let say five. Theres like a drop box and once u click, in drop and list all five of them: eco.exe /11F001234 << with some weirdo number over here, hex number i guess? eco.exe /11F034392 eco.exe /11)349304 eco.exe blah bah eco.exe blah blah and once it drop i just need to pick one of them, then right beside the drop box, it have this button saying "change name". Once I changed it, all the name change to like: eco1.exe eco2.exe and so on PS. to remind again, this is on AutoIT. Now, i think that i need to learn more on using GUI, cause this seem complicate and i'm really bad at math and learning XD (math is complicate, i bomb my exam ) . anyway, thank you for reading and answering this again Link to comment Share on other sites More sharing options...
Realm Posted November 30, 2010 Share Posted November 30, 2010 cheez13ii, What I meant on about running the script, is that every second it will bring the specific window back into focus, and trying to work with other windows or applications is useless. However you should have said your working with web browsers in the first place. That brings other solutions to the front. Instead you should look into the UDF IE.au3, it is well documented in the help file. I generall build my own web browser with _IECreateEmbedded(), and using _IENavigate() to flip directly to specific pages or using _IEClickByText() to click on links. pulling Table info with _IETableGetCollection(). You can manipulate forms and other elements of websites with many of the functions. There is also a UDF for Firefox in the Example section of this Forum. Personally I prefer using the IE.au3 UDF. You only need strong math skills if you are planning on writing complex algorithms. If you have any other questions feel free to post them Realm My Contributions: Unix Timestamp: Calculate Unix time, or seconds since Epoch, accounting for your local timezone and daylight savings time. RegEdit Jumper: A Small & Simple interface based on Yashied's Reg Jumper Function, for searching Hives in your registry. Link to comment Share on other sites More sharing options...
Mobius Posted November 30, 2010 Share Posted November 30, 2010 (edited) ~ Edited March 2, 2011 by Mobius Link to comment Share on other sites More sharing options...
cheez13ii Posted November 30, 2010 Author Share Posted November 30, 2010 uhh ? no? im just coming up with random name... "eco.exe" / "aks.exe" / "rag.exe" / "ini.exe" .... just make it watever u want Link to comment Share on other sites More sharing options...
newbienoobs Posted February 10, 2011 Share Posted February 10, 2011 Does eco.exe = Emil Chronicle Online by any chance?yes it is 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