AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

QuickConverter: Convert Image & Audio Files in Smart way

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions
View previous topic :: View next topic  
Author Message
heresy



Joined: 11 Mar 2008
Posts: 291

PostPosted: Sun Apr 13, 2008 1:05 pm    Post subject: QuickConverter: Convert Image & Audio Files in Smart way Reply with quote




Hello Community
it's my another harvest after learning Autohotkey for 1 month.
i'm still poor, but neat libraries and autohotkey made it possible.
i used FFMPEG and ToPng to realize it. so i would like to send my respect for their effort
and i really like Autohotkey and this forum. as you can see in my post logs, people helped me a lot
so it's my repay to autohotkey community
ok let's resume the thread

QuickConverter is originally part of my ongoing project named qTray
it's supposed to convert Image & Audio files as quickly as possible.
after you set up for once, all you need to do to convert files is pressing single hotkey
no annoying popups, gui, confirm window etc.
It runs in very simple way but also smart way.
you set rules. select files, press hotkey then it checks file extension and go for the way by the rules you've set

Here's supported format list
Supported Image Formats : BMP,CUT,DDS,G3,GIF,HDR,ICO,IFF,LBM,JNG,JPG,JIF,JPEG,JPE,KOA,MNG,PBM,PCD,PCX,PGM,PNG,PPM,PSD,RAS,SGI,TGA,TARGA,TIF,TIFF,WAP,WBMP,WBM,XBM,XPM

Supported Audio Formats: AAC,AC3,AIFF,ALAW,APE,AU,DAUD,DTS,FLAC,TTA,WAV,RM,MP3,OGG

But outputs are limited to few popular formats only
Since ffmpeg is powerful than the limitation i've put.
you can simply add more input formats by editing %AFormats% at line 12

when you run QuickConverter first time.
it gets necessary files from internet and create an ini file.
these files must be in same folder.


Code:
#NoEnv
#Persistent
#SingleInstance Force

;############################## Load Invariables ###############################
7ZIPURL = http://freewares.tistory.com/attachment/ek010000000001.zip
UNZIPURL = http://freewares.tistory.com/attachment/fk030000000000.EXE
FFMPEGURL = http://freewares.tistory.com/attachment/fk030000000001.7z
TOPNGURL = http://freewares.tistory.com/attachment/ek010000000000.zip

IFormats := "BMP,CUT,DDS,G3,GIF,HDR,ICO,IFF,LBM,JNG,JPG,JIF,JPEG,JPE,KOA,MNG,PBM,PCD,PCX,PGM,PNG,PPM,PSD,RAS,SGI,TGA,TARGA,TIF,TIFF,WAP,WBMP,WBM,XBM,XPM"
AFormats := "AAC,AC3,AIFF,ALAW,APE,AU,DAUD,DTS,FLAC,TTA,WAV,RM,MP3,OGG"
StringReplace, Auncompressed, AFormats, `,MP3`,OGG,,
OGGFormat := "OGG(High),OGG(Medium),OGG(Low)"

;############################ DEFAULT INI SETTINGS #############################
INIDEFAULT =
(
[QuickConverter]
Hotkey=F12

[Image]
IEXT=JPG

[Audio]
AEXT1=MP3(320K)
AEXT2=MP3(192K)
AEXT3=WMA(64K)
)

;########################### Read Settings from INI ############################
IfNotExist, QC.INI
FileAppend, %INIDEFAULT%, QC.INI

IniRead, Hotkey, QC.INI, QuickConverter, Hotkey
IniRead, Iext, QC.INI, Image, Iext
IniRead, Aext1, QC.INI, Audio, Aext1
IniRead, Aext2, QC.INI, Audio, Aext2
IniRead, Aext3, QC.INI, Audio, Aext3

Hotkey, %Hotkey%, StartConvert, P1                                ;Assign Hotkey
;############################# Create Tray Menus ###############################
Menu, Tray, NoStandard
Menu, Tray, Color, 999999
Menu, Tray, Add, QuickConverter
Menu, Tray, Add
Menu, Tray, Add, Settings
Menu, Tray, Default, Settings
Menu, Tray, Add, Exit

;########################### Check Thirdparty Files ############################
topng:=FileExist("topng.exe")
ffmpeg:=FileExist("ffmpeg.exe")
ffmpegdll:=FileExist("pthreadGC2.dll")

If (topng && ffmpeg && ffmpegdll)
{
   Return
}
Else                                                ;Get 3rd files from internet
{
   Gui, +AlwaysOnTop -Caption +LastFound
   Gui, Color, 747474
   Gui, Font, CFFFFFF
   Gui, Add, Text, x5 y5, Getting Necessary Files...
   Gui, Show, Center w180 h20
                                                         ;Gather Necessary Files
   URLDownloadToFile, %unzipURL%, unzip.exe
   URLDownloadToFile, %7zipURL%, 7zip.zip
   URLDownloadToFile, %ToPngURL%, topng.zip
   URLDownloadToFile, %FFMPEGURL%, ffmpeg.7z
   Runwait, unzip.exe 7zip.zip 7za.exe,,hide
   Runwait, unzip.exe topng.zip,,hide
   Runwait, 7za.exe e ffmpeg.7z,,hide
   SetTimer, CleanUp, 5000
   Gui, Destroy
   Return
}
Return
;###############################################################################
;############################### Auto Execution End ############################
;###############################################################################

