遇到一个棘手的问题,一个台湾客户给我一个dcr文件,让我从中拿出声音文件,我试验了很多国外的东西发现都不行,什么audioxtra全试验过了,后来我想是不是可以先在[url=]director[/url]中将文件先拷贝进剪切板,然后通过其他手段呢,结果成功了工具
是director mx,visual .net 2003
先是director程序,这里就是个miaw
global keywait
global click,miaw
global ix
on mouseup me
click=1
end
on cbm
if(click=1) then
forget(miaw)
end if
go to the frame
end
on addMmen img
ix=ix+1
if ix<=3 then
mem=_movie.newMember("bitmap")
mem.image=img
end if
end
on exitFrame me
case(keywait) of
0:
ix=1
miaw=window().new("courses/course_01/crs_01_01_0001/crs_01_01_0001")
miaw.open()
click=0
set keywait=1
1:
tell miaw
repeat with i=1 to the number of castlibs
repeat with j=1 to the number of members of castlib i
if member(j,i).type=#sound then
-- object = xtra("ExportSWF").new()
-- object.exportSWF( member(j,i), "D:\pic\l\"& member(j,i).Name&".swf")
member(j,i).copyToClipBoard()
ALERT(Member(J,I).nAME)
end if
end repeat
end repeat
--savemovie "输出文件名" --为输出的文件命名
end tell
forget(miaw)
set keywait=2
2:
set keywait="n"
"n":
cbm()
nothing
end case
go to the frame
end
然后是一段vb程序,加个按钮,按钮的事件中写:
Dim OBJ As IDataObject = Clipboard.GetDataObject()
If (OBJ.GetDataPresent(DataFormats.WaveAudio)) Then
Dim df As Stream = CType(OBJ.GetData(DataFormats.WaveAudio, True), Stream)
Dim inreader As BinaryReader = New BinaryReader(df)
inreader.BaseStream.Position = 0
Dim bt() As Byte
bt = inreader.ReadBytes(df.Length)
inreader.Close()
Dim fil As FileStream = New FileStream(String.Format("e:\3\{0}-{1}{2}{3}.wav", ix, Now.Day, Now.Minute, Now.Second), FileMode.OpenOrCreate)
Dim inwriter As BinaryWriter = New BinaryWriter(fil)
inwriter.Write(bt)
inwriter.Close()
ix = ix + 1
End If
操作方法是 线运行director程序,出现alert的时候,运行vb程序,点击按钮 就可以生成声音文件并保存到磁盘中
操作虽然麻烦,但是城功率是100%
|