source: branches/mediafolder/Skripte_eng/~Burn audio CD@ 222

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

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

File size: 4.1 KB
Line 
1/****************************************/
2/* */
3/* Burn selected tracks as an audio CD. */
4/* Audio-CD-Creator must be installed. */
5/* */
6/* An audio folder will be created and */
7/* the selected tracks inserted. */
8/* */
9/****************************************/
10/* Load Rexxutil functions */
11call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
12call SysLoadFuncs
13
14QC_FIRST=0
15QC_NEXT=1
16QC_LAST=2
17
18/* Check if we are executing */
19if ARG(1)\='/EXECUTE' THEN EXIT
20
21/* Check if Audio-CD-Creator is installed */
22
23list.0=0
24found=0
25rc=SysQueryClassList(list.)
26DO a=1 to list.0
27 if TRANSLATE(WORD(list.a,1))='CWAUDIOFOLDER' THEN DO
28 found=1
29 LEAVE
30 END
31END
32
33IF found=0 THEN DO
34 theString="Audio-CD-Creator is not installed. You need this package for burning."
35 theString=theString||'0d'X||'0d'X
36 theString=theString||'Get it from http://www.os2world.com/cdwriting'||'0d'X||' '
37 rc=RxMessageBox(theString, "",'OK', "Information")
38 EXIT
39END
40
41/* The media folder running this skript */
42mFldr=ARG(2)
43/* And the frame handle */
44frameHandle=ARG(3)
45
46/*Get the container handle */
47container=WPSWizCallWinFunc( "winQueryContainerHWND", frameHandle)
48
49if container=0 THEN DO
50 rc=RxMessageBox("Cannot get container handle!", "",'OK', "Information")
51 EXIT
52END
53
54pRec=WPSWizCallWinFunc( "winQueryContRecEmphasis", container, 16 , 1)
55
56a=0
57tracks.0=0
58DO WHILE (pRec\=0 & pRec\=-1)
59 /* Get object pointer */
60 obj=WPSWizCallWinFunc( "winObjectFromPRec", pRec)
61 /* Follow shadows to file system object */
62 obj=MFldrCallFunc( "cwGetFileSystemObject", mFldr, obj)
63 /* Check if it's an audio object */
64 IF MFldrCallFunc( "cwIsA", obj, "CWAudio")\=0 THEN DO
65 a=a+1
66 tracks.a._obj=obj
67 END
68 pRec=WPSWizCallWinFunc( "winQueryContRecEmphasis", container, pRec , 1)
69 tracks.0=a
70END
71
72if tracks.0=0 THEN DO
73 rc=RxMessageBox("No audio tracks selected.", "Information",'OK')
74 EXIT
75END
76
77/* Try to find the desktop folder */
78
79/* Get the persistent object handle */
80hObject=WPSWizCallWinFunc( "winQueryObject" ,"<WP_DESKTOP>")
81
82if hObject\=0 THEN DO
83 /* Get the class object of the given object pointer */
84 classObject=WPSWizCallWPSFunc("somGetClass",mFldr)
85
86 /* Get the object pointer from the handle */
87 theObject=WPSWizCallWPSClsFunc("wpclsQueryObject", classObject, hObject)
88
89 /* Query the full path of the object */
90 desktop=WPSWizCallFunc("cwQueryRealName", theObject, 1)
91
92 /* The object was locked because of "wpclsQueryObject" */
93 rc=WPSWizCallWPSFunc("wpUnlockObject", theObject)
94END
95
96if desktop\='' THEN
97 desktop=desktop||'\audioFolder'
98
99/* Get a name for the new folder */
100folderName=WPSWizCallWinFunc( "winFileDlg", 1, "Name for Audio-CD-Creator folder", desktop)
101
102/* No name, so quit */
103if foldername="" THEN exit
104
105/* Check if an error occurred */
106if foldername="ERROR:" THEN DO
107 rc=RxMessageBox("File dialog returned an error!", "Error",'OK', "ERROR")
108 EXIT
109END
110
111/* Get the path */
112thePath=FILESPEC('drive',foldername)||FILESPEC('path',foldername)
113thePath=LEFT(thePath,LENGTH(thePath)-1)
114
115/* Create a new audio folder to hold the selected tracks */
116setup=''
117setup='DETAILSCLASS=CWAudioShadow;SORTCLASS=CWAudioShadow;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'
118newFldr=SysCreateObject("CWAudioFolder", FILESPEC('name',foldername), thePath, setup , 'update')
119
120if newFldr=0 THEN DO
121 /* Folder creation failed */
122 rc=RxMessageBox("Cannot create audio-CD folder", "Audio-CD folder creation",'OK')
123 EXIT
124END
125
126
127/* Now create shadows of the selected tracks */
128DO a=tracks.0 to 1 by -1
129 objName=MFldrCallFunc( "cwQueryRealName", tracks.a._obj, 0)
130 /* When using a space as the object title the real name is used as the title. By doing it this
131 way we may have several shadows to the same track in the folder. */
132 rc=SysCreateObject("CWAudioShadow", " ", folderName, "SHADOWID="||MFldrCallFunc( "cwQueryRealName", tracks.a._obj,1),'update')
133END
134/* Open the folder */
135rc=SysSetObjectData(folderName, "OPEN=DEFAULT")
136rc=0
137
138exit
139
140
Note: See TracBrowser for help on using the repository browser.