QuickConverter:
Msgbox,,QuickConverter - Convert Media Files in Smart way,QuickConverter is a Frontend converter`nQuickConverter could be realized with following libraries`n`nFFMPEG : http://ffmpeg.mplayerhq.hu/`nFFMPEG Custom Build : http://ffdshow.faireal.net/mirror/ffmpeg/`nToPng : http://www.bcheck.net/apps/#topng`n`nalso great supports in AutoHotkey Forum helped me a lot`nand it's part of my project named qTray (http://qtray.net)`nThanks for using it!
Return

Exit:
Exitapp
Return

;############################## Create Settings GUI ############################
Settings:
Suspend
Gui, Font, CRED Bold
Gui, Add, Text, x6 y10 w120 h10, HOW IT WORKS? :
Gui, Font
Gui, Add, Text, x6 y30 w440 h50, When you select a file or files and hit the hotkey that you selected below`, QuickConverter Converts selected files immediately with specified rules depend on file extension. (image conversion does not affect to size)
Gui, Add, GroupBox, x6 y90 w440 h50, 1) Set Hotkey
Gui, Add, Text, x16 y113 w190 h20, Convert Immediately When I Hit...
Gui, Add, Hotkey, x216 y110 w90 h20 vHotkey, %HotKey%
Gui, Add, Text, x316 y113 w120 h20, With Following Rules

IextList = JPG|PNG|GIF|BMP|TGA|TIF|HDR|PBM|PGM|PPM|WBM|XPM
StringReplace, IextList, IextList, %Iext%|,, ;prevent to double exists
Gui, Add, GroupBox, x6 y150 w440 h50, 2) Conversion Rules for Image Files
Gui, Add, Text, x16 y173 w50 h20, Convert
Gui, Add, Button, x66 y170 w230 h20 gSupportedImageFormats, Every Supported Image Formats
Gui, Add, Text, x306 y173 w20 h20, To
Gui, Add, DropDownList, x336 y170 w100 h20 r100 vIext, %Iext%||%IextList%

Aext1List = MP3(320K)|MP3(256K)|MP3(192K)|MP3(128K)|OGG(High)|OGG(Medium)|OGG(Low)
Aext2List = MP3(320K)|MP3(256K)|MP3(192K)|MP3(128K)
Aext3List = WMA(64K)|WMA(48K)|WMA(32K)
StringReplace, Aext1List, Aext1List, %Aext1%|,,
StringReplace, Aext2List, Aext2List, %Aext2%|,,
StringReplace, Aext3List, Aext3List, %Aext3%|,,
Gui, Add, GroupBox, x6 y210 w440 h110, 3) Conversion Rules for Audio Files
Gui, Add, Text, x16 y233 w50 h20, Convert
Gui, Add, Button, x66 y230 w230 h20 gUncompressedFormats, Every Uncompressed Audio Formats
Gui, Add, Text, x306 y233 w20 h20, To
Gui, Add, DropDownList, x336 y230 w100 h20 r100 vAext1, %AEXT1%||%Aext1list%
Gui, Add, Text, x16 y263 w50 h20, Convert
Gui, Add, Button, x66 y260 w230 h20, OGG
Gui, Add, Text, x306 y263 w20 h20, To
Gui, Add, DropDownList, x336 y260 w100 h20 r100 vAext2, %AEXT2%||%Aext2list%
Gui, Add, Text, x16 y293 w50 h20, Convert
Gui, Add, Button, x66 y290 w230 h20, MP3
Gui, Add, Text, x306 y293 w20 h20, To
Gui, Add, DropDownList, x336 y290 w100 h20 r100 vAext3, %AEXT3%||%Aext3list%

Gui, Add, Button, x6 y330 w200 h30 gSaveSettings, Save Settings
Gui, Add, Button, x256 y330 w190 h30, Cancel
Gui, Show, Center w456 h370, QuickConverter Settings
Return

GuiClose:
Suspend, Off
Gui, Destroy
Return


SupportedImageFormats:
Msgbox,,Supported Image Formats,BMP - Windows or OS/2 Bitmap`nCUT - Dr . Halo`nDDS - DirectX Surface`nG3 - Raw fax format CCITT G.3`nGIF - Graphics Interchange Format`nHDR - High Dynamic Range Image`nICO - Windows Icon`nIFF,LBM - IFF Interleaved Bitmap`nJNG - JPEG Network Graphics`nJPG, JIF, JPEG, JPE - JPEG JFIF Compliant`nKOA - C64 Koala Graphics`nMNG - Multiple Network Graphics`nPBM - Portable Bitmap (ASCII)`nPCD - Kodak PhotoCD`nPCX - Zsoft Paintbrush`nPGM - Portable Greymap (RAW)`nPNG - Portable Network Graphics`nPPM - Portable Pixelmap (ASCII)`nPSD - Adobe Photoshop`nRAS - Sun Raster Image`nSGI - SGI Image Format`nTGA,TARGA - Truevision Targe`nTIF,TIFF - Tagged Image File Format`nWAP,WBMP,WBM - Wireless Bitmap`nXBM - X11 Bitmap Format`nXPM - X11 Pixmap Format
Return

