source: trunk/mediafolder/Skripte_eng/~Create playlist

Last change on this file was 2, checked in by stevenhl, 8 years ago

Import sources from cwmm-full.zip dated 2005-03-21

File size: 3.2 KB
Line 
1/* Create a playlist from all selected tracks */
2
3/* Load Rexxutil functions */
4call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
5call SysLoadFuncs
6
7QC_FIRST=0
8QC_NEXT=1
9QC_LAST=2
10
11/* Check if we are executing */
12if ARG(1)\='/EXECUTE' THEN EXIT
13
14/* The media folder running this skript */
15mFldr=ARG(2)
16/* And the frame handle */
17frameHandle=ARG(3)
18
19/*Get the container handle */
20container=WPSWizCallWinFunc( "winQueryContainerHWND", frameHandle)
21
22if container=0 THEN DO
23 rc=RxMessageBox("Cannot get container handle!", "",'OK', "Information")
24 EXIT
25END
26
27pRec=WPSWizCallWinFunc( "winQueryContRecEmphasis", container, 16 , 1)
28
29a=0
30tracks.0=0
31DO 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
43END
44
45if tracks.0=0 THEN DO
46 rc=RxMessageBox("No audio tracks selected.", "Information",'OK')
47 EXIT
48END
49
50/* Try to find the desktop folder */
51
52/* Get the persistent object handle */
53hObject=WPSWizCallWinFunc( "winQueryObject" ,"<WP_DESKTOP>")
54
55if 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)
67END
68
69if desktop\='' THEN
70 desktop=desktop||'\newFolder'
71
72/* Get a name for the new folder from the user */
73folderName=WPSWizCallWinFunc( "winFileDlg", 1, "New folder name for play list", desktop)
74
75/* No name, so quit */
76if foldername="" THEN exit
77
78/* Check if an error occurred */
79if foldername="ERROR:" THEN DO
80 rc=RxMessageBox("File dialog returned an error!", "Error",'OK', "ERROR")
81 EXIT
82END
83
84/* Get the path */
85thePath=FILESPEC('drive',foldername)||FILESPEC('path',foldername)
86thePath=LEFT(thePath,LENGTH(thePath)-1)
87
88/* Create a new media folder to hold the selected tracks */
89setup='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;'
90newFldr=SysCreateObject("CWMediaFolder", FILESPEC('name',foldername), thePath, setup , 'update')
91
92if newFldr=0 THEN DO
93 /* Folder creation failed */
94 rc=RxMessageBox("Cannot create media folder", "Media folder creation",'OK')
95 EXIT
96END
97
98
99/* Now create shadows of the selected tracks */
100DO 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')
103END
104/* Open the folder */
105rc=SysSetObjectData(folderName, "OPEN=DEFAULT")
106rc=0
107
108exit
109
110
Note: See TracBrowser for help on using the repository browser.