Abacusrex Posted January 26, 2012 Share Posted January 26, 2012 Hello, Autoit forum members!I have a somewhat complicated program I would like to execute. I'll write the algorithm (is algorithm the right word?) down and you can tell me if Autoit will actually be able to achieve what I desire. If it does, I would really appreciate any help so I could get the program up and running as soon as possible. Alright, to start off I'll explain what the program will be used for. I have an entertainment room (Panasonic GT30 65" plasma, blu-ray, surround-system, etc...) and recently I got my computer a new graphics card and have been playing video games using that, instead of my Xbox 360. I routed a cable from my PC to my entertainment room and was able to get my games working with my entertainment system. The problem is bringing a keyboard and mouse into the entertainment room is clunky and bothersome. My computer is in a separate room. What I would like to do is use my Xbox 360 controller. I bought an Xbox 360 PC receiver and it works great. I can now use one of my wireless Xbox 360 controller with my computer in the entertainment room. I downloaded a program called Xpadder which allows me to emulate a keyboard/mouse on the Xbox 360 controller. I also downloaded a program called XBMC (Xbox Media Center) which makes for easy navigation with the Xbox 360 controller due to it's Xbox 360 dashboard type design. I use Xpadder to control the Xbox 360 controller from within XBMC. Here's where it gets tricky. There are some games (Just Cause 2...) that I prefer to use a controller with. The problem is if I launched Just Cause 2 with Xpadder running in the background Just Cause 2's internal Xbox 360 configuration gets totally messed up and the game becomes unplayable. My algorithm or what I want to accomplish with this program:Windows starts and proceeds to the desktop. Autoit is part of the start up programs.Autoit has the program ready but doesn't execute it yet.By presssing A on the Xbox 360 controller executes the Autoit program which in turn launches Xpadder and then XBMC. (I use the X360's A button to start so as not to accidentally hit one of the analog sticks and have the program execute).Having control of XBMC I would like to play a game now. I launch Just Cause 2. I would like Autoit to close/minimize XBMC and close Xpadder. That will allow me to play Just Cause 2 without have Xpadder interfere.On exiting of the game Autoit should re-launch Xpadder and re-open/maximize XBMC.If I want to use the computer in my room with a mouse/keyboard by pressing the Right Mouse Button will close/minimize XBMC and either close Xpadder or minimize it--that depends on which would require more code.I believe that's it. I'll add on to it if I remember more. Let me know what you all think. THANKS! Link to comment Share on other sites More sharing options...
someone Posted January 26, 2012 Share Posted January 26, 2012 Welcome to the forum. Sounds like something you can definitely accomplish with Autoit. I don't know much though about xpadder, although a quick google shows that it uses the xbox controller to send keypresses to the computer. If that is the case I don't see why autoit can't catch that even (see hotkeyset and ispressed in the help file) and then do whatever you want. I'll try to check back and be as much help as possible, I use XBMC and have a 360 controller I don't really use but hooked up to a media PC, and something like this sounds pretty cool. While ProcessExists('Andrews bad day.exe') BlockInput(1) SoundPlay('Music.wav') SoundSetWaveVolume('Louder') WEnd Link to comment Share on other sites More sharing options...
Abacusrex Posted January 26, 2012 Author Share Posted January 26, 2012 Awesome! What would you recommend I do first, to begin understanding what steps to take? I'm completely lost at the moment. I would also like to do this project so I could share it with others. I know there's a number of other people on XBMC forums that would love to have a program like this. Link to comment Share on other sites More sharing options...
someone Posted January 27, 2012 Share Posted January 27, 2012 Well in a nutshell, you want autoit to monitor processes (so you know when stuff closes, etc), and monitor certain keypresses, and do stuff. For keypresses, your looking at Ispressed in the help file, and for the process stuff you need a loop, and processexists (you could use processwaitclose, but I think that won't be best in the long run). I know it can seem a lot to grasp at first, I would recommend getting a handle on how ispressed works first, because in doing that you will get a basic idea of loops. Don't worry about the controller or XBMC at all at this point. Create a simple test script that will run notepad when the 'A' key is hit. Honestly the example script for ispressed is very close to what you would want. Break it down into small steps. That way, if one piece of it doesn't work like you expect it to, you can post a fully contained reproducer that is relatively SMALL. Having a paragraph of code to look at makes it much easier to get help. Too much code or no code is a pain. Also not having to install things like XBMC or other software to run your code helps. Lastly, talking about gaming per se or coding for bots etc is a no-no. If you can't get game xyz to launch, close or work as expected, try to make a reproducer without the game involved. If you post a topic that says Just Cause 2 won't work with Autoit, you probably won't get much help. Check out what the forum rules say on this if you haven't. Good luck! While ProcessExists('Andrews bad day.exe') BlockInput(1) SoundPlay('Music.wav') SoundSetWaveVolume('Louder') WEnd Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted January 27, 2012 Moderators Share Posted January 27, 2012 Abacusrex,I was asked to take a look at this thread because it mentions games - a sensitive topic here as has already been pointed out.I see no problem with what you want to do in that you are using the script to configure your equipment so it is ready for you to play the game, not actually helping you to play it. But please take care not to stray into the "gamebot" area - we do enforce the Forum Rules strictly. So, to anyone who wants to help you - feel free! M23  Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area  Link to comment Share on other sites More sharing options...
Abacusrex Posted February 11, 2012 Author Share Posted February 11, 2012 Thanks for the help (Someone) I'll start with what you suggested. I have no intention to 'gamebot'. Enough said. I'll keep this updated when I further my progress. Talk to you later. PS: Anyone else wants to add their helping hand, feel free! Link to comment Share on other sites More sharing options...
Abacusrex Posted February 13, 2012 Author Share Posted February 13, 2012 Okay, how would I write code that does this: On exiting of a game a program also exits. Example: I'm playing Just Cause 2, I'm done playing. I exit the game. After I exit, Steam.exe (which is required to run as well) is automatically closed by the Autoit script. Link to comment Share on other sites More sharing options...
Developers Jos Posted February 13, 2012 Developers Share Posted February 13, 2012 (edited) Okay, how would I write code that does this:On exiting of a game a program also exits.Example: I'm playing Just Cause 2, I'm done playing. I exit the game. After I exit, Steam.exe (which is required to run as well) is automatically closed by the Autoit script.edit: Lets how this develops. Edited February 13, 2012 by 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...
Blue_Drache Posted February 13, 2012 Share Posted February 13, 2012 Steam's a launcher. Not a game? Jos: From what I understand, he's not automating the game, but the game platform and wishes to close it after he's finished? The thread was green-lighted by Melba a few posts ago. Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 13, 2012 Moderators Share Posted February 13, 2012 Blue_Drache, I "green-lighted" a question about configuring the OP's equipment - that does not mean that subsequent posts within the same thread on more "sensitive" subjects are also permitted. This new post is getting very close to the limits as it requires interaction - albeit limited - with a game GUI. So as Jos has said - we will wait and see where this thread goes from here. M23  Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area  Link to comment Share on other sites More sharing options...
Blue_Drache Posted February 13, 2012 Share Posted February 13, 2012 @Abacusrex: I'd approach this the same way I'd approach closing any other program. WinClose() if you can get the window's name and/or handle. (Preferred method) If that doesn't work, try ProcessClose() See the help file for the syntax. Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache Link to comment Share on other sites More sharing options...
Abacusrex Posted February 15, 2012 Author Share Posted February 15, 2012 I'm sorry if this is getting to close to a game-cheating-script. It's not intended. I solemnly swear that all the scripting advice I ask for has nothing to do with obtaining an advantage in games. All advice I ask for adheres to automating the game launchers or related applications so as to simplify repetitive tasks. I'll say again: All the scripting information I'm gathering is to be applied outside of games and will not, in anyway, give me an advantage in game either offline or online. The major script I want to write, that is laid out in my original post, is too complex for me to pursue at the moment. I'm trying to build my scripting skills right now with simpler scripts. I asked how to automatically close the Steam.exe process on exit of another game because sometimes I want to switch to the game Battlefield 3 which requires a different game launcher, Orgin.exe. If I'm playing Just Cause 2 the Steam,exe will launch and on the exit of Just Cause 2 will stay activate until manually closed. If I play Battlefield 3 the program Origin.exe has to launch for the game to run. I don't want/need two game library/launchers running simultaneously; hence the reason I wanted to automate both the close of Steam.exe and Origin.exe on exiting of either launcher's games. On that note. I already know how to close the program Blue_Drache, using your methods presented above. What I'm confused about is how tell the Autoit script that the game that's running off of Steam.exe or Origin.exe has closed and that it (Steam.exe/Origin.exe) should close as well. Link to comment Share on other sites More sharing options...
Blue_Drache Posted February 15, 2012 Share Posted February 15, 2012 If ProcessWaitClose("Origin.exe") then _DoSomething() EndIf Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache Link to comment Share on other sites More sharing options...
Abacusrex Posted February 15, 2012 Author Share Posted February 15, 2012 Thanks very much Blue_Drache. It worked perfectly after I fiddled with it for a while. This proves I'll be getting my major project underway a lot faster. I hope the code doesn't trigger any game-cheating-alarms. Here's what I got: ;This script will allow the user the ability to launch games using ;The programs: Steam & Origin and without the need to close the launcher after use. ;At the close of the game on either Steam or Origin, the launcher will self terminate. ;Note: This script does not require both Origin and Steam to run. ;Having one of either program is sufficient. ;Note: Origin self termination will only occur with game: Battlefield 3. Unless further updated. ;Closes Steam.exe on exit of game. While 1 If ProcessExists("GameOverlayUI.exe") Then If ProcessWaitClose("GameOverlayUI.exe") Then ProcessClose("Steam.exe") EndIf EndIf ;kills process: "ESN Sonar". (DICE's useless VOIP program) ProcessClose("SonarHost.exe") ;Closes Origin.exe on exit of Battlefield 3 "Main Menu" (Google Chrome). If ProcessExists("chrome.exe") Then If ProcessWaitClose("chrome.exe") Then ProcessClose("Origin.exe") EndIf EndIf WEnd ;Finished. Link to comment Share on other sites More sharing options...
Abacusrex Posted February 16, 2012 Author Share Posted February 16, 2012 I'm trying to write my main program, but I'm stuck on using the Xbox 360 Controllers "A" button to run the two programs: Xpadder and XBMC. I've looked at _IsPressed and I got it to work for a keyboard and it successfully opened Notepad.exe when I pressed "TAB". I don't know how to apply that to the Xbox 360 controller though. Link to comment Share on other sites More sharing options...
Abacusrex Posted February 18, 2012 Author Share Posted February 18, 2012 Any ideas? Link to comment Share on other sites More sharing options...
Blue_Drache Posted February 18, 2012 Share Posted February 18, 2012 What scancode does it transmit? Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache Link to comment Share on other sites More sharing options...
Abacusrex Posted February 18, 2012 Author Share Posted February 18, 2012 If I understand what you're asking; the scancode is the code that sends information about which button or key has been pressed and sends it to the computer?I'm not sure exactly what it is. Here's a picture of the Xbox 360 controller device properties and Autoit Windows Informer X64:Uploaded with ImageShack.us Link to comment Share on other sites More sharing options...
Blue_Drache Posted February 19, 2012 Share Posted February 19, 2012 You should be able to sniff that with a DLL call. But that's wandering into keylogging territory. Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache Link to comment Share on other sites More sharing options...
Abacusrex Posted February 19, 2012 Author Share Posted February 19, 2012 How would you recommend I proceed? I looked a little bit at key-logging (don't quite understand it), but if that's against Autoit rules than I don't want to go that route. 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