UncompressedFormats:
Msgbox,,Supported Uncompressed Formats,AAC - Advanced Audio Coding`nAC3 - Raw AC3`nAIFF - Audio Interchange File Format`nALAW - PCM A law format`nAPE - Monkey's Audio`nAU - SUN AU Format`nDAUD - D-Cinema Audio Format`nDTS - Raw Digital Theater System`nFLAC - Raw Free Lossless Audio Codec`nTTA - True Audio`nWAV - Waveform Audio Format
Return

SaveSettings:
Gui, Submit
IniWrite, %Hotkey%, QC.INI, QuickConverter, Hotkey
IniWrite, %Iext%, QC.INI, Image, Iext
IniWrite, %Aext1%, QC.INI, Audio, Aext1
IniWrite, %Aext2%, QC.INI, Audio, Aext2
IniWrite, %Aext3%, QC.INI, Audio, Aext3
Reload
Return

ButtonCancel:
Suspend, Off
Gui, Destroy
Return

;################################# Core Mechanism ##############################
STARTCONVERT:
Starttime := A_TickCount
B_Index = 0
{
     TempVar := ClipboardAll
     Clipboard =
     Send ^c
     Clipwait, 1
if ErrorLevel
   {
      ToolTip, 1. Wrong Icons(eg:My Computer) Included in Selection`n2. or pressed Hotkey too fast`n3. Context Menu is up
      SetTimer, CloseToolTip, 4000
      return
   }
   FileName := Clipboard
   Clipboard := TempVar
   
Loop, Parse, FileName, `n, `r
{
   FileGetSize, DumpSize, %A_LoopField%
If DumpSize != 0                                                 ;File or Folder
   {
   SplitPath, A_LoopField,,DIR,ExtCheck,FileName
If ExtCheck in %IFormats%,%AFormats%                            ;Extension Check
{
   If ExtCheck in %IFormats%                            ;If Source is image file
   {
      IfExist,%DIR%\%FILENAME%.%IEXT%                      ;Prevent to Overwrite
      {
         ToolTip, [QC] Same File Name `(%FILENAME%`.%IEXT%`) Exists`, skipped
         SetTimer, CloseToolTip, 3000
         Continue
      }
      Else
      Run, %ComSpec% /c ToPng.exe `"%A_LoopField%`" %Iext%,,Hide  ;Convert Image
   }
   Else If ExtCheck in %AUncompressed% ;If Source is in uncompressed Audio Format List
   {
      IfExist,%DIR%\%FILENAME%.OGG                         ;Prevent to Overwrite
      {
         ToolTip, [QC] Same File Name `(%FILENAME%`.OGG`) Exists`, skipped
         SetTimer, CloseToolTip, 3000
         Continue
      }
      IfExist,%DIR%\%FILENAME%.MP3                         ;Prevent to Overwrite
      {
         ToolTip, [QC] Same File Name `(%FILENAME%`.MP3`) Exists`, skipped
         SetTimer, CloseToolTip, 3000
         Continue
      }
      If Aext1 in %OGGFormat%                              ;If converting to OGG
      {
         ToolTip % "[QC] Converting " FileName "." ExtCheck " to " FileName "." Aext1
         If Aext1 = OGG(High)
         Runwait, %ComSpec% /c ffmpeg.exe -i `"%A_LoopField%`" -acodec libvorbis -aq 255 -ac 2 -y -map_meta_data `"%DIR%`\%FileName%`".OGG`:`"%A_LoopField%`" `"%DIR%`\%FileName%`".OGG,,Hide
         If Aext1 = OGG(Medium)
         Runwait, %ComSpec% /c ffmpeg.exe -i `"%A_LoopField%`" -acodec libvorbis -aq 150 -ac 2 -y -map_meta_data `"%DIR%`\%FileName%`".OGG`:`"%A_LoopField%`" `"%DIR%`\%FileName%`".OGG,,Hide
         If Aext1 = OGG(Low)
         Runwait, %ComSpec% /c ffmpeg.exe -i `"%A_LoopField%`" -acodec libvorbis -aq 100 -ac 2 -y -map_meta_data `"%DIR%`\%FileName%`".OGG`:`"%A_LoopField%`" `"%DIR%`\%FileName%`".OGG,,Hide
      }
      Else                                                 ;If converting to MP3
      {
         StringMid, Aext1Bit, Aext1, 5, 4
         ToolTip % "[QC] Converting " FileName "." ExtCheck " to " Filename "." Aext1
         Runwait, %ComSpec% /c ffmpeg.exe -i `"%A_LoopField%`" -acodec libmp3lame -ab %Aext1Bit% -y -map_meta_data `"%DIR%`\%FileName%`".MP3`:`"%A_LoopField%`" `"%DIR%`\%FileName%`".MP3,,Hide
      }
   }
   Else If ExtCheck = OGG                                 ;If Source is OGG File
   {
      IfExist,%DIR%\%FILENAME%.MP3                         ;Prevent to Overwrite
      {
         ToolTip, [QC] Same File Name `(%FILENAME%`.MP3`) Exists`, skipped
         SetTimer, CloseToolTip, 3000
         Continue
      }
      Else
      {
         StringMid, Aext2Bit, Aext2, 5, 4
         ToolTip % "[QC] Converting " FileName "." ExtCheck " to " Filename "." Aext2
         Runwait, %ComSpec% /c ffmpeg.exe -i `"%A_LoopField%`" -acodec libmp3lame -ab %Aext2Bit% -y -map_meta_data `"%DIR%`\%FileName%`".MP3`:`"%A_LoopField%`" `"%DIR%`\%FileName%`".MP3,,Hide
      }
   }
   Else If ExtCheck = MP3                                 ;If Source is MP3 File
   {
      IfExist,%DIR%\%FILENAME%.WMA                         ;Prevent to Overwrite
      {
         ToolTip, [QC] Same File Name `(%FILENAME%`.WMA`) Exists`, skipped
         SetTimer, CloseToolTip, 3000
         Continue
      }
      Else
      {
         StringMid, Aext3Bit, Aext3, 5, 3
         ToolTip % "[QC] Converting " FileName "." ExtCheck " to " Filename "." Aext3
         Runwait, %ComSpec% /c ffmpeg.exe -i `"%A_LoopField%`" -acodec wmav2 -ab %Aext3Bit% -y -map_meta_data `"%DIR%`\%FileName%`".WMA`:`"%A_LoopField%`" `"%DIR%`\%FileName%`".WMA,,Hide
      }
   }
}
Else
B_Index++
   }
   C_Index := A_Index - B_Index
   ElapsedTime := A_TickCount - StartTime
   ElapsedTime := ElapsedTime / 1000
   StringTrimRight, ElapsedTime, ElapsedTime, 4
   ToolTip % "[QC] Converted total of " C_Index " Files in " ElapsedTime " Secs"
   SetTimer, CloseToolTip, 3000
}
}
Return


