Advertisement
Guest User

Untitled

a guest
Aug 24th, 2015
286
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.03 KB | None | 0 0
  1. ;Alias mp3
  2. ;---------------------------------------------------------------------------------------------------------
  3. alias mp3 { dialog -m mp3 mp3 }
  4. ;---------------------------------------------------------------------------------------------------------
  5. ;ProMp3 Questo file fa parte del ProScript ver 0.1
  6. ;autore Kibo
  7.  
  8. dialog mp3 {
  9. title "ProScript-Music"
  10. size -1 -1 112 50
  11. option dbu
  12. edit "Canzone.mp3", 1, 4 2 50 10, autohs center
  13. edit "Durata", 2, 4 13 50 10, autohs center
  14. }
  15.  
  16.  
  17. on *:dialog:mp3:*:*: {
  18. if ($devent == init) {
  19. dcx Mark mp3 mp3_cb
  20. ;- Creazione Edit
  21. ;xdialog -c $dname 10 edit 140 4 130 55 smooth notheme group bitmap
  22. xdialog -c $dname 11 text 140 4 130 55 smooth notheme transparent
  23. xdid -U $dname 11
  24. xdialog -c $dname 10 edit 140 4 130 55 group bitmap
  25. xdid -a $dname 10 00:00
  26. xdid -f $dname 10 +a ansi 25 Arial
  27. xdid -C $dname 10 +bk $rgb(255,128,0)
  28. xdid -x $dname 10 +s
  29. ;xdid -b $dname 10 ;Se disabilito mi cambia il colore del testo
  30. ;xdid -C $dname 10 +t $rgb(24,45,25)
  31. ;- Creazione Pulsanti
  32. xdialog -c $dname 4 button 5 70 50 50 smooth notheme
  33. ;xdialog -c $dname 5 button 5 70 50 50 smooth notheme
  34. xdialog -c $dname 6 button 60 70 50 50 smooth notheme
  35. xdialog -c $dname 7 button 115 70 50 50 smooth notheme
  36. xdialog -c $dname 8 button 170 70 50 50 smooth notheme
  37. xdialog -c $dname 9 button 225 70 50 50 smooth notheme
  38. ;- Icona
  39. xdid -w $dname 4 +ng 113 shell32.dll
  40. ;- Pulsante Play
  41. xdid -t $dname 6 4
  42. xdid -f $dname 6 +a symbol 10 Webdings
  43. ;- Pulsante Stop
  44. xdid -t $dname 7 ;
  45. xdid -f $dname 7 +a symbol 10 Webdings
  46. ;-
  47. xdid -t $dname 8 :
  48. xdid -f $dname 8 +a symbol 10 Webdings
  49. ;-
  50. xdid -t $dname 9 9
  51. xdid -f $dname 9 +a symbol 10 Webdings
  52. ;-
  53. ;xdid -v $dname 3 100 ;Per incrementare la progressbar
  54. ;Controllo se è settata una directory
  55. }
  56. if ($devent == sclick) {
  57. if ($did = 5) { _dir::setf | echo -s %pro_music_dir }
  58. }
  59. ;Gestione chiusura mp3
  60. ;deallochiamo l'hasktable e %c_song
  61. if ($devent == close) {
  62. splay stop
  63. splay -c
  64. .timer_countdown off
  65. .hfree -s mp3
  66. unset %pro_music_dir
  67. unset %c_song
  68. }
  69. }
  70.  
  71.  
  72. alias -l _dir::setf { _dir::path $sfile($+($iif($isdir($mircdir\Musica),$mircdir\Musica,$sound(mp3))),ProScript MP3 Music - Scegli Cartella) }
  73. alias -l _dir::check { return $iif(%pro_music_dir,%pro_music_dir,0) }
  74. alias mp3_cb {
  75.  
  76. ;Directory
  77. if ($2 == sclick) { if ($3 == 4) { _dir::setf } }
  78.  
  79. ;AntiFocus 00:00
  80. if ($2 == mouse) { if ($3 == 10) { xdid -U mp3 10 } }
  81. if ($2 == lbdown) { if ($3 == 10) { return nocopy } }
  82. if ($2 == sclick) { if ($3 == 10) { xdid -U mp3 10 } }
  83.  
  84. ;Play
  85. ;Verifichiamo se è stata scelta una cartella e che al suo interno contenga almeno un brano
  86. if ($2 == sclick) {
  87. ;Pulsante play
  88. if ($3 == 6) {
  89. if ($insong.pause) { splay resume | return }
  90. if ($isdir($_dir::check)) {
  91. if ($findfile($_dir::check,*.mp3,0)) { pro_mp3_play }
  92. else { _dir::setf | echo -s Non sono presenti mp3 }
  93. }
  94. else { _dir::setf }
  95. }
  96. }
  97. ;Pulsante stop
  98. if ($2 == sclick) {
  99. if ($3 == 7) { if ($insong) { splay pause | .timer_countdown off } }
  100. }
  101. ;Pulsante skip
  102. if ($2 == sclick) {
  103. if ($3 == 8) { splay -p skip }
  104. }
  105. ;Pulsante back
  106. if ($2 == sclick) {
  107. if ($3 == 9) { pro_mp3_back }
  108. }
  109. ;Visualizzo titolo canzone e durata
  110. if ($2 == sclick) {
  111. if ( ($3 == 6) || ($3 == 8) || ($3 == 9) ) {
  112. Pro_mp3_title
  113. Pro_mp3_time
  114. }
  115. }
  116. }
  117. alias _dir::path {
  118. ;Implementazione $nofile(filename) esisteva già un comando e non lo sapevo :(
  119. var %i = $calc($gettok($1-,0,92) - 1)
  120. var %x = 1
  121. var %dir
  122. while (%i > 0) {
  123. ;echo -s $gettok($1-,%x,92)
  124. %dir = %dir $+ $gettok($1-,%x,92) $+ $chr(92)
  125. dec %i
  126. inc %x
  127. }
  128. set %pro_music_dir %dir
  129. }
  130.  
  131. ;Stampa su un hashtable tutti i file mp3 presenti nella directory selezionata precedentemente
  132. alias pro_mp3_list {
  133. ;Se esiste già un hashtable mp3 la cancello e la ricreo
  134. if (!$hget(mp3)) { hmake -s mp3 1000 }
  135. else { hfree -sw mp3 | hmake -s mp3 1000 }
  136. ;Carico il percorso dei file nel hasktable
  137. ;esempio:
  138. ;hashtable: name item text
  139. ;hashtable: mp3 1 C:\Users\kibo\Desktop\Mirc\ProScript\sounds\avvio.mp3
  140. var %all_mp3 = $findfile(%pro_music_dir,*.mp3,0,1)
  141. var %x = 1
  142. while (%all_mp3 > 0) {
  143. echo -s $findfile(%pro_music_dir,*.mp3,%x)
  144. hadd mp3 %x $findfile(%pro_music_dir,*.mp3,%x,1)
  145. dec %all_mp3
  146. inc %x
  147. }
  148. }
  149.  
  150. ;Esegue tutti i file mp3 contenuti nella cartella
  151. alias pro_mp3_play {
  152. ; splay -pq
  153. pro_mp3_list
  154. var %all_mp3 = $findfile(%pro_music_dir,*.mp3,0,1)
  155. var %x = 1
  156. while (%all_mp3 > 0) {
  157. splay -pq $hget(mp3,%x)
  158. dec %all_mp3
  159. inc %x
  160. }
  161. Pro_mp3_title
  162. Pro_mp3_time
  163. }
  164.  
  165. ;Gestisce avanzamento della progressbar settando la durata della canzone e il suo avanzamento
  166. alias pro_mp3_pbar { }
  167.  
  168. ;Esegue track precedente
  169. ;Quando metto in coda le canzoni per andare avanti ho il comando skip purtroppo non ho il corispettivo
  170. ;comando per andare indietro ... questo alias provvede a risolvere il problema
  171.  
  172. alias pro_mp3_back {
  173. if ($insong.pause) {
  174. 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))
  175. }
  176. if ($insong) {
  177. 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))
  178. }
  179. }
  180. ;Stampa la hashtable mp3
  181. ;Questo alias non serve al corretto utilizzo dello script ma è molto utile in fase di testing
  182. alias _hmp3 {
  183. if ($hget(mp3)) {
  184. var %x = 1
  185. var %n = $hget(mp3,0).item
  186. while (%n > 0) { echo -s %x $+ $chr(32) $+ $hget(mp3,%x) | dec %n | inc %x }
  187. }
  188. }
  189.  
  190. ;Gestione Repeat
  191. on 1:mp3end:{
  192. if ($dialog(mp3)) {
  193. .timer_mp3_title 1 1 Pro_mp3_title
  194. .timer_mp3_time 1 1 Pro_mp3_time
  195. if (%c_song == $hget(mp3,$hget(mp3,0).item).data) {
  196. if ($dcx(MsgBox, yesno information $chr(9) Proscript $chr(9) La playlist è terminata ripeto ?) == yes) { pro_mp3_play }
  197. }
  198. }
  199. }
  200.  
  201. alias -l Pro_mp3_title {
  202. did -r mp3 1
  203. did -a mp3 1 $nopath($insong.fname)
  204. }
  205.  
  206. alias Pro_mp3_time {
  207. did -r mp3 2
  208. ;did -a mp3 2 $$iif($insong.length,$ifmatch,$chr(32))
  209. did -a mp3 2 $mp3_time($insong.length)
  210. if ($insong) { .timer_countdown 0 1 progress_time }
  211. }
  212.  
  213. ;Per questo alias vorrei ringraziare Tobias Paul aka Ecronika
  214. alias mp3_time {
  215. if ($insong) {
  216. tokenize 32 $1 $int($calc($1 / 60000))
  217. return $2 $+ : $+ $base($int($calc(($1 - $2 * 60000) / 1000)),10,10,2)
  218. }
  219. }
  220.  
  221. ;Ridefinizione splay
  222. alias -l splay {
  223. Pro_mp3_time
  224. Pro_mp3_title
  225. splay $1-
  226. set %c_song $insong.fname
  227. }
  228.  
  229. alias -l progress_time {
  230. xdid -r mp3 10
  231. if ($insong) {
  232. xdid -a mp3 10 $+ $chr(32) $+ $chr(48) $+ $mp3_time($calc($insong.pos))
  233. }
  234. else { xdid -a mp3 10 00:00 }
  235. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement