Post by argy » 22 Feb 2022, 13:41
Hallo
@BoBo
Hatte leider nicht eher gesehen, das du geantwortet hast...
Der Aktuelle Code schaut wie folgt aus:
Code: Select all
;-------------------------------------------------------------------------------
; TonUINO SDcard Manager
; Manage your SD card for your TonUINO
;-------------------------------------------------------------------------------
; AutoHotkey Version: 1.1.x
; Author: Benedikt Schneyer
; Modifier: Rico Giesler
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
#SingleInstance force ; Only one instance at a time
#NoTrayIcon
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
;; ***************
;; global settings
;; ***************
VERSION := "0.12.0"
AUDIOPROMPT := "Wähle einen Ordner aus"
SDPROMPT := "Wähle eine SD-Karte aus"
COPYLOG := "copylog.txt"
;; ***********
;; init config
;; ***********
iniPath := "settings.ini"
IniRead, SDPath, % iniPath, % "User", % "SDpath", % SDPROMPT
IniRead, AudioPath, % iniPath, % "User", % "Audiopath", % AUDIOPROMPT
IniRead, AsAdmin, % iniPath, % "User", % "AsAdmin", 0
IniRead, WithFilename, % iniPath, % "User", % "WithFilename", 1
IniRead, SmartRename, % iniPath, % "User", % "SmartRename", 1
IniRead, Recursive, % iniPath, % "User", % "Recursive", 0
;; ************
;; run as admin
;; ************
if (AsAdmin && not A_IsAdmin)
{
Run *RunAs "%A_ScriptFullPath%"
ExitApp
}
; MsgBox, % id3read("F:\temp\Tonuino\Auf der Baustelle\01 1.mp3","Artist")
;; ***
;; GUI
;; ***
Gui, New, , TonUINO SD Card manager
Gui, Add, Edit, w300 vSDPathEdit disabled, % SDPath
Gui, Add, Button, gselectSDcard X+m, SD-Karte wählen
Gui, Add, Progress, w200 x10 h20 cGreen vSDSpaceProgress BackgroundAAAAAA,
Gui, Add, Text, x+m yp+5 vSDSpace w300, NA
Gui, Add, Tab3, w550 x10 y+10, SD-Karte prüfen|Dateien Kopieren|Einstellungen
Gui, Add, Text, vCheck X+10 w530, SD-Karte ist ok
Gui, Add, Edit, vErrors r10 w530
Gui, Add, Button, gRecheck, Test wiederholen
Gui, Tab, Dateien
Gui, Add, Edit, w420 vAudioPathEdit section x+5 y+5 disabled -Multi R1, % AudioPath
Gui, Add, Button, gselectAudio X+m, Ordner auswählen
Gui, Add, Text, vNextFolder Xs+5, Kopieren nach:
Gui, Add, DropDownList, X+m Yp-3 vTargetFolder AltSubmit, Neu||01|02
Gui, Font, bold
Gui, Add, Text,X20 Y+m h30 , Um Dateien in einen vorhandenen Ordner zu kopieren bitte eine Ordnernummer auswählen
Gui, Font,
Gui, Add, Text,X20 Y+m, (Doppelklick auf eine Zeile schaltet zwischen Kopieren und Überspringen um)
Gui, Add, ListView, xs r10 w530 gLVClick AltSubmit, Modus|Dateiname|Titel|Liednummer|Pfad
LV_ModifyCol(3, "Integer")
LV_ModifyCol(4,0)
Gui, Add, Checkbox, vWithFilename checked%WithFilrename% gSaveIni Xs+5 h25, Originalname an Nummer anhängen
Gui, Add, Checkbox, vSmartRename checked%SmartRename% gSaveIni X+m h25, Smartes umbenennen (Umlaute)
Gui, Add, Checkbox, vRecursive checked%Recursive% gSaveIni X+m h25, Unterordner einbeziehen
Gui, Add, Button, vCopyAudioBut gcopyAudio X20 Y+m, Kopiervorgang starten
Gui, Tab, Einstellungen
Gui, Add, Checkbox, vAsAdmin gSaveIni checked%AsAdmin%, Als Administrator starten (Neustart erforderlich)
Gui, Add, Button, gRestart, TinoTool neu starten
Gui, Tab,
Gui, Add, Link, , <a href="https://github.com/DarthBrento/TinoTool">Projekt auf GitHub</a>
Gui, Add, Text, x+380 , % "Version: " VERSION
Gui, Add, StatusBar,, Fertig
Gui, Show, center autosize, TinoTool
checkSDCard(SDPath)
readFileList(AudioPath)
targetFolder := 1
return
/*
######## ## ## ######## ###### ######## ## ## ########
## ## ## ## ## ## ## ### ## ## ##
## ## ## ## ## ## #### ## ## ##
###### ### ###### ## ###### ## ## ## ## ##
## ## ## ## ## ## ## #### ## ##
## ## ## ## ## ## ## ## ### ## ##
######## ## ## ######## ###### ######## ## ## ########
*/
selectSDcard:
FileSelectFolder, SDPath , ::{20d04fe0-3aea-1069-a2d8-08002b30309d},2, Wähle eine SD-Karte aus
if (SDPath = "")
SDPath := SDPROMPT
GuiControl, , SDPathEdit, % SDPath
IniWrite, % SDpath, % iniPath, % "User", % "SDpath"
checkSDCard(SDPath)
return
selectAudio:
starting := "::{20d04fe0-3aea-1069-a2d8-08002b30309d}"
if (AudioPath != AUDIOPROMPT)
starting := "*" . AudioPath
FileSelectFolder, AudioPath , % starting ,2, Wähle einen Ordner aus
if (AudioPath = "")
AudioPath := AUDIOPROMPT
GuiControl, , AudioPathEdit, % AudioPath
nextFolder := nextFolder(SDPath)
readFileList(AudioPath)
IniWrite, % AudioPath, % iniPath, % "User", % "AudioPath"
return
copyAudio:
Gui, Submit, NoHide
GuiControl, +Disabled, CopyAudioBut
SB_SetText("Kopiere Dateien")
nextFolder := nextFolder(SDPath)
targetFolderName := targetFoldertoPath(SDPath, targetFolder)
; MsgBox, % SDPath . "\" . targetFoldertoPath(SDPath, targetFolder)
FileCreateDir, % SDPath . "\" . targetFolderName
FileList := ""
filesC := LV_GetCount()
; Loop, Files, % AudioPath . "\*.mp3", F
; {
; FileList .= A_LoopFileName . "`n"
; }
; Sort, FileList
srcFilename := ""
nid := 1
Loop, Files, % SDPath . "\" . targetFolderName . "\*"
nid++
srcFolder := ""
Loop, % LV_GetCount()
{
if (nid > 255)
{
MsgBox, % "Fehler: Maximal 255 Dateien pro Ordner möglich"
Return
}
SB_SetText("Kopiere - " . A_Index . "/" . filesC . " nach " . targetFolderName)
LV_GetText(mode,A_Index)
LV_GetText(srcFilename,A_Index,2)
LV_GetText(srcPath,A_Index,5)
folderFile := SubStr(srcPath, InStr(srcPath, "\", false, 0, 2)+1)
folder := SubStr(folderFile,1, InStr(folderFile, "\") - 1)
if (srcFolder != folder)
{
srcFolder := folder
FileAppend, % targetFolderName . " -> " . folder , % COPYLOG
}
if (mode = "überspringen")
continue
filename := Format("{1:03}",nid++)
if (WithFilename) {
repFN := RegExReplace(srcFilename,".mp3","")
if (SmartRename) {
repFN := smartRename(repFN)
}
filename .= "-" . repFN
}
filename .= ".mp3"
FileCopy, % srcPath, % SDPath . "\" . targetFolderName . "\" . filename
}
checkSDCard(SDPath)
GuiControl, -Disabled, CopyAudioBut
SB_SetText("Fertig")
return
LVClick:
If (A_GuiEvent = "A")
{
LV_GetText(mode, A_EventInfo,1)
If (mode = "kopieren")
LV_Modify(A_EventInfo, , "überspringen")
else
LV_Modify(A_EventInfo, , "kopieren")
}
return
targetFoldertoPath(SDPath,targetFolder)
{
; get position of selected element
targetFolder := targetFolder - 1
; if its zero use the new
if (targetFolder = 0)
return nextFolder(SDPath)
Else
return Format("{1:02}",targetFolder)
}
smartRename(str)
{
str := StrReplace(str, "�","ae")
str := StrReplace(str, "�","oe")
str := StrReplace(str, "�","ue")
str := StrReplace(str, "�","ss")
; remove leading digits
str := RegExReplace(str, "^\d+","")
; remove non word characters and convert to camelCase
str := RegExReplace(str, "i)(\W+)(\w)","$U2")
return str
}
nextFolder(SDPath)
{
return Format("{1:02}",nFNumb(SDPath))
}
nFNumb(SDPath)
{
Loop, 99
If not FileExist(SDPath . "\" . Format("{1:02}",A_Index))
return A_Index
}
TargetFolderDropDown(SDPath,preselected)
{
if (preselected = "")
preselected := 1
max := nFNumb(SDPath)
str := "|" . Format("{1:02}",max) . " (Neu)|"
if (preselected = 1)
str .= "|"
Loop, % max - 1
{
str .= Format("{1:02}",A_Index) . "|"
if (A_Index = preselected - 1)
str .= "|"
}
return str
}
checkSDCard(SDPath)
{
Global targetFolder
errors := ""
; check mp3 folder
If not FileExist(SDPath . "\mp3") {
errors .= "Fehlender Ordner: mp3`n"
}
; check advert folder
If not FileExist(SDPath . "\advert") {
errors .= "Fehlender Ordner: advert`n"
}
; check additional folders
Loop, Files, % SDPath . "\*", D
{
If A_LoopFileAttrib contains H,R,S ; Skip any file that is either H (Hidden), R (Read-only), or S (System).
continue ; Skip this file and move on to the next one.
If not RegExMatch(A_LoopFileName,"^(\d\d|advert|mp3)$")
{
errors .= "Ungültiger Ordnername: " A_LoopFileName " - im Hauptverzeichnis`n"
}
}
Loop, Files, % SDPath . "\*", F
errors .= "Ungültige Datei: " A_LoopFileName " - im Hauptverzeichnis`n"
; next folder
nextFolder(SDPath)
; GuiControl, , NextFolder, % "Nächster Ordner: " . nextFolder(SDPath)
GuiControl, , TargetFolder, % TargetFolderDropDown(SDPath,targetFolder)
; skipped folder names
empty := false
Loop, 99
If not FileExist(SDPath . "\" . Format("{1:02}",A_Index))
{
empty := true
}
Else If (empty) {
errors .= "Nicht erreichbarer Ordner: " Format("{1:02}",A_Index) "`n"
}
if (StrLen(errors)) {
GuiControl, Show, Fehler
GuiControl, , Errors, % errors
GuiControl, , Check, Fehler:
} Else {
GuiControl, ,Check, SD-Karte ist ok
GuiControl, Hide, Errors
}
; Drive Space
DriveSpaceFree, freeSpace, % SDPath
DriveGet, cap, Capacity, % SDPath
GuiControl, , SDSpace, % Format("{1:.2f}",freespace/1024) . " GB von " . Format("{1:.2f}",cap/1024) . " GB verfügbar "
GuiControl, , SDSpaceProgress, % 100 - (freespace/cap) * 100
}
readFileList(AudioPath)
{
global recursive
SB_SetText("Dateien lesen")
LV_Delete()
mode := "F"
if (recursive)
mode .= "R"
Loop, Files, % AudioPath . "\*.mp3", % mode
{
LV_Add("", "kopieren", A_LoopFileName, id3read(A_LoopFileFullPath,021),id3read(A_LoopFileFullPath,026),A_LoopFileFullPath)
}
; auto-size
LV_ModifyCol()
; LV_ModifyCol(5, 0)
SB_SetText("Bereit")
}
SaveIni:
Gui, Submit, NoHide
IniWrite, % AsAdmin, % iniPath, % "User", % "AsAdmin"
IniWrite, % WithFilename, % iniPath, % "User", % "WithFilename"
IniWrite, % Recursive, % iniPath, % "User", % "Recursive"
IniWrite, % SmartRename, % iniPath, % "User", % "SmartRename"
readFileList(AudioPath)
Return
GuiClose:
ExitApp
Recheck:
checkSDCard(SDPath)
return
Restart:
Reload
#If !A_IsCompiled
F12::Reload
If A_Scriptname=id3read.ahk
ExitApp
/*
Size ................................... (001): 166 KB
Element Type ........................... (002): MP3 audio format
Change Date ............................ (003): 12/03/2012 21:33
Creation ............................... (004): 12/03/2012 21:33
Last visit ............................. (005): 12/03/2012 21:33
Attributes ............................. (006): A
Recognized type ........................ (009): Audio
Owner .................................. (010): Voyager \ Janeway
Art .................................... (011): Music
Participants interpreters .............. (013): Individual Artist
Album .................................. (014): Album Name
Years .................................. (015): 1998
Genre .................................. (016): Other
Conductors ............................. (017): Conductor
Review ................................. (019): Not rated
Authors ................................ (020): Individual Artist
Title .................................. (021): Title of the song
Copyright .............................. (025): CopyRight
Track number ........................... (026): 1
Length ................................. (027): 00:00:06
Bitrate ................................ (028): 192 kbit / s
Protected .............................. (029): No
Computer ............................... (053): VOYAGER (this computer)
File Name .............................. (155): MP3-object Test.mp3
Released ............................... (173): No
Folder name ............................ (176): Desktop
Folder Path ............................ (177): D: \ system \ desktop
Folder ................................. (178): Desktop (C: \ System)
Path ................................... (180): D: \ WINDOWS \ Desktop \ MP3 object Test.mp3
Type ................................... (182): MP3 audio format
Link status ............................ (188): Unresolved
Encoded by ............................. (193): Encoded by (e.g. LAME)
Editor ................................. (195): Publisher
Subtitle ............................... (196): Subtitle
Album artist ........................... (217): Album Artist
Beats per minute ....................... (219): 120
Composers .............................. (220): Composer
Part of a set .......................... (224): 1
Sequence name .......................... (254): Subtitle
Approval Status ........................ (269): Not released
https://autohotkey.com/board/topic/83376-ahk-l-read-id3-tags-function/
*/
id3read(filename,code)
{
objShell := ComObjCreate("Shell.Application")
SplitPath,filename , ename,edir
oDir := objShell.NameSpace(eDir)
oMP3 := oDir.ParseName(eName)
return oDir.GetDetailsOf(oMP3, code)
}
Hallo [mention]BoBo[/mention]
Hatte leider nicht eher gesehen, das du geantwortet hast...
Der Aktuelle Code schaut wie folgt aus:
[code];-------------------------------------------------------------------------------
; TonUINO SDcard Manager
; Manage your SD card for your TonUINO
;-------------------------------------------------------------------------------
; AutoHotkey Version: 1.1.x
; Author: Benedikt Schneyer
; Modifier: Rico Giesler
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
#SingleInstance force ; Only one instance at a time
#NoTrayIcon
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
;; ***************
;; global settings
;; ***************
VERSION := "0.12.0"
AUDIOPROMPT := "Wähle einen Ordner aus"
SDPROMPT := "Wähle eine SD-Karte aus"
COPYLOG := "copylog.txt"
;; ***********
;; init config
;; ***********
iniPath := "settings.ini"
IniRead, SDPath, % iniPath, % "User", % "SDpath", % SDPROMPT
IniRead, AudioPath, % iniPath, % "User", % "Audiopath", % AUDIOPROMPT
IniRead, AsAdmin, % iniPath, % "User", % "AsAdmin", 0
IniRead, WithFilename, % iniPath, % "User", % "WithFilename", 1
IniRead, SmartRename, % iniPath, % "User", % "SmartRename", 1
IniRead, Recursive, % iniPath, % "User", % "Recursive", 0
;; ************
;; run as admin
;; ************
if (AsAdmin && not A_IsAdmin)
{
Run *RunAs "%A_ScriptFullPath%"
ExitApp
}
; MsgBox, % id3read("F:\temp\Tonuino\Auf der Baustelle\01 1.mp3","Artist")
;; ***
;; GUI
;; ***
Gui, New, , TonUINO SD Card manager
Gui, Add, Edit, w300 vSDPathEdit disabled, % SDPath
Gui, Add, Button, gselectSDcard X+m, SD-Karte wählen
Gui, Add, Progress, w200 x10 h20 cGreen vSDSpaceProgress BackgroundAAAAAA,
Gui, Add, Text, x+m yp+5 vSDSpace w300, NA
Gui, Add, Tab3, w550 x10 y+10, SD-Karte prüfen|Dateien Kopieren|Einstellungen
Gui, Add, Text, vCheck X+10 w530, SD-Karte ist ok
Gui, Add, Edit, vErrors r10 w530
Gui, Add, Button, gRecheck, Test wiederholen
Gui, Tab, Dateien
Gui, Add, Edit, w420 vAudioPathEdit section x+5 y+5 disabled -Multi R1, % AudioPath
Gui, Add, Button, gselectAudio X+m, Ordner auswählen
Gui, Add, Text, vNextFolder Xs+5, Kopieren nach:
Gui, Add, DropDownList, X+m Yp-3 vTargetFolder AltSubmit, Neu||01|02
Gui, Font, bold
Gui, Add, Text,X20 Y+m h30 , Um Dateien in einen vorhandenen Ordner zu kopieren bitte eine Ordnernummer auswählen
Gui, Font,
Gui, Add, Text,X20 Y+m, (Doppelklick auf eine Zeile schaltet zwischen Kopieren und Überspringen um)
Gui, Add, ListView, xs r10 w530 gLVClick AltSubmit, Modus|Dateiname|Titel|Liednummer|Pfad
LV_ModifyCol(3, "Integer")
LV_ModifyCol(4,0)
Gui, Add, Checkbox, vWithFilename checked%WithFilrename% gSaveIni Xs+5 h25, Originalname an Nummer anhängen
Gui, Add, Checkbox, vSmartRename checked%SmartRename% gSaveIni X+m h25, Smartes umbenennen (Umlaute)
Gui, Add, Checkbox, vRecursive checked%Recursive% gSaveIni X+m h25, Unterordner einbeziehen
Gui, Add, Button, vCopyAudioBut gcopyAudio X20 Y+m, Kopiervorgang starten
Gui, Tab, Einstellungen
Gui, Add, Checkbox, vAsAdmin gSaveIni checked%AsAdmin%, Als Administrator starten (Neustart erforderlich)
Gui, Add, Button, gRestart, TinoTool neu starten
Gui, Tab,
Gui, Add, Link, , <a href="https://github.com/DarthBrento/TinoTool">Projekt auf GitHub</a>
Gui, Add, Text, x+380 , % "Version: " VERSION
Gui, Add, StatusBar,, Fertig
Gui, Show, center autosize, TinoTool
checkSDCard(SDPath)
readFileList(AudioPath)
targetFolder := 1
return
/*
######## ## ## ######## ###### ######## ## ## ########
## ## ## ## ## ## ## ### ## ## ##
## ## ## ## ## ## #### ## ## ##
###### ### ###### ## ###### ## ## ## ## ##
## ## ## ## ## ## ## #### ## ##
## ## ## ## ## ## ## ## ### ## ##
######## ## ## ######## ###### ######## ## ## ########
*/
selectSDcard:
FileSelectFolder, SDPath , ::{20d04fe0-3aea-1069-a2d8-08002b30309d},2, Wähle eine SD-Karte aus
if (SDPath = "")
SDPath := SDPROMPT
GuiControl, , SDPathEdit, % SDPath
IniWrite, % SDpath, % iniPath, % "User", % "SDpath"
checkSDCard(SDPath)
return
selectAudio:
starting := "::{20d04fe0-3aea-1069-a2d8-08002b30309d}"
if (AudioPath != AUDIOPROMPT)
starting := "*" . AudioPath
FileSelectFolder, AudioPath , % starting ,2, Wähle einen Ordner aus
if (AudioPath = "")
AudioPath := AUDIOPROMPT
GuiControl, , AudioPathEdit, % AudioPath
nextFolder := nextFolder(SDPath)
readFileList(AudioPath)
IniWrite, % AudioPath, % iniPath, % "User", % "AudioPath"
return
copyAudio:
Gui, Submit, NoHide
GuiControl, +Disabled, CopyAudioBut
SB_SetText("Kopiere Dateien")
nextFolder := nextFolder(SDPath)
targetFolderName := targetFoldertoPath(SDPath, targetFolder)
; MsgBox, % SDPath . "\" . targetFoldertoPath(SDPath, targetFolder)
FileCreateDir, % SDPath . "\" . targetFolderName
FileList := ""
filesC := LV_GetCount()
; Loop, Files, % AudioPath . "\*.mp3", F
; {
; FileList .= A_LoopFileName . "`n"
; }
; Sort, FileList
srcFilename := ""
nid := 1
Loop, Files, % SDPath . "\" . targetFolderName . "\*"
nid++
srcFolder := ""
Loop, % LV_GetCount()
{
if (nid > 255)
{
MsgBox, % "Fehler: Maximal 255 Dateien pro Ordner möglich"
Return
}
SB_SetText("Kopiere - " . A_Index . "/" . filesC . " nach " . targetFolderName)
LV_GetText(mode,A_Index)
LV_GetText(srcFilename,A_Index,2)
LV_GetText(srcPath,A_Index,5)
folderFile := SubStr(srcPath, InStr(srcPath, "\", false, 0, 2)+1)
folder := SubStr(folderFile,1, InStr(folderFile, "\") - 1)
if (srcFolder != folder)
{
srcFolder := folder
FileAppend, % targetFolderName . " -> " . folder , % COPYLOG
}
if (mode = "überspringen")
continue
filename := Format("{1:03}",nid++)
if (WithFilename) {
repFN := RegExReplace(srcFilename,".mp3","")
if (SmartRename) {
repFN := smartRename(repFN)
}
filename .= "-" . repFN
}
filename .= ".mp3"
FileCopy, % srcPath, % SDPath . "\" . targetFolderName . "\" . filename
}
checkSDCard(SDPath)
GuiControl, -Disabled, CopyAudioBut
SB_SetText("Fertig")
return
LVClick:
If (A_GuiEvent = "A")
{
LV_GetText(mode, A_EventInfo,1)
If (mode = "kopieren")
LV_Modify(A_EventInfo, , "überspringen")
else
LV_Modify(A_EventInfo, , "kopieren")
}
return
targetFoldertoPath(SDPath,targetFolder)
{
; get position of selected element
targetFolder := targetFolder - 1
; if its zero use the new
if (targetFolder = 0)
return nextFolder(SDPath)
Else
return Format("{1:02}",targetFolder)
}
smartRename(str)
{
str := StrReplace(str, "�","ae")
str := StrReplace(str, "�","oe")
str := StrReplace(str, "�","ue")
str := StrReplace(str, "�","ss")
; remove leading digits
str := RegExReplace(str, "^\d+","")
; remove non word characters and convert to camelCase
str := RegExReplace(str, "i)(\W+)(\w)","$U2")
return str
}
nextFolder(SDPath)
{
return Format("{1:02}",nFNumb(SDPath))
}
nFNumb(SDPath)
{
Loop, 99
If not FileExist(SDPath . "\" . Format("{1:02}",A_Index))
return A_Index
}
TargetFolderDropDown(SDPath,preselected)
{
if (preselected = "")
preselected := 1
max := nFNumb(SDPath)
str := "|" . Format("{1:02}",max) . " (Neu)|"
if (preselected = 1)
str .= "|"
Loop, % max - 1
{
str .= Format("{1:02}",A_Index) . "|"
if (A_Index = preselected - 1)
str .= "|"
}
return str
}
checkSDCard(SDPath)
{
Global targetFolder
errors := ""
; check mp3 folder
If not FileExist(SDPath . "\mp3") {
errors .= "Fehlender Ordner: mp3`n"
}
; check advert folder
If not FileExist(SDPath . "\advert") {
errors .= "Fehlender Ordner: advert`n"
}
; check additional folders
Loop, Files, % SDPath . "\*", D
{
If A_LoopFileAttrib contains H,R,S ; Skip any file that is either H (Hidden), R (Read-only), or S (System).
continue ; Skip this file and move on to the next one.
If not RegExMatch(A_LoopFileName,"^(\d\d|advert|mp3)$")
{
errors .= "Ungültiger Ordnername: " A_LoopFileName " - im Hauptverzeichnis`n"
}
}
Loop, Files, % SDPath . "\*", F
errors .= "Ungültige Datei: " A_LoopFileName " - im Hauptverzeichnis`n"
; next folder
nextFolder(SDPath)
; GuiControl, , NextFolder, % "Nächster Ordner: " . nextFolder(SDPath)
GuiControl, , TargetFolder, % TargetFolderDropDown(SDPath,targetFolder)
; skipped folder names
empty := false
Loop, 99
If not FileExist(SDPath . "\" . Format("{1:02}",A_Index))
{
empty := true
}
Else If (empty) {
errors .= "Nicht erreichbarer Ordner: " Format("{1:02}",A_Index) "`n"
}
if (StrLen(errors)) {
GuiControl, Show, Fehler
GuiControl, , Errors, % errors
GuiControl, , Check, Fehler:
} Else {
GuiControl, ,Check, SD-Karte ist ok
GuiControl, Hide, Errors
}
; Drive Space
DriveSpaceFree, freeSpace, % SDPath
DriveGet, cap, Capacity, % SDPath
GuiControl, , SDSpace, % Format("{1:.2f}",freespace/1024) . " GB von " . Format("{1:.2f}",cap/1024) . " GB verfügbar "
GuiControl, , SDSpaceProgress, % 100 - (freespace/cap) * 100
}
readFileList(AudioPath)
{
global recursive
SB_SetText("Dateien lesen")
LV_Delete()
mode := "F"
if (recursive)
mode .= "R"
Loop, Files, % AudioPath . "\*.mp3", % mode
{
LV_Add("", "kopieren", A_LoopFileName, id3read(A_LoopFileFullPath,021),id3read(A_LoopFileFullPath,026),A_LoopFileFullPath)
}
; auto-size
LV_ModifyCol()
; LV_ModifyCol(5, 0)
SB_SetText("Bereit")
}
SaveIni:
Gui, Submit, NoHide
IniWrite, % AsAdmin, % iniPath, % "User", % "AsAdmin"
IniWrite, % WithFilename, % iniPath, % "User", % "WithFilename"
IniWrite, % Recursive, % iniPath, % "User", % "Recursive"
IniWrite, % SmartRename, % iniPath, % "User", % "SmartRename"
readFileList(AudioPath)
Return
GuiClose:
ExitApp
Recheck:
checkSDCard(SDPath)
return
Restart:
Reload
#If !A_IsCompiled
F12::Reload
If A_Scriptname=id3read.ahk
ExitApp
/*
Size ................................... (001): 166 KB
Element Type ........................... (002): MP3 audio format
Change Date ............................ (003): 12/03/2012 21:33
Creation ............................... (004): 12/03/2012 21:33
Last visit ............................. (005): 12/03/2012 21:33
Attributes ............................. (006): A
Recognized type ........................ (009): Audio
Owner .................................. (010): Voyager \ Janeway
Art .................................... (011): Music
Participants interpreters .............. (013): Individual Artist
Album .................................. (014): Album Name
Years .................................. (015): 1998
Genre .................................. (016): Other
Conductors ............................. (017): Conductor
Review ................................. (019): Not rated
Authors ................................ (020): Individual Artist
Title .................................. (021): Title of the song
Copyright .............................. (025): CopyRight
Track number ........................... (026): 1
Length ................................. (027): 00:00:06
Bitrate ................................ (028): 192 kbit / s
Protected .............................. (029): No
Computer ............................... (053): VOYAGER (this computer)
File Name .............................. (155): MP3-object Test.mp3
Released ............................... (173): No
Folder name ............................ (176): Desktop
Folder Path ............................ (177): D: \ system \ desktop
Folder ................................. (178): Desktop (C: \ System)
Path ................................... (180): D: \ WINDOWS \ Desktop \ MP3 object Test.mp3
Type ................................... (182): MP3 audio format
Link status ............................ (188): Unresolved
Encoded by ............................. (193): Encoded by (e.g. LAME)
Editor ................................. (195): Publisher
Subtitle ............................... (196): Subtitle
Album artist ........................... (217): Album Artist
Beats per minute ....................... (219): 120
Composers .............................. (220): Composer
Part of a set .......................... (224): 1
Sequence name .......................... (254): Subtitle
Approval Status ........................ (269): Not released
https://autohotkey.com/board/topic/83376-ahk-l-read-id3-tags-function/
*/
id3read(filename,code)
{
objShell := ComObjCreate("Shell.Application")
SplitPath,filename , ename,edir
oDir := objShell.NameSpace(eDir)
oMP3 := oDir.ParseName(eName)
return oDir.GetDetailsOf(oMP3, code)
}[/code]