CloseToolTip:
SetTimer, CloseToolTip, Off
ToolTip
Return

CleanUP:
SetTimer, CleanUp, Off
FileDelete, unzip.exe
FileDelete, 7zip.zip
FileDelete, topng.zip
FileDelete, ffmpeg.7z
FileDelete, 7za.exe
FileDelete, ffplay.exe
Return


also executable is available here QuickConverter
if you hate seeing tooltips at your mouse cursor, get traytip version here QuickConverter-TrayTipVer (Thanks Cristi® for the suggestion)
Improvements are welcome but the codes are written in very dirty way and not so well commented Sad
Hope you enjoy it. Thanks for reading
and sorry for my poor english


Last edited by heresy on Wed Apr 16, 2008 1:58 am; edited 1 time in total
Back to top
View user's profile Send private message
Cristi®



Joined: 29 Nov 2007
Posts: 26
Location: Romania

PostPosted: Mon Apr 14, 2008 4:44 pm    Post subject: Reply with quote

very impressive,i like it very much Rolling Eyes


my suggestion is to replace ToolTip with TrayTip
_________________
Back to top
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger
BoBo¨
Guest





PostPosted: Mon Apr 14, 2008 4:52 pm    Post subject: Reply with quote

Thanks for sharing this.
Much appreciated. Cool
Back to top
scottmeyer



Joined: 29 Jul 2007
Posts: 13

PostPosted: Mon Apr 14, 2008 9:11 pm    Post subject: Reply with quote

Oh! I am impressed, your program is excellent! Surprised

There are days or ... We are lucky ... There is a pearl, so your program is a pearl rare Razz ^^

Thank you for sharing it. On one extreme simplicity of installation to use.

The genius fate of the man who cultivated ...

Sorry also my English is poor but you have an admirer ^^ Very Happy
Back to top
View user's profile Send private message
CraSH23000



Joined: 22 Jun 2007
Posts: 38

PostPosted: Tue Apr 15, 2008 9:58 pm    Post subject: Reply with quote

Very awesome, the installation and the how fast it is to convert is so simple and quick.

ty very much
_________________
What is real in our infinitely alternating perception of reality?
Back to top
View user's profile Send private message
heresy



Joined: 11 Mar 2008
Posts: 291

PostPosted: Wed Apr 16, 2008 2:06 am    Post subject: Reply with quote

Thanks for the feedbacks guys.
especially Thanks to BoBo, you made me grow Smile

Cristi® wrote:
my suggestion is to replace ToolTip with TrayTip


and Thanks Cristi® for the suggestion.
i've added executable link of TrayTip version
Back to top
View user's profile Send private message
scottmeyer



Joined: 29 Jul 2007
Posts: 13

PostPosted: Wed Apr 30, 2008 9:43 pm    Post subject: Reply with quote

hi!

could you please if you put the code on the forum with the TrayTip?

thank you in advance
Back to top
View user's profile Send private message
heresy



Joined: 11 Mar 2008
Posts: 291

PostPosted: Thu May 01, 2008 8:13 am    Post subject: Reply with quote

