1 | /* Create a playlist from 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 | /* Try to find the desktop folder */
|
---|
51 |
|
---|
52 | /* Get the persistent object handle */
|
---|
53 | hObject=WPSWizCallWinFunc( "winQueryObject" ,"<WP_DESKTOP>")
|
---|
54 |
|
---|
55 | if hObject\=0 THEN DO
|
---|
56 | /* Get the class object of the given object pointer */
|
---|
57 | classObject=WPSWizCallWPSFunc("somGetClass",mFldr)
|
---|
58 |
|
---|
59 | /* Get the object pointer from the handle */
|
---|
60 | theObject=WPSWizCallWPSClsFunc("wpclsQueryObject", classObject, hObject)
|
---|
61 |
|
---|
62 | /* Query the full path of the object */
|
---|
63 | desktop=WPSWizCallFunc("cwQueryRealName", theObject, 1)
|
---|
64 |
|
---|
65 | /* The object was locked because of "wpclsQueryObject" */
|
---|
66 | rc=WPSWizCallWPSFunc("wpUnlockObject", theObject)
|
---|
67 | END
|
---|
68 |
|
---|
69 | if desktop\='' THEN
|
---|
70 | desktop=desktop||'\newFolder'
|
---|
71 |
|
---|
72 | /* Get a name for the new folder from the user */
|
---|
73 | folderName=WPSWizCallWinFunc( "winFileDlg", 1, "New folder name for play list", desktop)
|
---|
74 |
|
---|
75 | /* No name, so quit */
|
---|
76 | if foldername="" THEN exit
|
---|
77 |
|
---|
78 | /* Check if an error occurred */
|
---|
79 | if foldername="ERROR:" THEN DO
|
---|
80 | rc=RxMessageBox("File dialog returned an error!", "Error",'OK', "ERROR")
|
---|
81 | EXIT
|
---|
82 | END
|
---|
83 |
|
---|
84 | /* Get the path */
|
---|
85 | thePath=FILESPEC('drive',foldername)||FILESPEC('path',foldername)
|
---|
86 | thePath=LEFT(thePath,LENGTH(thePath)-1)
|
---|
87 |
|
---|
88 | /* Create a new media folder to hold the selected tracks */
|
---|
89 | setup='DETAILSTODISPLAY=0,1,4,12,13,14,15,16,17,18,19,20,21;SORTBYATTR=6,24,25,26,27,28,29,30,31,32,33;DETAILSCLASS=CWAudioShadow;MEDIAFLDRVOLUME=70;SORTCLASS=CWAudioShadow;DEFAULTVIEW=DETAILS;'
|
---|
90 | newFldr=SysCreateObject("CWMediaFolder", FILESPEC('name',foldername), thePath, setup , 'update')
|
---|
91 |
|
---|
92 | if newFldr=0 THEN DO
|
---|
93 | /* Folder creation failed */
|
---|
94 | rc=RxMessageBox("Cannot create media folder", "Media folder creation",'OK')
|
---|
95 | EXIT
|
---|
96 | END
|
---|
97 |
|
---|
98 |
|
---|
99 | /* Now create shadows of the selected tracks */
|
---|
100 | DO a=tracks.0 to 1 by -1
|
---|
101 | objName=MFldrCallFunc( "cwQueryRealName", tracks.a._obj, 0)
|
---|
102 | rc=SysCreateObject("CWAudioShadow",objName, folderName, "SHADOWID="||MFldrCallFunc( "cwQueryRealName", tracks.a._obj,1),'update')
|
---|
103 | END
|
---|
104 | /* Open the folder */
|
---|
105 | rc=SysSetObjectData(folderName, "OPEN=DEFAULT")
|
---|
106 | rc=0
|
---|
107 |
|
---|
108 | exit
|
---|
109 |
|
---|
110 |
|
---|