关于RMEVENTS.EXE文件的使用问题.(50分)

  • 主题发起人 主题发起人 北狼
  • 开始时间 开始时间

北狼

Unregistered / Unconfirmed
GUEST, unregistred user!
查了相关资料,该文件只能在realplay plus(好像是这个吧)的安装目录运行.
但Real媒体过滤器 1.0怎么可以放在临时目录中运行,郁闷呢,有人知道吗?
Real媒体过滤器 1.0的代码如下:易语言的吧.

!include "MUI.nsh"
!define MUI_ICON "./Sources/Realone.ico"
SetCompressor lzma
Caption "Real 媒体过滤器"
OutFile "realfilter.exe"
InstallButtonText "开始过滤(&S)"
ShowInstDetails nevershow
AutoCloseWindow true
BrandingText "编译于 ${__TIMESTAMP__}"

Page custom SetCustom LeaveCustom
!define MUI_PAGE_HEADER_TEXT "正在过滤"
!define MUI_PAGE_HEADER_SUBTEXT "请稍候"
!insertmacro MUI_PAGE_INSTFILES

!insertmacro MUI_LANGUAGE "SimpChinese"

LangString TEXT_IO_TITLE ${LANG_ENGLISH} "这是 rmevents.exe 的简易界面程序。"
LangString TEXT_IO_SUBTITLE ${LANG_ENGLISH} "它能去掉 Real 媒体中一些外加的特效与网页链接。"

ReserveFile "./sources/pncrt.dll"
ReserveFile "./sources/rmevents.exe"
ReserveFile "./sources/Tools/rmto3260.dll"

Function .onInit
InitPluginsDir
File /oname=$PLUGINSDIR/filter.ini "./filter.ini"
FunctionEnd

Var hwnd

Function SetCustom
InstallOptions::initDialog /NOUNLOAD "$PLUGINSDIR/filter.ini"
Pop $hwnd
!insertmacro MUI_HEADER_TEXT "$(TEXT_IO_TITLE)" "$(TEXT_IO_SUBTITLE)"

InstallOptions::show
FunctionEnd

Function LeaveCustom
ReadINIStr $R2 "$PLUGINSDIR/filter.ini" "Settings" "State"
StrCmp $R2 0 validate
StrCmp $R2 2 addfile
Abort

addfile:
ReadINIStr $0 "$PLUGINSDIR/filter.ini" "Field 2" "State"
Push $0
Call check
Call addext

Pop $0
GetDlgItem $1 $hwnd 1204
SendMessage $1 0xC 0 "STR:$0"
Abort
validate:

ReadINIStr $0 "$PLUGINSDIR/filter.ini" "Field 2" "State"
StrCmp $0 "" 0 +3
MessageBox mb_ok|MB_ICONINFORMATION "请选择源文件!"
abort

ReadINIStr $0 "$PLUGINSDIR/filter.ini" "Field 4" "State"
StrCmp $0 "" 0 +3
MessageBox mb_ok|MB_ICONINFORMATION "请选择保存目标!"
abort

FunctionEnd

Var tmp
Var size


Section
SetOutPath "$PLUGINSDIR/Tools"
File "./sources/Tools/rmto3260.dll"
SetOutPath "$PLUGINSDIR"
File "./sources/pncrt.dll"
File "./sources/rmevents.exe"
File "./sources/temp.txt"

ReadINIStr $R0 "$PLUGINSDIR/filter.ini" "Field 2" "State"
ReadINIStr $R1 "$PLUGINSDIR/filter.ini" "Field 4" "State"
StrCmp $R0 $R1 0 +3
StrCpy $R1 "$R1.tmp"
StrCpy $tmp 1

ClearErrors
FileOpen $0 "$R0" r
IfErrors ReadDone
FileSeek $0 0 END $size
FileClose $0
ReadDone:

DetailPrint "正在过滤源文件,请稍候……"

ReadINIStr $0 "$PLUGINSDIR/filter.ini" "Field 6" "State"
StrCmp $0 1 0 +3
nsExec::Exec 'rmevents.exe -i "$R0" -e temp.txt -o "$R1"'
Goto cmdend
DetailPrint "正在过滤源文件,请稍候……"
SetDetailsPrint none
ExecWait 'rmevents.exe -i "$R0" -e temp.txt -o "$R1"' $0
StrCmp $0 0 cmdend
MessageBox MB_OK|mb_iconstop "程序意外退出!$/n$/n错误代码:$0"
cmdend:

StrCmp $tmp 1 0 filterend
StrCpy $R2 $R1 -4
Delete "$R2"
Rename "$R1" "$R2"
filterend:

SectionEnd

Function .onInstSuccess
HideWindow

StrCmp $tmp 1 0 +2
StrCpy $R1 $R2

ClearErrors
FileOpen $0 "$R1" r
IfErrors ReadDone
FileSeek $0 0 END $R3
FileClose $0
ReadDone:

IntOp $R4 $size - $R3
MessageBox MB_OK|mb_iconinformation "过滤完成!$/n$/n源文件大小:$size字节,目标文件大小:$R3,目标文件减少了$R4字节.$/n$/n目标文件保存在:$R1"

FunctionEnd

Function addext
Pop $0

StrCpy $1 1
StrLen $2 $0
loop:
IntCmp $1 $2 0 0 end
StrCpy $R0 $0 1 -$1
StrCmp $R0 "." 0 +6
IntOp $2 $2 - $1
StrCpy $3 $0 $2
StrCpy $4 $0 "" -$1
StrCpy $3 "$3_noadv$4"
Goto end
IntOp $1 $1 + 1
goto loop
end:
Push $3
FunctionEnd

Function check
Pop $0
StrCpy $1 1
StrLen $2 $0
loop:
IntCmp $1 $2 0 0 end
StrCpy $R0 $0 1 -$1
StrCmp $R0 "." 0 +7
StrCpy $R0 $0 "" -$1
StrCmp $R0 ".rmvb" +4
StrCmp $R0 ".rm" +3
MessageBox MB_yesno|mb_iconquestion "你输入的文件后缀为 $R0,这可能不是 Real 媒体。是否退出?" idno +2
Quit
goto end
IntOp $1 $1 + 1
Goto loop
end:
push $0
FunctionEnd

那我要在DELPHI里实现,该如何做呢?
 
后退
顶部