Jump to content

Request for help for setting Track Number


Aadi
 Share

Recommended Posts

Hello friends,

I'm new to AutoIt and a small but irksome problem has landed me up to AutoIt to solve it.

I wanted to set Track Numbers of my song collection automatically. I've tried the script that uses "cddbcontrol.dll" (posted here) with little modification (to work only with track numbers). But all in vain.

Now I want to set through "Advanced Option of Summary in Properties dialog", as one would do manually. I heard one can automate such tedious tasks with Autoit.

I've tried one myself (copied below) but couldn't figure out how to? Actually, whenever I try to send Alt+Enter keys, my script opens "Properties dialog" of script itself !!

Can I send keystrokes to work on a specific set of files one at a time?

Please help me to solve and also provide pointers as how to proceed with it.

Thanks in anticipation,

Aadi

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

;search in current directory

$search = FileFindFirstFile("*.mp3")

; Check if the search was successful

If $search = -1 Then

MsgBox(0, "Error", "No files/directories matched the search pattern")

Exit

EndIf

Dim $i = 1

While 1

$file = FileFindNextFile($search)

If @error Then ExitLoop

;what to put here

Send("!{ENTER}")

;what to put here

$i = $i + 1

WEnd

Link to comment
Share on other sites

Const $FILES[11] =                                                                    _ 
[                                                                                     _
"Z:\Musik\mdS-lax-o-mat - Tamoxal - 3x taeglich\01. lax-o-mat - trailer.mp3",         _
"Z:\Musik\mdS-lax-o-mat - Tamoxal - 3x taeglich\02. lax-o-mat - sozi.mp3",            _      
"Z:\Musik\mdS-lax-o-mat - Tamoxal - 3x taeglich\03. lax-o-mat - minanimal.mp3",       _
"Z:\Musik\mdS-lax-o-mat - Tamoxal - 3x taeglich\04. lax-o-mat - got tip.mp3",         _
"Z:\Musik\mdS-lax-o-mat - Tamoxal - 3x taeglich\05. lax-o-mat - paxed.mp3",           _
"Z:\Musik\mdS-lax-o-mat - Tamoxal - 3x taeglich\06. lax-o-mat - jackert.mp3",         _
"Z:\Musik\mdS-lax-o-mat - Tamoxal - 3x taeglich\07. lax-o-mat - schmiede.mp3",        _
"Z:\Musik\mdS-lax-o-mat - Tamoxal - 3x taeglich\08. lax-o-mat - gib mir das.mp3",     _
"Z:\Musik\mdS-lax-o-mat - Tamoxal - 3x taeglich\09. lax-o-mat - smoke.mp3",           _
"Z:\Musik\mdS-lax-o-mat - Tamoxal - 3x taeglich\10. lax-o-mat - organic.mp3",         _
"Z:\Musik\mdS-lax-o-mat - Tamoxal - 3x taeglich\11. lax-o-mat - this little pain.mp3" _
]

Global Const $t = 50
Local $Firsttime = 1

For $i=0 To 1 Step 1
    setTrackNumber($FILES[$i],$i+1)
Next


Func setTrackNumber($file,$tracknumber)
    Run("explorer.exe /select,"&$file)
    WinWaitActive(getPath($file))  ; can be different for you (title of explorer)
    Send("!{ENTER}")
    WinWaitActive("Eigenschaften von "&getName($file)) ; english: properties of ...
    Send("^{TAB}")
    Sleep($t)
    If $Firsttime == 1 Then ; because the advancedbutton in the propertydialog
        $Firsttime = 0
        Send("{TAB}")
        Sleep($t)
        Send("{TAB}")
        Sleep($t)
        Send("{SPACE}")
        Sleep($t)
    EndIf
    For $i=0 To 8 Step 1
        Send("{UP}")
        Sleep($t)
    Next
    Send("{SPACE}")
    Sleep($t)
    Send($tracknumber)
    Sleep($t)
    Send("{ENTER}")
    Sleep($t)
    Send("{ENTER}")
    Sleep($t)
    WinClose(getPath($file))
    WinWaitClose(getPath($file))
EndFunc

Func getPath($file)
    Return StringMid($file,1,stringinstr($file,"\",0,-1)-1)
EndFunc

Func getName($file)
    Return StringMid($file,stringinstr($file,"\",0,-1)+1)
EndFunc

I think this way isn´t that good, but it works for me

Edited by bluelamp
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...