AutoHotkey Community

It is currently May 26th, 2012, 12:43 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: Joiner
PostPosted: December 19th, 2008, 8:17 pm 
Offline

Joined: September 28th, 2005, 2:10 pm
Posts: 39
Location: Pirot
This small app can join up to five mp3 and mpg files and it works quite well for me, but some features are missing.
Modifications and improvements are welcome.
Code:
; Author: Dejan Kostic
; Add the appropriate extension before joining the files.
#NoEnv
#SingleInstance force
#NoTrayIcon
naslov= Joiner
podes=%A_ScriptDir%\settings.ini

GuiB:
Gui,1:-Resize
Gui,1:add,listview, altsubmit vmojlv w470 h180,File name
Gui,1:font, s9 w400
Gui,1: Add, GroupBox, x10 y186 r1.5 w470 Section
Gui,1:add,button,default x20 y202 w90 gdodf vad,Add
Gui,1:add,button,disabled x119 y202 w90 vDsp gspf,Join
Gui,1:add,button,disabled x218 y202 w82 gdel vbrs,Clear all
Gui,1:add,button,x309 y202 w80 grem vrem,Refresh
Gui,1:add,button,x400 y202 w70 vzat gexit,E&xit
Gui,1:add,text, x400 y230,© Dejan Kostic
Gui,1:show,,%naslov%
return

dodf:
IniRead,SourceDir,%podes%,Preferences,SourceDir,%a_mydocuments%
FileSelectFile, sFile, 3,%SourceDir%,Select file, Media files (*.mp3; *.mpeg; *.mpg)
if sFile=
return
if sfile not contains mp3,mpg,mpeg
{
MsgBox,This file type is not supported.
return
}
if sFile <>
{
UkFaj += 1
SFile%UkFaj% = %sFile%
LV_Add("",sfile)
GuiControl,-disabled,dsp
GuiControl,-disabled,brs
GuiControl,-disabled,rem
}
StringGetPos,sp,sfile,`\,R
StringLeft,fold,sfile,%sp%
IniWrite,%fold%,%podes%,Preferences,SourceDir
return

spf:
IniRead,TargetDir,%podes%,Preferences,TargetDir,%A_ScriptDir%
FileSelectFile,izbIme,s 24,%TargetDir%,Save As, Media files (*.mp3; *.mpeg; *.mpg)
if izbIme=
return
if izbime not contains .mpg,.mpeg,.mp3
{
MsgBox,Missing or wrong extension.
return
}
StringGetPos,qp,izbIme,`\,R
StringLeft,tfold,izbIme,%qp%
IniWrite,%tfold%,%podes%,Preferences,TargetDir
FileAppend,
(
copy /b "%sfile1%"+"%sfile2%"+"%sfile3%"+"%sfile4%"+"%sfile5%" "%izbIme%"
),%A_ScriptDir%\mj.bat
SplashTextOn,350,50, Joining..., Joining files`nPlease wait
gosub,jf
sleep,10
splashtextoff
sleep,900
ifexist,%izbime%
gosub,pf
ifnotexist,%izbime%
{
MsgBox, Files cannot be joined.`nFile parameters are probably not equal.
return
}
return

jf:
Runwait, %comspec% /c %a_scriptdir%\mj.bat,,hide useerrorlevel
ifexist, %A_ScriptDir%\mj.bat
FileDelete,%A_ScriptDir%\mj.bat
return

pf:
Gui,1:+disabled
Gui,2:+ToolWindow +E0x40000
Gui,2:font,s8 w400
Gui,2:add,listbox, w400 h50 vdlb readonly, %izbime% has been joined.
Gui,2:add,button,default x125 y69 w65 vclos gclos,Close
Gui,2:add,button,x215 y69 w60,Play
Gui,2:show,center w410 h110,File joining finished
return

2GuiClose:
Clos:
Gui,1:-disabled
Gui,2:destroy
ifwinexist,%naslov%
{
WinActivate,%naslov%
return
}
return

