Rav1 Posted April 5, 2014 Share Posted April 5, 2014 Hey gang - I'm new to AutoIT and I'm looking for some help or possible direction. I have created a image restore procedure and using imagex and diskpart that runs off usb. I have a nice batch that runs when the boots off the drive (winpe) that starts the batch file, gives the user a nice disclaimer of about 6 lines of text that says "this is gonna erase all your stuff, etc etc, etc," then prompts for agreement and begins the restore by running diskpart and then imagex with switch options. It works great. I was surfing the web and accidentally came across autoit and it looks really cool. I recently got a job making the desktop images where I work and I feel running these command in Autoit would make my restore process look awesome and it would really make my images stand out. Ive gone through tutorials but its taking me too long to get to where I need to go. What I'm looking for is a popup that says 'do you want to restore' if the user says yes then run imagex and diskpart commands. If no the say 'bye' and exits. Does something that takes 1 hour to learn how to do in a batch file really take 6+ hours (and I haven't learned yet) in autoit? Am I looking in the wrong place? Any1 have any suggestions? Here's my bat file. :choice SET /P ANSWER=Do you want to continue (Type:Yes/No)? echo You chose: %ANSWER% if /i {%ANSWER%}=={yes} (goto :yes) if /i {%ANSWER%}=={no} (goto :no ) ELSE (goto message2) :yes cls echo Begining the upgrade process. This will take 30 minutes to complete. diskpart /s %~dp0script.txt %~dp0imagex.exe /apply %~dp0win7-32bit-admin.wim 4 c: goto bcd :bcd bcdboot c:windows bcdedit /set {default} device partition=c: bcdedit /set {default} osdevice partition=c: bcdedit /set {bootmgr} device partition=c: goto exit :message2 echo Please type yes or no pause cls goto choice :no exit Thought? Rav Link to comment Share on other sites More sharing options...
Developers Jos Posted April 5, 2014 Developers Share Posted April 5, 2014 (edited) Someting like this? (untested) If MsgBox(4,"Continue","Do you want to Continue?") = 7 Then ConsoleWriteError("Bye." & @CRLF) Exit EndIf ; ShellExecuteWait("diskpart","/s " & @ScriptDir & "\script.txt") ShellExecuteWait(@ScriptDir & "\imagex.exe","/s" & @ScriptDir & "\script.txt") ShellExecuteWait("bcdboot", "c:\windows") ShellExecuteWait("bcdedit","/set {default} device partition=c:") ShellExecuteWait("bcdedit","/set {default} osdevice partition=c:") ShellExecuteWait("bcdedit","/set {bootmgr} device partition=c:") Jos Edited April 5, 2014 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...
Rav1 Posted April 5, 2014 Author Share Posted April 5, 2014 Thats great. Thanks. I've been been reading about he messagebox function but it's to small. I thought guicreate would work but I can't figure out how to add text into the box. Basically your script is awersome but the messagebox is too small. My disclaimer is about 6 lines of text. It reads Disclaimer: This will upgrade your workstation to Windows 7. This USB drive can only be used ONCE. When started, this process can not be stopped or reversed. All data on the workstation will be ERASED and will be UNRECOVERABLE. Please ensure that any documents or files that you wish to keep are copied to an external source before continuing. Do you wish to continue? Link to comment Share on other sites More sharing options...
Developers Jos Posted April 5, 2014 Developers Share Posted April 5, 2014 Do you wish to continue? Just wanted to show you how simple it is to code in AutoIt3, but have no intentions to do all coding for you. Look at the helpfile for the GUI functions on how easy it is to create you own gui. 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...
Rav1 Posted April 5, 2014 Author Share Posted April 5, 2014 No worries. My intention wasn't to get you to do any coding for me and as a newcomer to autoit and the forums the last thing I want to do is come across that way. I've been going thru these video tutorials as well as the help file and its been slow going. Ill keep at it though...seems like something I can get into. Thanks Link to comment Share on other sites More sharing options...
Rav1 Posted April 5, 2014 Author Share Posted April 5, 2014 After 2 hours of reading and watching youtube autoit tutorials, I've come to the conclusion that it is too difficult to make autoit display a simple multi-line text box with a yes or no button. I can make scoll bars, and I can make a simple gui box but no where did I find how to add static text to the box. I'm gonna stick with my simple echo batch command. Link to comment Share on other sites More sharing options...
somdcomputerguy Posted April 5, 2014 Share Posted April 5, 2014 GUICtrlCreateLabel - read the Help file. - Bruce /*somdcomputerguy */ If you change the way you look at things, the things you look at change. Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted April 5, 2014 Moderators Share Posted April 5, 2014 (edited) Yup, must be impossible. Couldn't possibly be that you haven't bothered to read the help file: Edited April 5, 2014 by JLogan3o13 "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
Rav1 Posted April 5, 2014 Author Share Posted April 5, 2014 I didn't say it was impossible, I just said it was difficult. No reason to be a douche. "GUICtrlCreateLabel - read the Help file. - " Awesome - thanks! That's what I was looking for. I'll check it out. Link to comment Share on other sites More sharing options...
Palestinian Posted April 5, 2014 Share Posted April 5, 2014 @CRLF adds a new line. MsgBox(0,'','1st line' & @CRLF & '2nd line') Everything you need to know is in the help file, simply search for whatever you want to do using simple English (yes 90% of the time its that easy) and you should be good to go. Link to comment Share on other sites More sharing options...
Rav1 Posted April 5, 2014 Author Share Posted April 5, 2014 I went down the messagebox road a few hours ago and but I wasn't happy with the way it looked when I multilined it. I'm going thru the guictrlcreatelabel and I am experimenting with that, which is not going well and I am going thru the options of the control and learning as I make mistakes. As stated in my first post - I am out of my element when it comes to stuff such as this but it looked cool so I thought I'd give it a try. I'm not getting a very warm welcome from the community tho. Jos and somedcomputerguy were helpful. Link to comment Share on other sites More sharing options...
Palestinian Posted April 5, 2014 Share Posted April 5, 2014 (edited) I went down the messagebox road a few hours ago and but I wasn't happy with the way it looked when I multilined it. I'm going thru the guictrlcreatelabel and I am experimenting with that, which is not going well and I am going thru the options of the control and learning as I make mistakes. As stated in my first post - I am out of my element when it comes to stuff such as this but it looked cool so I thought I'd give it a try. I'm not getting a very warm welcome from the community tho. Jos and somedcomputerguy were helpful. If you want to learn about the GUI you could use this >Form Builder beta to build the GUI, then read about the codes it generates in the help file. Edited April 5, 2014 by Palestinian Link to comment Share on other sites More sharing options...
BrewManNH Posted April 6, 2014 Share Posted April 6, 2014 You should post your attempts for what you're doing, this way we can give you constructive feedback as to how to get it to do what you want. Just make sure whatever you post is at least runnable so we don't have to recreate everything from scratch. 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...
Rav1 Posted April 6, 2014 Author Share Posted April 6, 2014 I have finally created the gui, the labels, the buttons, background color and font. Can someone please tell me how this line should be written or can they point me to a resource that I can use to find my error. ShellExecuteWait(@ScriptDir & "imagex.exe","/apply" & @ScriptDir & "win7-32bit-ADMIN.wim 1 c:") Thanks Link to comment Share on other sites More sharing options...
BrewManNH Posted April 6, 2014 Share Posted April 6, 2014 Probably needs a space at the end of /apply and before the closing quote, this way there's a space between the parameter and the file name. 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...
Solution Rav1 Posted April 6, 2014 Author Solution Share Posted April 6, 2014 That was it. Thanks for the help. Link to comment Share on other sites More sharing options...
Developers Jos Posted April 6, 2014 Developers Share Posted April 6, 2014 I'm not getting a very warm welcome from the community tho. Jos and somedcomputerguy were helpful. Depends how you look at this. Nobody really said anything wrong other than repeat what you stated out of frustration. When it comes to the responses in this forum I think you got good feedback in a short time. "GUICtrlCreateLabel - read the Help file. - " Awesome - thanks! That's what I was looking for. I'll check it out. Did I already point you to the Helpfile GUI functions in my second reply?... and you choose to do the lengthy "lets watch youtube" route. Next time just ask instead of getting frustrated and demonstrate you are willing to learn and put some effort in... you will see you get a long way in a short time. Cheers Jos JLogan3o13 1 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...
Rav1 Posted April 6, 2014 Author Share Posted April 6, 2014 There is a big difference between "read the help file" and someone stating the control that I need to investigate. Also I reached out asking if anyone had any suggestions on where to begin and I even stated what sources I was using to find information. You could have stated that using youtube was a bad choice. While I realize that I was the one who began learning via youtube tutorials, I did reach out to the community for suggestions on where to begin. the guictrlcreatelabel control was what i needed to begin. "Next time just ask instead of getting frustrated and demonstrate you are willing to learn and put some effort in" I asked how to begin in my first post.......you are only proving my point. There is no reason to go on any further as the issue is resolved and now I am having fun with Autoit. 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