1 | /* Calculate the playtime of all selected tracks */
|
---|
2 |
|
---|
3 | /* Load Rexxutil functions */
|
---|
4 | call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
|
---|
5 | call SysLoadFuncs
|
---|
6 |
|
---|
7 | QC_FIRST=0
|
---|
8 | QC_NEXT=1
|
---|
9 | QC_LAST=2
|
---|
10 |
|
---|
11 | /* Check if we are executing */
|
---|
12 | if ARG(1)\='/EXECUTE' THEN EXIT
|
---|
13 |
|
---|
14 | /* The media folder running this skript */
|
---|
15 | mFldr=ARG(2)
|
---|
16 | /* And the frame handle */
|
---|
17 | frameHandle=ARG(3)
|
---|
18 |
|
---|
19 | /*Get the container handle */
|
---|
20 | container=WPSWizCallWinFunc( "winQueryContainerHWND", frameHandle)
|
---|
21 |
|
---|
22 | if container=0 THEN DO
|
---|
23 | rc=RxMessageBox("Cannot get container handle!", "",'OK', "Information")
|
---|
24 | EXIT
|
---|
25 | END
|
---|
26 |
|
---|
27 | pRec=WPSWizCallWinFunc( "winQueryContRecEmphasis", container, 16 , 1)
|
---|
28 |
|
---|
29 | a=0
|
---|
30 | tracks.0=0
|
---|
31 | DO WHILE (pRec\=0 & pRec\=-1)
|
---|
32 | /* Get object pointer */
|
---|
33 | obj=WPSWizCallWinFunc( "winObjectFromPRec", pRec)
|
---|
34 | /* Follow shadows to file system object */
|
---|
35 | obj=MFldrCallFunc( "cwGetFileSystemObject", mFldr, obj)
|
---|
36 | /* Check if it's an audio object */
|
---|
37 | IF MFldrCallFunc( "cwIsA", obj, "CWAudio")\=0 THEN DO
|
---|
38 | a=a+1
|
---|
39 | tracks.a._obj=obj
|
---|
40 | END
|
---|
41 | pRec=WPSWizCallWinFunc( "winQueryContRecEmphasis", container, pRec , 1)
|
---|
42 | tracks.0=a
|
---|
43 | END
|
---|
44 |
|
---|
45 | if tracks.0=0 THEN DO
|
---|
46 | rc=RxMessageBox("No audio tracks selected.", "Information",'OK')
|
---|
47 | EXIT
|
---|
48 | END
|
---|
49 |
|
---|
50 | playTime=0
|
---|
51 | /* Now calculate play time */
|
---|
52 | DO a=tracks.0 to 1 by -1
|
---|
53 | tempTime=0
|
---|
54 | tempTime=MMClsCallFunc( "cwmmQueryTrackInfo", tracks.a._obj, 7)
|
---|
55 | if tempTime\= 'ERROR:' THEN DO
|
---|
56 | playTime=playTime+tempTime
|
---|
57 | END
|
---|
58 | END
|
---|
59 | theString='Playtime of all selected tracks is: '
|
---|
60 | secs=RIGHT('00'||playTime//60 ,2)
|
---|
61 | theString=theString||playTime%60||':'||secs||' min'||'0d'X||'0d'X
|
---|
62 | theString=theString||'Number of selected tracks: '||tracks.0||'0d'X||' '
|
---|
63 | rc=RxMessageBox(theString, "Information",'OK')
|
---|
64 |
|
---|
65 | RC=0
|
---|
66 | exit
|
---|
67 |
|
---|
68 |
|
---|