2ButtonPlay:
GuiControl,choose,dlb,%izb%
run,%dlb%%izbime%
return

del:
Gui,submit,nohide
LV_Delete()
reload
return

rem:
reload
return

Exit:
GuiClose:
ExitApp


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 19th, 2008, 9:03 pm 
Offline

Joined: May 2nd, 2006, 11:16 pm
Posts: 800
Location: Greeley, CO
It would be a bonus if you could drag-n-drop your files
and/or multi-select files from the "Select File" screen.

Further, what is the difference between Refresh and Clear All ?...
For me they appear to do the same thing.

Further, still, every test I've run returns the following;

Code:
Files cannot be joined.
File parameters are probably not equal.


I even tried joining an MP3 to itself and got the same result ...
You can't be more equal than identical.

_________________
Image
SoggyDog
Dwarf Fortress:
"The most intriguing game I've ever played."


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 19th, 2008, 11:52 pm 
Quote:
Further, still, every test I've run returns the following;
The error is within the copy commands parameter setting. AFAIK every file needs its own/separate /b flag to be identified as binary file. But I might be wrong 8)

Code:
Run, cmd /k copy /?


Report this post
Top
  
Reply with quote  
 Post subject: Joiner
PostPosted: December 20th, 2008, 11:16 am 
Offline

Joined: September 28th, 2005, 2:10 pm
Posts: 39
Location: Pirot
Below is the original script. Before posting the script I tried to shorten it and probably made a mistake in that process.
I made this 2 or 3 years ago, but haven't had the time to work on it more, so it's half finished. The 'Refresh' button should have been 'Remove file', but I never managed to make that work, so I put Refresh there as a placeholder.
Buttons for moving files up or down in the list were also planned, but never implemented.
Code:
#NoEnv
#SingleInstance force
#NoTrayIcon
naslov= Joiner
podes=%A_ScriptDir%\settings.ini

ifnotexist,%podes%
IniWrite,en,%podes%,SLanguage,ActiveLanguage
IniRead,ActiveLanguage,%podes%,SLanguage,ActiveLanguage
if ActiveLanguage not in en,de,sr
IniWrite,en,%podes%,SLanguage,ActiveLanguage

gosub,initGen

