hasoon2000 Posted February 7, 2012 Share Posted February 7, 2012 I am new to this. I am learning the program. I really suck at it lol. I am trying to make a .bat file when I press a button. All I got so far is this. I will upload the files and hopefully someone can help me. I want to press the CWM 5.0.2.7 and allow it to run the .bat file I created. (This is to make installing custom software for my Android phone a lot easier). If someone can atleast right that one code, I can learn from it and finish the rest. http://www.mediafire.com/file/hhc23d7eg9hb2mc/Files for AutoIt.rar Thanks! InUskAMr 1 Link to comment Share on other sites More sharing options...
hannes08 Posted February 7, 2012 Share Posted February 7, 2012 (edited) You can use Run() to tun .bat files. Edited February 7, 2012 by hannes08 Regards,Hannes[spoiler]If you can't convince them, confuse them![/spoiler] Link to comment Share on other sites More sharing options...
hasoon2000 Posted February 7, 2012 Author Share Posted February 7, 2012 Can you help me link the command to the button? I have a few buttons made but I have no clue to link them. Link to comment Share on other sites More sharing options...
someone Posted February 7, 2012 Share Posted February 7, 2012 Can you post the script? I can't download the file (firewall restrictions). What do you mean, 'link the command to the button'? Like you have an autoit made GUI with a button that when you press you want it to run a bat? If thats correct the help file example for GUIctrlcreatebutton is exactly what you are looking for. While ProcessExists('Andrews bad day.exe') BlockInput(1) SoundPlay('Music.wav') SoundSetWaveVolume('Louder') WEnd Link to comment Share on other sites More sharing options...
hasoon2000 Posted February 7, 2012 Author Share Posted February 7, 2012 Here is the script. I also took a screenshot of the GUI. http://i44.tinypic.com/2zh1408.png;Include Stuff#include <ButtonConstants.au3>#include <GUIConstantsEx.au3>#include <WindowsConstants.au3>#Region ### START Koda GUI section ### Form=c:usersodaidropboxphonesamazeguisourceamaze.kxf$Form1_1_1 = GUICreate("HTC Amaze AIO Kit By Hasoon2000", 615, 438, 192, 124)$Fastboot = GUICtrlCreateButton("Enter Fastboot", 16, 32, 153, 49)$RecoveryTab = GUICtrlCreateGroup("Install Recoveries", 16, 188, 417, 56)$CMW5027 = GUICtrlCreateButton("CWM 5.0.2.7", 32, 206, 89, 25, $BS_NOTIFY)$CWM5504 = GUICtrlCreateButton("CWM 5.5.0.4", 133, 205, 95, 25, $BS_NOTIFY)$TWRP2 = GUICtrlCreateButton("TWRP 2.0.0", 237, 204, 93, 25, $BS_NOTIFY)$Stock = GUICtrlCreateButton("Stock", 336, 204, 82, 25, $BS_NOTIFY)GUICtrlCreateGroup("", -99, -99, 1, 1)$UnlockBootloader = GUICtrlCreateButton("Unlock Bootloader", 440, 96, 145, 57)$BIR = GUICtrlCreateButton("Boot into Recovery", 16, 280, 161, 49)$TokenID = GUICtrlCreateButton("Get Token ID", 194, 29, 161, 57)$Open = GUICtrlCreateButton("Open Folder (Place Unlock_code.bin)", 400, 32, 193, 57)GUISetState(@SW_SHOW)#EndRegion ### END Koda GUI section ###While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $TokenID EndSwitchWEnd;Default VariablesRunWait(@CWM5027 & " /c " & "dataFlash CWM 5.0.2.7.bat") Link to comment Share on other sites More sharing options...
JohnOne Posted February 7, 2012 Share Posted February 7, 2012 (edited) Case $TokenID _Run('pathtowhatever.bat') Edited February 7, 2012 by JohnOne AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
hasoon2000 Posted February 7, 2012 Author Share Posted February 7, 2012 Case $TokenID _Run('pathtowhatever.bat')Didn't work. I received an error message. Link to comment Share on other sites More sharing options...
someone Posted February 7, 2012 Share Posted February 7, 2012 I believe JohnOne meant _rundos...but you should be able to use normal Run too. While ProcessExists('Andrews bad day.exe') BlockInput(1) SoundPlay('Music.wav') SoundSetWaveVolume('Louder') WEnd Link to comment Share on other sites More sharing options...
hasoon2000 Posted February 7, 2012 Author Share Posted February 7, 2012 I believe JohnOne meant _rundos...but you should be able to use normal Run too.Tried rundos as well. I still received an error message. Link to comment Share on other sites More sharing options...
someone Posted February 7, 2012 Share Posted February 7, 2012 ...What are we gonna ask you? can you show your exact run code as well as the error? While ProcessExists('Andrews bad day.exe') BlockInput(1) SoundPlay('Music.wav') SoundSetWaveVolume('Louder') WEnd Link to comment Share on other sites More sharing options...
hasoon2000 Posted February 7, 2012 Author Share Posted February 7, 2012 (edited) Line 55 (File"C:blah blah blah_rundos('datatokenID.bat^ ERRORError: Unknown function name.While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $TokenID _Rundos('datatokenID.bat') EndSwitchWEnd;Default VariablesRunWait(@CWM5027 & " /c " & "dataFlash CWM 5.0.2.7.bat") Edited February 7, 2012 by hasoon2000 Link to comment Share on other sites More sharing options...
someone Posted February 7, 2012 Share Posted February 7, 2012 I'm NOT trying to be unhelpful, only to teach you rather then giving you the answer. Lookup the helpfile for _rundos, and combine what the helpfile example has with the error message... While ProcessExists('Andrews bad day.exe') BlockInput(1) SoundPlay('Music.wav') SoundSetWaveVolume('Louder') WEnd Link to comment Share on other sites More sharing options...
hasoon2000 Posted February 7, 2012 Author Share Posted February 7, 2012 I understand. I am new to this kind of stuff. I went through the helpfile.#include <Process.au3>Local $rc = _RunDos("start Http://www.autoitscript.com")Case $TokenID Local $rc = _RunDos("dataTokenID.bat")I tried #include as well as still got the same error message. Link to comment Share on other sites More sharing options...
someone Posted February 7, 2012 Share Posted February 7, 2012 (edited) You get the same, unknown func error? Can you run the example script for _rundos? I just used _rundos and run to run a .bat file, both worked just fine. Both commands will by default hide the dos window, for normal Run put @sw_show in as the flag to show your bat file as if you double clicked it. For example... run(@desktopdir & "test.bat") works for me Edited February 7, 2012 by someone While ProcessExists('Andrews bad day.exe') BlockInput(1) SoundPlay('Music.wav') SoundSetWaveVolume('Louder') WEnd Link to comment Share on other sites More sharing options...
BrewManNH Posted February 7, 2012 Share Posted February 7, 2012 Seriously, that's all of the code you're going to post? Did you use the line #include <Process.au3> at the top of your script when you used _RunDos? By the way, you can completely eliminate the use of _RunDos by just using this code in your script in it's place. RunWait(@ComSpec & " /C " & "dataTokenID.bat", "", @SW_HIDE) Then you won't need to "#include" any other functions. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
hasoon2000 Posted February 8, 2012 Author Share Posted February 8, 2012 That is all the code there is.I tried "RunWait(@ComSpec & " /C " & "dataTokenID.bat", "", @SW_HIDE)" and no dice.I made a new empty script so I can do the code you provided "run(@desktopdir & "test.bat")" and no dice as well. Link to comment Share on other sites More sharing options...
hasoon2000 Posted February 8, 2012 Author Share Posted February 8, 2012 I am trying to make a toolkit like this http://forum.xda-developers.com/showthread.php?t=1090783 He does not used .bat commands so it makes it harder for me to look at. He posted his source code and I guess I do not understand it. He offers his source code here http://www.mediafire.com/?5gxuw9db66k656i Link to comment Share on other sites More sharing options...
BrewManNH Posted February 8, 2012 Share Posted February 8, 2012 That is all the code there is.I tried "RunWait(@ComSpec & " /C " & "dataTokenID.bat", "", @SW_HIDE)" and no dice.I made a new empty script so I can do the code you provided "run(@desktopdir & "test.bat")" and no dice as well.What exactly is "no dice" supposed to tell us? What didn't work as intended or what error message did you receive?Where is the TokenID.bat file located in relation to where the script is being run from? Have you tried running the batch file with the full path instead of a relative path? If you use the RunWait command without the @SW_HIDE parameter do you get any output in the command window? If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
someone Posted February 8, 2012 Share Posted February 8, 2012 Yeah please be a lot more specific. Separate the bat file not executing the way you intended it to run, and Autoit not running the .bat file at all.Make a dummy bat script with only pause, so you can see when it runs. Do not use the hide flag. Do your bat file(s) execute as you intend when you double click them, or run them from within dos?ALWAYS - what are your error messages and where did they come from. I really like DaleHohm's sig - 'Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?' While ProcessExists('Andrews bad day.exe') BlockInput(1) SoundPlay('Music.wav') SoundSetWaveVolume('Louder') WEnd Link to comment Share on other sites More sharing options...
BrewManNH Posted February 8, 2012 Share Posted February 8, 2012 As a follow up, please click on the very large link in my signature and read it very carefully. You'd be amazed at the responses you receive when you form a coherent question and then describe in detail what your problem is rather than throwing out "no dice". This document that it links to has been translated into at least 19 languages, so hopefully your's is one of them and it won't be a problem to read it carefully. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator 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