scottmeyer wrote:
hi!

could you please if you put the code on the forum with the TrayTip?

thank you in advance


here it is
_________________
Easy WinAPI - Dive into Windows API World
Benchmark your AutoHotkey skills at PlayAHK.com
Back to top
View user's profile Send private message
scottmeyer



Joined: 29 Jul 2007
Posts: 13

PostPosted: Thu May 01, 2008 7:54 pm    Post subject: Reply with quote

Thank you very much for help ! heresy Cool

I admit having had a little lazy ^^

Thank you, I like the community of AutoHotkey Wink

EDIT :

Here is the translation french + TrayTip

VOICI LA TRADUCTION EN FRANCAIS, pour les amateurs de ce superbe p'tit programme héhé :

Code:

#NoEnv
#Persistent
#SingleInstance Force

;                           QUICK CONVERTER
;############################## Load Invariables ###############################
7ZIPURL = http://freewares.tistory.com/attachment/ek010000000001.zip
UNZIPURL = http://freewares.tistory.com/attachment/fk030000000000.EXE
FFMPEGURL = http://freewares.tistory.com/attachment/fk030000000001.7z
TOPNGURL = http://freewares.tistory.com/attachment/ek010000000000.zip

IFormats := "BMP,CUT,DDS,G3,GIF,HDR,ICO,IFF,LBM,JNG,JPG,JIF,JPEG,JPE,KOA,MNG,PBM,PCD,PCX,PGM,PNG,PPM,PSD,RAS,SGI,TGA,TARGA,TIF,TIFF,WAP,WBMP,WBM,XBM,XPM"
AFormats := "AAC,AC3,AIFF,ALAW,APE,AU,DAUD,DTS,FLAC,TTA,WAV,RM,MP3,OGG"
StringReplace, Auncompressed, AFormats, `,MP3`,OGG,,
OGGFormat := "OGG(High),OGG(Medium),OGG(Low)"

;############################ DEFAULT INI SETTINGS #############################
INIDEFAULT =
(
[QuickConverter]
Hotkey=F12

[Image]
IEXT=JPG

[Audio]
AEXT1=MP3(320K)
AEXT2=MP3(192K)
AEXT3=WMA(64K)
)

;########################### Read Settings from INI ############################
IfNotExist, QC.INI
FileAppend, %INIDEFAULT%, QC.INI

IniRead, Hotkey, QC.INI, QuickConverter, Hotkey
IniRead, Iext, QC.INI, Image, Iext
IniRead, Aext1, QC.INI, Audio, Aext1
IniRead, Aext2, QC.INI, Audio, Aext2
IniRead, Aext3, QC.INI, Audio, Aext3

Hotkey, %Hotkey%, StartConvert, P1                                ;Assign Hotkey
;############################# Create Tray Menus ###############################
Menu, Tray, NoStandard
Menu, Tray, Color, 999999                     
Menu, Tray, Add, QuickConverter
Menu, Tray, Add                              
Menu, Tray, Add, Paramètres QuickConverter, Settings
Menu, Tray, Default, Paramètres QuickConverter
Menu, Tray, Add, Exit
;########################### Check Thirdparty Files ############################
topng:=FileExist("topng.exe")
ffmpeg:=FileExist("ffmpeg.exe")
ffmpegdll:=FileExist("pthreadGC2.dll")

If (topng && ffmpeg && ffmpegdll)
{
   Return
}
Else                                                ;Get 3rd files from internet
{
   Gui, +AlwaysOnTop -Caption +LastFound
   Gui, Color, 747474
   Gui, Font, CFFFFFF
   Gui, Add, Text, x5 y5, Récupération des fichiers nécessaire, veuillez patienter...
   Gui, Show, Center  h20
                                                         ;Gather Necessary Files
   URLDownloadToFile, %unzipURL%, unzip.exe
   URLDownloadToFile, %7zipURL%, 7zip.zip
   URLDownloadToFile, %ToPngURL%, topng.zip
   URLDownloadToFile, %FFMPEGURL%, ffmpeg.7z
   Runwait, unzip.exe 7zip.zip 7za.exe,,hide
   Runwait, unzip.exe topng.zip,,hide
   Runwait, 7za.exe e ffmpeg.7z,,hide
   SetTimer, CleanUp, 5000
   Gui, Destroy
   Return
}
Return
;###############################################################################
;############################### Auto Execution End ############################
;###############################################################################
QuickConverter:
Msgbox,,QuickConverter - Convert Media Files in Smart way,QuickConverter is a Frontend converter`nQuickConverter could be realized with following libraries`n`nFFMPEG : http://ffmpeg.mplayerhq.hu/`nFFMPEG Custom Build : http://ffdshow.faireal.net/mirror/ffmpeg/`nToPng : http://www.bcheck.net/apps/#topng`n`nalso great supports in AutoHotkey Forum helped me a lot`nand it's part of my project named qTray (http://qtray.net)`nThanks for using it!
Return

Exit:
Exitapp
Return

