2008-09-23 74 views

回答

4

您可以在文檔和示例代碼中找到如何使用註冊表條目選擇性安裝文件的答案,但它可能並不明顯,因此以下是一些使用Adobe Premiere插件的示例腳本片段作爲示例:

的關鍵步驟是:

1)使用檢查:參數

2)編寫調用RegQueryStringValue的函數並解析路徑來構造的相對插件文件夾目的地

3)使用{代碼:}調用一個函數返回的目標文件夾

// 
// Copy my plugin file to the Premiere Plugin folder, but only if Premiere is installed. 
// 
[Files] 
Source: "C:\sourceFiles\myplugin.prm"; Check: GetPremierePluginDestination; DestDir: "{code:PluginDestination}"; Flags: ignoreversion overwritereadonly 

[Code] 

var sPluginDest : String; 

// 
// Search for the path where Premiere Pro was installed. Return true if path found. 
// Set variable to plugin folder 
// 

function GetPremierePluginDestination(): Boolean; 
var 
    i:  Integer; 
    len: Integer; 

begin 
    sPluginDest := ''; 

    RegQueryStringValue(HKLM, 'SOFTWARE\Adobe\Premiere Pro\CurrentVersion', 'Plug-InsDir', sPluginDest); 
    len := Length(sPluginDest); 
    if len > 0 then 
    begin 
    i := len; 
    while sPluginDest[i] <> '\' do 
     begin 
     i := i-1; 
     end; 

    i := i+1; 
    Delete(sPluginDest, i, Len-i+1); 
    Insert('Common', sPluginDest, i); 
    end; 
    Result := len > 0; 
end; 

// 
// Use this function to return path to install plugin 
// 
function PluginDestination(Param: String) : String; 
begin 
    Result := sPluginDest; 
end; 

我不是一個程序員帕斯卡爾等使GetPremiereDestination更高效的任何建議,歡迎。

相關問題