hup=
(

 When saving, you have to add the extension yourself.`n The program allows the joining of up to 9 files at a time.

)

GuiB:
Menu, FileMenu, Add, %Zat%`tALT+F4,exit
Menu, OptionsMenu, Add, %Lang%,pjez
Menu, ?Menu, Add, %hilf%, hilf
Menu, ?Menu, Add,
Menu, ?Menu, Add, %ab%, ab
Menu, MeniBar, Add, %Fle%, :FileMenu
Menu, MeniBar, Add, %Opti%, :OptionsMenu
Menu, MeniBar, Add, ?, :?Menu
Gui,1: Menu, MeniBar
Gui,1:-Resize
Gui,1:add,listview, altsubmit vmojlv w470 h180,%nazf%
Gui,1:font, s9 w400
Gui,1: Add, GroupBox, x10 y186 r1.5 w470 Section
Gui,1:add,button,default x20 y202 w90 gdodf vad,%ad%
Gui,1:add,button,disabled x119 y202 w90 vDsp gspf,%dsp%
Gui,1:add,button,disabled x218 y202 w82 gdel vbrs,%brs%
Gui,1:add,button,x309 y202 w80 grem vrem,%ref%
Gui,1:add,button,x400 y202 w70 vzat gexit,%zat%
Gui,1:add,text, x400 y230,© Dejan Kostic
Gui,1:show,,%naslov%
return

pjez:
Gui,1:+disabled
Gui,4:+OwnDialogs
Gui,4:+ToolWindow +E0x40000
Gui,4:add,groupbox,x10 w205 h52
Gui,4:font,s9 w400
Gui,4:add,text,x17 y30,%langch%:
Gui,4:add, DropDownList,r6 x75 y25 vLangChoice, English||Deutsch|Srpski
Gui,4:font,s8 w400
Gui,4:add,button,x51 y74 w50 gsavelang,OK
Gui,4:add,button,x112 yp w63 gclsvier,%cnl%
Gui,4:show,center w225 h110,%lang%
return

4GuiClose:
clsvier:
Gui,1:-disabled
Gui,4:destroy
return

savelang:
Gui,4:submit
if LangChoice=English
IniWrite,en,%podes%,SLanguage,ActiveLanguage
if LangChoice=Deutsch
IniWrite,de,%podes%,SLanguage,ActiveLanguage
if LangChoice=Srpski
IniWrite,sr,%podes%,SLanguage,ActiveLanguage
gosub, rebuild
return

rebuild:
Gui,4:destroy
Gui,1:submit,nohide
Gui,1:Menu
Menu,FileMenu,Delete
Menu,OptionsMenu,Delete
Menu,?Menu,Delete
Menu,MeniBar,Delete
Gui,1:destroy
Gui,1:-disabled
gosub,initgen
gosub, GuiB
return

InitGen:
IniRead,ActiveLanguage,%podes%,SLanguage,ActiveLanguage
if ActiveLanguage=en
{
fle=&File
opti=&Options
Lang=Change Language
ad=&Add files
dsp=&Join files
brs=&Clear All
ref=Refresh
hilf=Help
zat=E&xit
ab=About...
ab2=About DMJ
langch=Language
nazf=File name
selfile=Select file
unsft=This file type is not supported.
ext=Missing or wrong extension.
splash1=Joining...
splash2=Joining files.
splash3=Please wait.
nojoin=Files cannot be joined.`nFile parameters are probably not equal.
infsuc=has been joined.
clos=Close
cnl=Cancel
fjf=File joining finished
}
if ActiveLanguage=de
{
fle=&Datei
opti=&Optionen
Lang=Sprache ändern
ad=&Hinzufügen
dsp=&Verbinden
brs=&Alles entfernen
ref=Refresh
hilf=Hilfe
zat=Be&enden
ab=Über...
ab2=Über DMJ
langch=Sprache
clos=Schliessen
selfile=Wählen Sie Datei aus
ext=Fehlende oder falsche Endung.
unsft=Dieser Dateityp kann nicht verbunden werden.
splash1=Verbinde...
splash2=Verbinde Dateien.
splash3=Bitte warten.
nojoin=Dateien konnten nicht verbunden werden.`nWahrscheinlich sind Dateiparameter nicht gleich.
infsuc=Datei %izbime% wurde verbunden.
nazf=Dateiname
cnl=Abbrechen
fjf=Verbinden beendet
}
if ActiveLanguage=sr
{
fle=&Datoteka
opti=&Opcije
Lang=Promena jezika
langch=Jezik
ad=Dod&aj
dsp=&Spajanje
brs=&Briši sve
ref=Refresh
hilf=Uputstvo
zat=&Zatvori
ab=O programu...
ab2=O programu DMJ
clos=Zatvori
selfile=Izaberite fajl
ext=Nedostaje ili je pogrešan nastavak.
unsft=Ova vrsta fajla se ne može spajati.
splash1=Povezivanje...
splash2=Povezivanje fajlova.
splash3=Sačekajte malo.
nojoin=Fajlovi nisu mogli biti spojeni.`nVerovatno parametri fajlova nisu isti.
infsuc=Datei %izbime% je povezan.
nazf=Naziv fajla
cnl=Odustani
fjf=Povezivanje završeno
}
return

dodf:
IniRead,SourceDir,%podes%,Preferences,SourceDir,%a_mydocuments%
FileSelectFile, sFile, 3,%SourceDir%,%Selfile%, Media files (*.mp3; *.mpeg; *.mpg)
if sFile=
return
if sfile not contains mp3,mpg,mpeg
{
MsgBox,%unsft%
return
}
if sFile <>
{
UkFaj += 1
SFile%UkFaj% = %sFile%
LV_Add("",sfile)
GuiControl,-disabled,dsp
GuiControl,-disabled,brs
GuiControl,-disabled,rem
}
StringGetPos,sp,sfile,`\,R
StringLeft,fold,sfile,%sp%
IniWrite,%fold%,%podes%,Preferences,SourceDir
return

spf:
IniRead,TargetDir,%podes%,Preferences,TargetDir,%A_ScriptDir%
FileSelectFile,izbIme,s 24,%TargetDir%,Save As, Media files (*.mp3; *.mpeg; *.mpg)
if izbIme=
return
if izbime not contains .mpg,.mpeg,.mp3
{
MsgBox,%ext%
return
}
StringGetPos,qp,izbIme,`\,R
StringLeft,tfold,izbIme,%qp%
IniWrite,%tfold%,%podes%,Preferences,TargetDir
FileAppend,
(
copy /b "%sfile1%"+"%sfile2%"+"%sfile3%"+"%sfile4%"+"%sfile5%"+"%sfile6%"+"%sfile7%"+"%sfile8%"+"%sfile9%" "%izbIme%"
),%A_ScriptDir%\mj.bat
SplashTextOn,350,50, %splash1%, %splash2%`n%splash3%
gosub,jf
sleep,10
splashtextoff
sleep,900
ifexist,%izbime%
gosub,pf
ifnotexist,%izbime%
{
MsgBox, %nojoin%
return
}
return

jf:
Runwait, %comspec% /c %a_scriptdir%\mj.bat,,hide useerrorlevel
ifexist, %A_ScriptDir%\mj.bat
FileDelete,%A_ScriptDir%\mj.bat
return

pf:
Gui,1:+disabled
Gui,2:+ToolWindow +E0x40000
Gui,2:font,s8 w400
Gui,2:add,listbox, w400 h50 vdlb readonly, %izbime% %infsuc%
Gui,2:add,button,default x125 y69 w65 vclos gclos,%clos%
Gui,2:add,button,x215 y69 w60,Play
Gui,2:show,center w410 h110,%fjf%
return

2GuiClose:
Clos:
Gui,1:-disabled
Gui,2:destroy
ifwinexist,%naslov%
{
WinActivate,%naslov%
return
}
return

2ButtonPlay:
GuiControl,choose,dlb,%izb%
run,%dlb%%izbime%
return

del:
Gui,submit,nohide
LV_Delete()
reload
return

rem:
reload
return

Exit:
GuiClose:
ExitApp

hilf:
Gui,1:+disabled
Gui,5:+OwnDialogs
Gui,5:+ToolWindow +E0x40000
Gui,5:font,s11 w700,Comic Sans MS
Gui,5:add,text,x12, Joiner
Gui,5:font,s9 w500, verdana
Gui,5:add,edit,x15 w255 h180 vcbs -E0x200 -wantreturn,%hup%
GuiControl,5: Focus, cbs
Gui,5:add,button,default x120 y230 w50 vcb gzap,OK
Gui,5:show,center w285 h263 vab2,DMJ %hilf%
return

5GuiClose:
zap:
Gui,1:-disabled
Gui,5:destroy
return


ab:
Gui,1:+disabled
Gui,3:+ToolWindow +E0x40000
Gui,3:font,s11 w700,Comic Sans MS
Gui,3:add,text,x12, Joiner
Gui,3:font,s9 w500, verdana
Gui,3:add,text,x12 y40,Version 1.1
Gui,3:add,text,x12 y65,© Dejan Kostic, 2005
Gui,3:add,button,default x68 y95 w56,OK
Gui,3:show,center w195 h135 vab2,%ab2%
return

3GuiClose:
3ButtonOK:
Gui,1:-disabled
Gui,3:destroy
return


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: Bing [Bot] and 23 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group