;############################## Create Settings GUI ############################
Settings:
Suspend
Gui, Font, CRED Bold s7
Gui, Add, Text, x6 y10 w220 h20, COMMENT CA FONCTIONNE ?
Gui, Font
Gui, Add, Text, x6 y40 w440 h50, Sélectionnez un ou plusieurs fichiers et appuyez sur la touche de raccourci pour lancer la conversion ! Définissez le format de sortie avant la convertion.
Gui, Add, GroupBox, x6 y90 w440 h50, 1) Configuration de la touche de raccourci :
Gui, Add, Text, x16 y113 w190 h20, Raccourci qui lance la conversion
Gui, Add, Hotkey, x216 y110 w90 h20 vHotkey, %HotKey%
Gui, Add, Text, x316 y105 w120 h25, avec les paramètres ci-dessous :

IextList = JPG|PNG|GIF|BMP|TGA|TIF|HDR|PBM|PGM|PPM|WBM|XPM
StringReplace, IextList, IextList, %Iext%|,, ;prevent to double exists
Gui, Add, GroupBox, x6 y150 w440 h50, 2) Régles de conversion pour les fichiers image :
Gui, Add, Text, x16 y173  h20, Convertir les
Gui, Add, Button, x86 y170 w210 h20 gSupportedImageFormats, Formats d'image supportés
Gui, Add, Text, x306 y173 w20 h20, en
Gui, Add, DropDownList, x336 y170 w100 h20 r100 vIext, %Iext%||%IextList%

Aext1List = MP3(320K)|MP3(256K)|MP3(192K)|MP3(128K)|OGG(High)|OGG(Medium)|OGG(Low)
Aext2List = MP3(320K)|MP3(256K)|MP3(192K)|MP3(128K)
Aext3List = WMA(64K)|WMA(48K)|WMA(32K)
StringReplace, Aext1List, Aext1List, %Aext1%|,,
StringReplace, Aext2List, Aext2List, %Aext2%|,,
StringReplace, Aext3List, Aext3List, %Aext3%|,,
Gui, Add, GroupBox, x6 y210 w440 h110, 3) Conversion Rules for Audio Files
Gui, Add, Text, x16 y233  h20, Convertir les
Gui, Add, Button, x86 y230 w210 h20 gUncompressedFormats, Tous les formats audio non-compressés
Gui, Add, Text, x306 y233 w20 h20, en
Gui, Add, DropDownList, x336 y230 w100 h20 r100 vAext1, %AEXT1%||%Aext1list%
Gui, Add, Text, x16 y263  h20, Convertir les
Gui, Add, Button, x86 y260 w210 h20, OGG
Gui, Add, Text, x306 y263 w20 h20, en
Gui, Add, DropDownList, x336 y260 w100 h20 r100 vAext2, %AEXT2%||%Aext2list%
Gui, Add, Text, x16 y293  h20, Convertir les
Gui, Add, Button, x86 y290 w210 h20, MP3
Gui, Add, Text, x306 y293 w20 h20, en
Gui, Add, DropDownList, x336 y290 w100 h20 r100 vAext3, %AEXT3%||%Aext3list%

Gui, Add, Button, x6 y330 w200 h30 gSaveSettings, Sauver les paramétres
Gui, Add, Button, x256 y330 w190 h30, Annuler
Gui, Show, Center w456 h370, QuickConverter Settings
Return

GuiClose:
Suspend, Off
Gui, Destroy
Return


SupportedImageFormats:
Msgbox,,Formats d'image supportés,BMP - Windows or OS/2 Bitmap`nCUT - Dr . Halo`nDDS - DirectX Surface`nG3 - Raw fax format CCITT G.3`nGIF - Graphics Interchange Format`nHDR - High Dynamic Range Image`nICO - Windows Icon`nIFF,LBM - IFF Interleaved Bitmap`nJNG - JPEG Network Graphics`nJPG, JIF, JPEG, JPE - JPEG JFIF Compliant`nKOA - C64 Koala Graphics`nMNG - Multiple Network Graphics`nPBM - Portable Bitmap (ASCII)`nPCD - Kodak PhotoCD`nPCX - Zsoft Paintbrush`nPGM - Portable Greymap (RAW)`nPNG - Portable Network Graphics`nPPM - Portable Pixelmap (ASCII)`nPSD - Adobe Photoshop`nRAS - Sun Raster Image`nSGI - SGI Image Format`nTGA,TARGA - Truevision Targe`nTIF,TIFF - Tagged Image File Format`nWAP,WBMP,WBM - Wireless Bitmap`nXBM - X11 Bitmap Format`nXPM - X11 Pixmap Format
Return

UncompressedFormats:
Msgbox,,Formats audio non-compressés,AAC - Advanced Audio Coding`nAC3 - Raw AC3`nAIFF - Audio Interchange File Format`nALAW - PCM A law format`nAPE - Monkey's Audio`nAU - SUN AU Format`nDAUD - D-Cinema Audio Format`nDTS - Raw Digital Theater System`nFLAC - Raw Free Lossless Audio Codec`nTTA - True Audio`nWAV - Waveform Audio Format
Return

