Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;Alias mp3
- ;---------------------------------------------------------------------------------------------------------
- alias mp3 { dialog -m mp3 mp3 }
- ;---------------------------------------------------------------------------------------------------------
- ;ProMp3 Questo file fa parte del ProScript ver 0.1
- ;autore Kibo
- dialog mp3 {
- title "ProScript-Music"
- size -1 -1 112 50
- option dbu
- edit "Canzone.mp3", 1, 4 2 50 10, autohs center
- edit "Durata", 2, 4 13 50 10, autohs center
- }
- on *:dialog:mp3:*:*: {
- if ($devent == init) {
- dcx Mark mp3 mp3_cb
- ;- Creazione Edit
- ;xdialog -c $dname 10 edit 140 4 130 55 smooth notheme group bitmap
- xdialog -c $dname 11 text 140 4 130 55 smooth notheme transparent
- xdid -U $dname 11
- xdialog -c $dname 10 edit 140 4 130 55 group bitmap
- xdid -a $dname 10 00:00
- xdid -f $dname 10 +a ansi 25 Arial
- xdid -C $dname 10 +bk $rgb(255,128,0)
- xdid -x $dname 10 +s
- ;xdid -b $dname 10 ;Se disabilito mi cambia il colore del testo
- ;xdid -C $dname 10 +t $rgb(24,45,25)
- ;- Creazione Pulsanti
- xdialog -c $dname 4 button 5 70 50 50 smooth notheme
- ;xdialog -c $dname 5 button 5 70 50 50 smooth notheme
- xdialog -c $dname 6 button 60 70 50 50 smooth notheme
- xdialog -c $dname 7 button 115 70 50 50 smooth notheme
- xdialog -c $dname 8 button 170 70 50 50 smooth notheme
- xdialog -c $dname 9 button 225 70 50 50 smooth notheme
- ;- Icona
- xdid -w $dname 4 +ng 113 shell32.dll
- ;- Pulsante Play
- xdid -t $dname 6 4
- xdid -f $dname 6 +a symbol 10 Webdings
- ;- Pulsante Stop
- xdid -t $dname 7 ;
- xdid -f $dname 7 +a symbol 10 Webdings
- ;-
- xdid -t $dname 8 :
- xdid -f $dname 8 +a symbol 10 Webdings
- ;-
- xdid -t $dname 9 9
- xdid -f $dname 9 +a symbol 10 Webdings
- ;-
- ;xdid -v $dname 3 100 ;Per incrementare la progressbar
- ;Controllo se è settata una directory
- }
- if ($devent == sclick) {
- if ($did = 5) { _dir::setf | echo -s %pro_music_dir }
- }
- ;Gestione chiusura mp3
- ;deallochiamo l'hasktable e %c_song
- if ($devent == close) {
- splay stop
- splay -c
- .timer_countdown off
- .hfree -s mp3
- unset %pro_music_dir
- unset %c_song
- }
- }
- alias -l _dir::setf { _dir::path $sfile($+($iif($isdir($mircdir\Musica),$mircdir\Musica,$sound(mp3))),ProScript MP3 Music - Scegli Cartella) }
- alias -l _dir::check { return $iif(%pro_music_dir,%pro_music_dir,0) }
- alias mp3_cb {
- ;Directory
- if ($2 == sclick) { if ($3 == 4) { _dir::setf } }
- ;AntiFocus 00:00
- if ($2 == mouse) { if ($3 == 10) { xdid -U mp3 10 } }
- if ($2 == lbdown) { if ($3 == 10) { return nocopy } }
- if ($2 == sclick) { if ($3 == 10) { xdid -U mp3 10 } }
- ;Play
- ;Verifichiamo se è stata scelta una cartella e che al suo interno contenga almeno un brano
- if ($2 == sclick) {
- ;Pulsante play
- if ($3 == 6) {
- if ($insong.pause) { splay resume | return }
- if ($isdir($_dir::check)) {
- if ($findfile($_dir::check,*.mp3,0)) { pro_mp3_play }
- else { _dir::setf | echo -s Non sono presenti mp3 }
- }
- else { _dir::setf }
- }
- }
- ;Pulsante stop
- if ($2 == sclick) {
- if ($3 == 7) { if ($insong) { splay pause | .timer_countdown off } }
- }
- ;Pulsante skip
- if ($2 == sclick) {
- if ($3 == 8) { splay -p skip }
- }
- ;Pulsante back
- if ($2 == sclick) {
- if ($3 == 9) { pro_mp3_back }
- }
- ;Visualizzo titolo canzone e durata
- if ($2 == sclick) {
- if ( ($3 == 6) || ($3 == 8) || ($3 == 9) ) {
- Pro_mp3_title
- Pro_mp3_time
- }
- }
- }
- alias _dir::path {
- ;Implementazione $nofile(filename) esisteva già un comando e non lo sapevo :(
- var %i = $calc($gettok($1-,0,92) - 1)
- var %x = 1
- var %dir
- while (%i > 0) {
- ;echo -s $gettok($1-,%x,92)
- %dir = %dir $+ $gettok($1-,%x,92) $+ $chr(92)
- dec %i
- inc %x
- }
- set %pro_music_dir %dir
- }
- ;Stampa su un hashtable tutti i file mp3 presenti nella directory selezionata precedentemente
- alias pro_mp3_list {
- ;Se esiste già un hashtable mp3 la cancello e la ricreo
- if (!$hget(mp3)) { hmake -s mp3 1000 }
- else { hfree -sw mp3 | hmake -s mp3 1000 }
- ;Carico il percorso dei file nel hasktable
- ;esempio:
- ;hashtable: name item text
- ;hashtable: mp3 1 C:\Users\kibo\Desktop\Mirc\ProScript\sounds\avvio.mp3
- var %all_mp3 = $findfile(%pro_music_dir,*.mp3,0,1)
- var %x = 1
- while (%all_mp3 > 0) {
- echo -s $findfile(%pro_music_dir,*.mp3,%x)
- hadd mp3 %x $findfile(%pro_music_dir,*.mp3,%x,1)
- dec %all_mp3
- inc %x
- }
- }
- ;Esegue tutti i file mp3 contenuti nella cartella
- alias pro_mp3_play {
- ; splay -pq
- pro_mp3_list
- var %all_mp3 = $findfile(%pro_music_dir,*.mp3,0,1)
- var %x = 1
- while (%all_mp3 > 0) {
- splay -pq $hget(mp3,%x)
- dec %all_mp3
- inc %x
- }
- Pro_mp3_title
- Pro_mp3_time
- }
- ;Gestisce avanzamento della progressbar settando la durata della canzone e il suo avanzamento
- alias pro_mp3_pbar { }
- ;Esegue track precedente
- ;Quando metto in coda le canzoni per andare avanti ho il comando skip purtroppo non ho il corispettivo
- ;comando per andare indietro ... questo alias provvede a risolvere il problema
- alias pro_mp3_back {
- if ($insong.pause) {
- splay $iif($hget(mp3,$calc($hfind(mp3,$insong.fname,1).data - 1)).item == 0,$hget(mp3,$hget(mp3,0).item),$hget(mp3,$hget(mp3,$calc($hfind(mp3,$insong.fname,1).data - 1)).item))
- }
- if ($insong) {
- splay $iif($hget(mp3,$calc($hfind(mp3,$insong.fname,1).data - 1)).item == 0,$hget(mp3,$hget(mp3,0).item),$hget(mp3,$hget(mp3,$calc($hfind(mp3,$insong.fname,1).data - 1)).item))
- }
- }
- ;Stampa la hashtable mp3
- ;Questo alias non serve al corretto utilizzo dello script ma è molto utile in fase di testing
- alias _hmp3 {
- if ($hget(mp3)) {
- var %x = 1
- var %n = $hget(mp3,0).item
- while (%n > 0) { echo -s %x $+ $chr(32) $+ $hget(mp3,%x) | dec %n | inc %x }
- }
- }
- ;Gestione Repeat
- on 1:mp3end:{
- if ($dialog(mp3)) {
- .timer_mp3_title 1 1 Pro_mp3_title
- .timer_mp3_time 1 1 Pro_mp3_time
- if (%c_song == $hget(mp3,$hget(mp3,0).item).data) {
- if ($dcx(MsgBox, yesno information $chr(9) Proscript $chr(9) La playlist è terminata ripeto ?) == yes) { pro_mp3_play }
- }
- }
- }
- alias -l Pro_mp3_title {
- did -r mp3 1
- did -a mp3 1 $nopath($insong.fname)
- }
- alias Pro_mp3_time {
- did -r mp3 2
- ;did -a mp3 2 $$iif($insong.length,$ifmatch,$chr(32))
- did -a mp3 2 $mp3_time($insong.length)
- if ($insong) { .timer_countdown 0 1 progress_time }
- }
- ;Per questo alias vorrei ringraziare Tobias Paul aka Ecronika
- alias mp3_time {
- if ($insong) {
- tokenize 32 $1 $int($calc($1 / 60000))
- return $2 $+ : $+ $base($int($calc(($1 - $2 * 60000) / 1000)),10,10,2)
- }
- }
- ;Ridefinizione splay
- alias -l splay {
- Pro_mp3_time
- Pro_mp3_title
- splay $1-
- set %c_song $insong.fname
- }
- alias -l progress_time {
- xdid -r mp3 10
- if ($insong) {
- xdid -a mp3 10 $+ $chr(32) $+ $chr(48) $+ $mp3_time($calc($insong.pos))
- }
- else { xdid -a mp3 10 00:00 }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement