 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
Da Rossa
Joined: 06 Dec 2007 Posts: 361
|
Posted: Thu Mar 11, 2010 4:21 pm Post subject: Gui to use ImgBurn in command line |
|
|
Hi folks how u doin?
Here is the deal: I decided that ImgBurn is the best, at least for me, CD/DVD Burning software. And, to make things even easier and reduce the # of user interventions needed, I learnt how to use (for some basic commands) the command line to operate the program.
So I type in CMD something like:
| Quote: | | imgburn /dest G /speed 4x /verify yes /start /log "IBb___%CurrentDateTime%.log" /mode build /src "D:\go" /volumelabel "label_here" |
As you can see, I call the imgburn program and use some switches, which, for a burning app, are pretty intuitive. for example: /dest G means that the destination drive is G:, /speed 4x is the assigned speed, the /volumelabel thing wirtes the disc label and so on.
one of the most important parts is the /mode build, which means that I'm talking about a disc in which I'm going to burn some individual files, but not an image file.
So, using the nicest gui solution (Rajat's SmartGUI Creator), I "painted" this sweet picture:
But it is only sweet and nothing else. That is a gui I created to antecipate the commands I would type in the command prompt. So, looking at the pic, if I choose speed = 4x, mark the options to start but not verify, select the mode = build, type "my disc label" in the label field, then write, at the bigger box in the right, the file list to be burnt, such as:
| Quote: |
E:\Desktop\Direito Penal 25-02-10.txt
E:\Desktop\e-mails da galera da social.txt
E:\Desktop\iburn.jpg
E:\Desktop\músicas-da-biliboard.jpg |
Then the result would be ahk creating a quick bat file with the command, corresponding to the specifications above:
| Quote: | | imgburn /dest G /speed 4x /start /log "IBb___%CurrentDateTime%.log" /mode build /src "!!!" /volumelabel "my disc label" |
So, lets stick to the two main questions for now:
1- please tell me just one example of how to give that gui the proper functionality and the rest I'll learn by example?
2- How to have the filelist above to be added as the source files (files to burn, in /src)?
p.s. you might be asking why I'm doing this, why don't I stick to ImgBurn GUI itself and use the mousebuttons to do it. I tested and this, when properly done and configured, can lead me to the desired result with significant less clicks, plus the ability to add the label more easily and saving the log as I like.
Thanks!
Edit: edited mispelled word above in bold due to the damn hotstrings  _________________ AHK is perfect.
Last edited by Da Rossa on Fri Mar 12, 2010 2:29 am; edited 1 time in total |
|
| Back to top |
|
 |
wooly_sammoth
Joined: 12 May 2009 Posts: 634 Location: Gloucester UK
|
Posted: Thu Mar 11, 2010 5:02 pm Post subject: |
|
|
OK so the first thing you'll want to do is assign variables to each of the controls in your Gui.
that will look something like this
| Code: | Gui, Add, Radio, vSpeed_2X, 2x
Gui, Add, Radio, vSpeed_4x, 4X
|
Give each of the radio buttons, checkboxes and edit controls a uniquely named variable like the example above.
After the Gui section of your script you should create the code that gets executed when the FIRE! button is pressed. The first line of this should be
This will assign a value to each of the variables. For example, a selected radio button will give 1 whereas an unselected on will give 0. Using the variables you can determine which options the user has selected and build your command accordingly.
Hope that makes sense
Any questions just ask  |
|
| Back to top |
|
 |
Murx Guest
|
Posted: Thu Mar 11, 2010 5:47 pm Post subject: |
|
|
| Code: | DriveGet, Drives, List, CDROM
Loop, Parse, Drives
DriveIndex .= A_LoopField "|"
StringReplace, DriveIndex, DriveIndex, |, ||
Gui +OwnDialogs
Gui, Add, DropDownList, x10 y4 w40 vSpeed, 2|4|8||16
Gui, Add, CheckBox, xp+52 yp+6 vCB1 checked, Start
Gui, Add, CheckBox, xp+74 yp vCB2, Verify
Gui, Add, DropDownList, xp-126 yp+24 w98 vMode, Write||Build|Read|Discovery|Verify
Gui, Add, DropDownList, xp+104 yp w98 vDrive,
GuiControl,, Drive, % DriveIndex
Gui, Add, Edit, xp-104 yp+24 w200 h100 ReadOnly -Wrap vFilesToBurn,
Gui, Add, Button, xp+209 yp w60 gSelectFile, Browse
Gui, Add, Edit, xp-209 yp+102 w200 vVolumeLabel, Disc label
Gui, Add, Button, xp+208 yp w60 gFire, Fire!
Gui, Show,, Mr.Burns
Return
SelectFile:
FileSelectFile, SelectedFile, M13, , Open a file, Text Documents (*.txt; *.doc)
if SelectedFile =
Return
Else
GuiControl,, FilesToBurn, % SelectedFile
Return
Fire:
Gui, Submit, NoHide
If (CB1 = 1)
SetStart := "/start"
If (CB2 = 1)
SetVerify := "/verify"
MsgBox, imgburn /dest %Drive% /speed %Speed% %SetStart% %SetVerify% /log "%A_Now%.log" /mode %Mode% /src "%FilesToBurn%" /volumelabel "%VolumeLabel%"
Return | Not tested. |
|
| Back to top |
|
 |
Da Rossa
Joined: 06 Dec 2007 Posts: 361
|
Posted: Mon Mar 15, 2010 1:19 am Post subject: |
|
|
Ok, here we go.
Very nice gui, but the idea is that it should not have drop-down menus as they're nasty...
So here is the gui I created:
GUI
and that text field did not work to add multiple-line texts, which is necessary to add a filelist, like:
| Quote: | D:\site\5 semestre\1 Direito do Trabalho 1\Direito do Trabalho 01-03-10.docx
D:\site\5 semestre\1 Direito do Trabalho 1\Direito do Trabalho 03-03-10.docx
D:\site\5 semestre\1 Direito do Trabalho 1\Direito do Trabalho 22-2-10.docx
D:\site\5 semestre\1 Direito do Trabalho 1\Direito do Trabalho 24-02-10.docx |
...and I have to click the browse button, instead of inputing the filepaths directly through copy-paste...
also, there seems to be a problem with the filepath syntax, prolly in the variable "filestoburn". Note that the files are more likely to have spaces, but you already put inside quotation marks didn't you?
And yes, I changed from "msgbox" to "run" so it could work
But you seem to be in the right way! _________________ AHK is perfect. |
|
| Back to top |
|
 |
Da Rossa
Joined: 06 Dec 2007 Posts: 361
|
Posted: Mon Mar 15, 2010 6:09 pm Post subject: |
|
|
Err sorry, I forgot to upload the .ahk file with the GUI.
Here it is: http://notasdeaula.org/imgburn-gui.ahk
Or
| Code: | Gui, Add, Edit, x296 y40 w370 h190 , Filelist
Gui, Add, Button, x596 y70 w-794 h-116 , +
Gui, Add, DropDownList, x166 y-48 w-70 h108 , DropDownList
Gui, Add, Radio, x746 y-266 w-480 h836 , 2x
Gui, Add, Radio, x56 y70 w60 h20 , 4x
Gui, Add, Radio, x56 y130 w60 h20 , 16x
Gui, Add, Radio, x56 y100 w60 h20 , 8x
Gui, Add, GroupBox, x36 y20 w90 h140 , Speeds
Gui, Add, Text, x146 y250 w70 h20 , Destiny: G:
Gui, Add, CheckBox, x146 y60 w60 h30 , Start
Gui, Add, CheckBox, x146 y90 w60 h30 , Verify
Gui, Add, GroupBox, x136 y20 w140 h140 , Options
Gui, Add, GroupBox, x286 y20 w390 h260 , Files
Gui, Add, Text, x146 y130 w100 h20 , %CurrentDateTime%
Gui, Add, GroupBox, x36 y170 w240 h110 , Modes
Gui, Add, Radio, x-74 y-80 w100 h100 , Radio
Gui, Add, Radio, x-304 y-134 w230 h84 , Radio
Gui, Add, Radio, x-310 y-134 w346 h154 , Radio
Gui, Add, Radio, x46 y190 w70 h20 , Write
Gui, Add, Radio, x46 y210 w70 h20 , Build
Gui, Add, Radio, x46 y230 w70 h20 , Read
Gui, Add, Radio, x146 y190 w70 h20 , Discovery
Gui, Add, Radio, x146 y210 w70 h20 , Verify
Gui, Add, Radio, x56 y40 w60 h20 , 2x
Gui, Add, Button, x566 y240 w100 h30 , FIRE!
Gui, Font, S10 CDefault, Verdana
Gui, Add, Edit, x296 y240 w250 h30 , Disc label
Gui, Font, S10 CDefault, Verdana
; Generated using SmartGUI Creator 4.0
Gui, Show, x230 y544 h304 w719, ImgBurn
Return
GuiClose:
ExitApp |
_________________ AHK is perfect. |
|
| Back to top |
|
 |
Da Rossa
Joined: 06 Dec 2007 Posts: 361
|
Posted: Thu Mar 25, 2010 3:46 pm Post subject: |
|
|
anyone? _________________ AHK is perfect. |
|
| Back to top |
|
 |
SoLong&Thx4AllTheFish
Joined: 27 May 2007 Posts: 4999
|
|
| Back to top |
|
 |
GuestMan Guest
|
Posted: Thu Mar 25, 2010 5:06 pm Post subject: |
|
|
No question here...
The guy just wants someone to do everything for him. |
|
| Back to top |
|
 |
Da Rossa
Joined: 06 Dec 2007 Posts: 361
|
Posted: Fri Mar 26, 2010 12:32 am Post subject: |
|
|
Yeah, it's very nice when an anonymous guest come to an important topic to say stupid things without having the face to identify himself.
Can't you read, mr. GuestMan?
| Quote: | So, lets stick to the two main questions for now:
1- please tell me just one example of how to give that gui the proper functionality and the rest I'll learn by example?
2- How to have the filelist above to be added as the source files (files to burn, in /src)? |
Did you read the expression "just one example"? _________________ AHK is perfect. |
|
| Back to top |
|
 |
wooly_sammoth
Joined: 12 May 2009 Posts: 634 Location: Gloucester UK
|
Posted: Fri Mar 26, 2010 12:37 am Post subject: |
|
|
Have you tried adding variables to your Gui as I suggested in my post?
Follow the example I gave you to give your Gui functionality |
|
| Back to top |
|
 |
Da Rossa
Joined: 06 Dec 2007 Posts: 361
|
Posted: Fri Mar 26, 2010 3:22 am Post subject: |
|
|
One hundred apologies, but I didn't actually notice your first post, wooly_sammoth. Perhaps I saw the almost-done code by Murx and got excited.
So I followed your tips, along with Murx's example to fill the gaps found by my lousy mind.
To make it neater, I ended up with this code:
| Code: | #SingleInstance force
Gui, Add, GroupBox, x286 y20 w390 h260 , Files
Gui, Add, Edit, x296 y40 w370 h190 vFilelist, Filelist
Gui, Add, GroupBox, x36 y20 w90 h140 , Speeds
Gui, Add, Radio, x56 y40 w60 h20 vSpeed2x, 2x
Gui, Add, Radio, x56 y70 w60 h20 vSpeed4x, 4x
Gui, Add, Radio, x56 y100 w60 h20 vSpeed8x, 8x
Gui, Add, Radio, x56 y130 w60 h20 vSpeed16x, 16x
Gui, Add, GroupBox, x136 y20 w140 h140 , Options
Gui, Add, CheckBox, x146 y60 w60 h30 vStart, Start
Gui, Add, CheckBox, x146 y90 w60 h30 vErify, Verify
Gui, Add, GroupBox, x36 y170 w240 h85 , Modes
Gui, Add, Radio, x46 y190 w70 h20 vWrite, Write
Gui, Add, Radio, x46 y210 w70 h20 vBuild, Build
Gui, Add, Radio, x46 y230 w70 h20 vRead, Read
Gui, Add, Radio, x146 y190 w70 h20 vDiscovery, Discovery
Gui, Add, Radio, x146 y210 w70 h20 vErificar, Verify
Gui, Add, Text, x146 y260 w70 h20 , Destiny: G:
Gui, Add, Button, x566 y240 w100 h30 , Fire
Gui, Font, S10 CDefault, Verdana
Gui, Add, Edit, x296 y240 w250 h30 vLabel, Disc label
Gui, Font, S10 CDefault, Verdana
; Generated using SmartGUI Creator 4.0
Gui, Show, x230 y544 h304 w719, ImgBurn
Return
Fire:
Gui, Submit, NoHide
If (vStart = 1)
SetStart := "/start"
If (vErify = 1)
SetVerify := "/verify"
Msgbox, imgburn
return
GuiClose:
ExitApp
|
...which has attributed the variables to the edit, checkbox and radio controls and tried to give functionality to two of the checkboxes (almost like Murx's example). The problem is that clicking the "Fire" button does nothing. I was expecting the simple msgbox with the word "imgburn".
Once I have the Fire button work, I may correct the other things, with some help. _________________ AHK is perfect. |
|
| Back to top |
|
 |
Leef_me
Joined: 08 Apr 2009 Posts: 5336 Location: San Diego, California
|
Posted: Fri Mar 26, 2010 7:14 am Post subject: |
|
|
There is no 'linkage' between the button and the fire routine.
Right now the button on the gui is like a doorbell with wires attached.
Go back and read the description about button (all the way to the "checkbox" subtitle.
http://www.autohotkey.com/docs/commands/GuiControls.htm#Button
While that section, take the time to understand what two ways the button can be linked to the code.
Hint: one method uses the word 'explicit' the other usues the word 'automatic'.
I could easily edit your code for you, or write the answer here.
But if you are willing to go read the section and understand it, you won't easily forget it.
You'll also see that the docs are written very well.
And I suspect you'll find, you would rather go to the docs first because you can find the answer faster. |
|
| Back to top |
|
 |
GuestMan Guest
|
Posted: Fri Mar 26, 2010 9:35 am Post subject: |
|
|
| Quote: | | come to an important topic to say stupid things |
Pathetic...
This task is ridiculously easy.Any noob can do it just by reading the help file and testing a few lines of code.
Pathetic...
Do something yourself for once. |
|
| Back to top |
|
 |
Leef_me
Joined: 08 Apr 2009 Posts: 5336 Location: San Diego, California
|
Posted: Fri Mar 26, 2010 8:42 pm Post subject: |
|
|
| GuestMan wrote: | | Quote: | | come to an important topic to say stupid things |
Pathetic...
This task is ridiculously easy.Any noob can do it just by reading the help file and testing a few lines of code.
Pathetic...
Do something yourself for once. |
Hey GuestMan,
He's a newbie, so what?!
I just looked up maybe 8 threads you've replied to, this is the only one where you are non-helpful.
Why are you being a pain? Or more to the point, please stop being a pain. |
|
| Back to top |
|
 |
GuestMan Guest
|
Posted: Fri Mar 26, 2010 9:51 pm Post subject: |
|
|
I simply don't like parasites.
I was a very active supporter until this forum became infested by parasites.
And he is really a newbie, a professional one, since 2007. |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|