SaveSettings:
Gui, Submit
IniWrite, %Hotkey%, QC.INI, QuickConverter, Hotkey
IniWrite, %Iext%, QC.INI, Image, Iext
IniWrite, %Aext1%, QC.INI, Audio, Aext1
IniWrite, %Aext2%, QC.INI, Audio, Aext2
IniWrite, %Aext3%, QC.INI, Audio, Aext3
Reload
Return

ButtonAnnuler:
Suspend, Off
Gui, Destroy
Return

;################################# Core Mechanism ##############################
STARTCONVERT:
Starttime := A_TickCount
B_Index = 0
{
     TempVar := ClipboardAll
     Clipboard =
     Send ^c
     Clipwait, 1
if ErrorLevel
   {
      TrayTip,QuickConverter,1. Mauvaise icône (ex:Mon Ordinateur) inclut dans la selection`n2. ou vous avez appuyé sur le raccourci trop rapidement`n3. Le menu contextuel est affiché,10,3
      return
   }
   FileName := Clipboard
   Clipboard := TempVar
   
Loop, Parse, FileName, `n, `r
{
   FileGetSize, DumpSize, %A_LoopField%
If DumpSize != 0                                                 ;File or Folder
   {
   SplitPath, A_LoopField,,DIR,ExtCheck,FileName
If ExtCheck in %IFormats%,%AFormats%                            ;Extension Check
{
   If ExtCheck in %IFormats%                            ;If Source is image file
   {
      IfExist,%DIR%\%FILENAME%.%IEXT%                      ;Prevent to Overwrite
      {
         TrayTip,QuickConverter,Le fichiers nommé (%FILENAME%.%IEXT%) existe déjà`, fichier passé,10,3
         Continue
      }
      Else
      Run, %ComSpec% /c ToPng.exe `"%A_LoopField%`" %Iext%,,Hide  ;Convert Image
   }
   Else If ExtCheck in %AUncompressed% ;If Source is in uncompressed Audio Format List
   {
      IfExist,%DIR%\%FILENAME%.OGG                         ;Prevent to Overwrite
      {
         TrayTip,QuickConverter,Le fichiers nommé (%FILENAME%.OGG) existe déjà`, fichier passé,10,3
         Continue
      }
      IfExist,%DIR%\%FILENAME%.MP3                         ;Prevent to Overwrite
      {
         TrayTip,QuickConverter,Le fichiers nommé (%FILENAME%.MP3) existe déjà`, fichier passé,10,3
         Continue
      }
      If Aext1 in %OGGFormat%                              ;If converting to OGG
      {
         TrayTip,CONVERSION EN COURS ...,Conversion %FileName%.%ExtCheck% en %FileName%.%Aext1%,10
         If Aext1 = OGG(High)
         Runwait, %ComSpec% /c ffmpeg.exe -i `"%A_LoopField%`" -acodec libvorbis -aq 255 -ac 2 -y -map_meta_data `"%DIR%`\%FileName%`".OGG`:`"%A_LoopField%`" `"%DIR%`\%FileName%`".OGG,,Hide
         If Aext1 = OGG(Medium)
         Runwait, %ComSpec% /c ffmpeg.exe -i `"%A_LoopField%`" -acodec libvorbis -aq 150 -ac 2 -y -map_meta_data `"%DIR%`\%FileName%`".OGG`:`"%A_LoopField%`" `"%DIR%`\%FileName%`".OGG,,Hide
         If Aext1 = OGG(Low)
         Runwait, %ComSpec% /c ffmpeg.exe -i `"%A_LoopField%`" -acodec libvorbis -aq 100 -ac 2 -y -map_meta_data `"%DIR%`\%FileName%`".OGG`:`"%A_LoopField%`" `"%DIR%`\%FileName%`".OGG,,Hide
      }
      Else                                                 ;If converting to MP3
      {
         StringMid, Aext1Bit, Aext1, 5, 4
         TrayTip,CONVERSION EN COURS ...,Conversion %FileName%.%ExtCheck% en %Filename%.%Aext1%
         Runwait, %ComSpec% /c ffmpeg.exe -i `"%A_LoopField%`" -acodec libmp3lame -ab %Aext1Bit% -y -map_meta_data `"%DIR%`\%FileName%`".MP3`:`"%A_LoopField%`" `"%DIR%`\%FileName%`".MP3,,Hide
      }
   }
   Else If ExtCheck = OGG                                 ;If Source is OGG File
   {
      IfExist,%DIR%\%FILENAME%.MP3                         ;Prevent to Overwrite
      {
         TrayTip,QuickConverter,Le fichiers nommé (%FILENAME%.MP3) existe déjà`, fichier passé,10,3
         Continue
      }
      Else
      {
         StringMid, Aext2Bit, Aext2, 5, 4
         TrayTip,CONVERSION EN COURS ...,Conversion %FileName%.%ExtCheck% en %Filename%.%Aext2%
         Runwait, %ComSpec% /c ffmpeg.exe -i `"%A_LoopField%`" -acodec libmp3lame -ab %Aext2Bit% -y -map_meta_data `"%DIR%`\%FileName%`".MP3`:`"%A_LoopField%`" `"%DIR%`\%FileName%`".MP3,,Hide
      }
   }
   Else If ExtCheck = MP3                                 ;If Source is MP3 File
   {
      IfExist,%DIR%\%FILENAME%.WMA                         ;Prevent to Overwrite
      {
         TrayTip,QuickConverter,Le fichiers nommé (%FILENAME%.WMA) existe déjà`, fichier passé,10,3
         Continue
      }
      Else
      {
         StringMid, Aext3Bit, Aext3, 5, 3
         TrayTip,CONVERSION EN COURS ...,Conversion %FileName%.%ExtCheck% en %Filename%.%Aext3%,10,
         Runwait, %ComSpec% /c ffmpeg.exe -i `"%A_LoopField%`" -acodec wmav2 -ab %Aext3Bit% -y -map_meta_data `"%DIR%`\%FileName%`".WMA`:`"%A_LoopField%`" `"%DIR%`\%FileName%`".WMA,,Hide
      }
   }
}
Else
B_Index++
   }
   C_Index := A_Index - B_Index
   ElapsedTime := A_TickCount - StartTime
   ElapsedTime := ElapsedTime / 1000
   StringTrimRight, ElapsedTime, ElapsedTime, 4
   TrayTip,FIN DE LA CONVERSION,Conversion de %C_Index% Fichiers en %ElapsedTime% Secs,10,1
}
}
Return

CleanUP:
SetTimer, CleanUp, Off
FileDelete, unzip.exe
FileDelete, 7zip.zip
FileDelete, topng.zip
FileDelete, ffmpeg.7z
FileDelete, 7za.exe
FileDelete, ffplay.exe
Return
Back to top
View user's profile Send private message
garry



Joined: 19 Apr 2005
Posts: 1033
Location: switzerland

PostPosted: Fri May 02, 2008 3:11 pm    Post subject: Reply with quote

rien comprendre scottmeyer / nix verstaan Smile
aarrgh thanks, merci pour traduire
thank you heresy , very nice and easy to use
here some ideas (no time to test)
Code:
--- How convert flv2mpg or flv to other formats:
http://www.mydigitallife.info/2006/12/14/free-online-flv-converters/
http://www.mplayerhq.hu/design7/dload.html ,example:
mencoder input.flv -ofps 15 -vf scale=300:-2 -oac lavc -ovc lavc -lavcopts vcodec=msmpeg4v2:acodec=mp3:abitrate=64 -o output.avi
Back to top
View user's profile Send private message
heresy



Joined: 11 Mar 2008
Posts: 291

PostPosted: Sat May 03, 2008 2:52 pm    Post subject: Reply with quote

scottmeyer wrote:
Here is the translation french + TrayTip


hey, i didn't expect that my little script would be translated into another language Very Happy
thanks for the translation it would be much helpful for french people.
i can guess that it's painful while translating on code.
when my major project done that i mentioned on first post
it'll be INI based. so translation can be done much easier
once again, thanks for the translation.

and garry
you don't need mencoder since included ffmpeg can do the job too
but i didn't implemented video conversion feature because it takes too long.
if it would handle video files too. showing realtime progress feature must be preceded i think.
and people want to control various options when they converting video files.
but i would also consider to implement only few video conversion feature for whom using mobile hardwares.
thanks for suggestion
_________________
Easy WinAPI - Dive into Windows API World
Benchmark your AutoHotkey skills at PlayAHK.com
Back to top
View user's profile Send private message
garry



Joined: 19 Apr 2005
Posts: 1033
Location: switzerland

PostPosted: Sat May 03, 2008 6:27 pm    Post subject: Reply with quote

thank you heresy , I never used ffmpeg , seems interesting
here small freeware converters (uses also ffmpeg) :
http://www.dvdvideosoft.com/free-dvd-video-software.htm
http://www.dvdvideosoft.com/guides/dvd/download-YouTube-video-to-pc-computer-hard-drive.htm
Quote:
All free software:

* Free YouTube to iPod and PSP Converter 3.1.1.1(now with batch mode support)
* Free Video Dub 1.4.1.1(recently updated)
* Free Audio Dub 1.4.1.1(recently updated)
* Free Video to Flash Converter 4.1.1.1(now with batch mode support and preset editor)
* Free YouTube to MP3 Converter 3.1.1.1(now with batch mode support)
* Free DVD Decrypter 1.3.2.1(recently updated)
* Free 3GP Video Converter 3.1.1.1(now with batch mode support)
* Free Video Flip and Rotate 1.4.1.1(recently updated)
* Free YouTube Download 2.2.1.1(now with batch mode support)
* Free YouTube Uploader 2.2.1.1(now with batch mode support)
* Free Video to iPod and PSP Converter 3.1.1.1(now with batch mode support)
* Free Video to iPhone Converter 2.1.1.1(now with batch mode support)
* Free Video to MP3 Converter 3.1.1.1(now with batch mode support)
* Free Video to JPG Converter 1.4.1.1(recently updated)
* Free YouTube to iPhone Converter 2.1.1.1(now with batch mode support)
* Free Studio Manager 3.1.1.1(recently updated)

Free online service:

* Free Online Service to Download Video from YouTube and Google(major update)

Freeware of third-party developers:

* Free DVD Player(just released)
* Free DVDFab Decrypter(just released)
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group