[2] | 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 */
|
---|
| 11 | call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
|
---|
| 12 | call SysLoadFuncs
|
---|
| 13 |
|
---|
| 14 | QC_FIRST=0
|
---|
| 15 | QC_NEXT=1
|
---|
| 16 | QC_LAST=2
|
---|
| 17 |
|
---|
| 18 | /* Check if we are executing */
|
---|
| 19 | if ARG(1)\='/EXECUTE' THEN EXIT
|
---|
| 20 |
|
---|
| 21 | /* Check if Audio-CD-Creator is installed */
|
---|
| 22 |
|
---|
| 23 | list.0=0
|
---|
| 24 | found=0
|
---|
| 25 | rc=SysQueryClassList(list.)
|
---|
| 26 | DO a=1 to list.0
|
---|
| 27 | if TRANSLATE(WORD(list.a,1))='CWAUDIOFOLDER' THEN DO
|
---|
| 28 | found=1
|
---|
| 29 | LEAVE
|
---|
| 30 | END
|
---|
| 31 | END
|
---|
| 32 |
|
---|
| 33 | IF 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
|
---|
| 39 | END
|
---|
| 40 |
|
---|
| 41 | /* The media folder running this skript */
|
---|
| 42 | mFldr=ARG(2)
|
---|
| 43 | /* And the frame handle */
|
---|
| 44 | frameHandle=ARG(3)
|
---|
| 45 |
|
---|
| 46 | /*Get the container handle */
|
---|
| 47 | container=WPSWizCallWinFunc( "winQueryContainerHWND", frameHandle)
|
---|
| 48 |
|
---|
| 49 | if container=0 THEN DO
|
---|
| 50 | rc=RxMessageBox("Cannot get container handle!", "",'OK', "Information")
|
---|
| 51 | EXIT
|
---|
| 52 | END
|
---|
| 53 |
|
---|
| 54 | pRec=WPSWizCallWinFunc( "winQueryContRecEmphasis", container, 16 , 1)
|
---|
| 55 |
|
---|
| 56 | a=0
|
---|
| 57 | tracks.0=0
|
---|
| 58 | DO 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
|
---|
| 70 | END
|
---|
| 71 |
|
---|
| 72 | if tracks.0=0 THEN DO
|
---|
| 73 | rc=RxMessageBox("No audio tracks selected.", "Information",'OK')
|
---|
| 74 | EXIT
|
---|
| 75 | END
|
---|
| 76 |
|
---|
| 77 | /* Try to find the desktop folder */
|
---|
| 78 |
|
---|
| 79 | /* Get the persistent object handle */
|
---|
| 80 | hObject=WPSWizCallWinFunc( "winQueryObject" ,"<WP_DESKTOP>")
|
---|
| 81 |
|
---|
| 82 | if 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)
|
---|
| 94 | END
|
---|
| 95 |
|
---|
| 96 | if desktop\='' THEN
|
---|
| 97 | desktop=desktop||'\audioFolder'
|
---|
| 98 |
|
---|
| 99 | /* Get a name for the new folder */
|
---|
| 100 | folderName=WPSWizCallWinFunc( "winFileDlg", 1, "Name for Audio-CD-Creator folder", desktop)
|
---|
| 101 |
|
---|
| 102 | /* No name, so quit */
|
---|
| 103 | if foldername="" THEN exit
|
---|
| 104 |
|
---|
| 105 | /* Check if an error occurred */
|
---|
| 106 | if foldername="ERROR:" THEN DO
|
---|
| 107 | rc=RxMessageBox("File dialog returned an error!", "Error",'OK', "ERROR")
|
---|
| 108 | EXIT
|
---|
| 109 | END
|
---|
| 110 |
|
---|
| 111 | /* Get the path */
|
---|
| 112 | thePath=FILESPEC('drive',foldername)||FILESPEC('path',foldername)
|
---|
| 113 | thePath=LEFT(thePath,LENGTH(thePath)-1)
|
---|
| 114 |
|
---|
| 115 | /* Create a new audio folder to hold the selected tracks */
|
---|
| 116 | setup=''
|
---|
| 117 | setup='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'
|
---|
| 118 | newFldr=SysCreateObject("CWAudioFolder", FILESPEC('name',foldername), thePath, setup , 'update')
|
---|
| 119 |
|
---|
| 120 | if newFldr=0 THEN DO
|
---|
| 121 | /* Folder creation failed */
|
---|
| 122 | rc=RxMessageBox("Cannot create audio-CD folder", "Audio-CD folder creation",'OK')
|
---|
| 123 | EXIT
|
---|
| 124 | END
|
---|
| 125 |
|
---|
| 126 |
|
---|
| 127 | /* Now create shadows of the selected tracks */
|
---|
| 128 | DO 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')
|
---|
| 133 | END
|
---|
| 134 | /* Open the folder */
|
---|
| 135 | rc=SysSetObjectData(folderName, "OPEN=DEFAULT")
|
---|
| 136 | rc=0
|
---|
| 137 |
|
---|
| 138 | exit
|
---|
| 139 |
|
---|
| 140 |
|
---|