Вот так, вроде, получается.
Создаём файлы:
1) C:\Program Files (x86)\Common Files\Adobe\CEP\extensions\test\index.html
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<script src="./lib/CSInterface.js"></script>
<script type="text/javascript">
var csInterface = new CSInterface();
csInterface.registerKeyEventsInterest(JSON.stringify([
{"keyCode": 0x51}, //q
{"keyCode": 0x57} //w
]));
function evalScriptCallback(result)
{
if (result !== "undefined")
document.getElementById("selected").value = result;
}
function keyDownInBody(event)
{
if (event.keyCode == 0x51) //q
{
var ControlledEffect = "AE.ADBE Motion"; //effect matchName
var ControlledProperty = 1; //effect property scale
var step = 1; //increase/decrease value
csInterface.evalScript('var ControlledEffect = "' + ControlledEffect + '"; var ControlledProperty = ' + ControlledProperty + '; var step = ' + step + '; ' + document.getElementById("selected").value + '$._PPP_.ChangeEffectParameters()', evalScriptCallback);
}
else if (event.keyCode == 0x57) //w
{
var ControlledEffect = "AE.ADBE Motion"; //effect matchName
var ControlledProperty = 1; //effect property scale
var step = -1; //increase/decrease value
csInterface.evalScript('var ControlledEffect = "' + ControlledEffect + '"; var ControlledProperty = ' + ControlledProperty + '; var step = ' + step + '; ' + document.getElementById("selected").value + '$._PPP_.ChangeEffectParameters()', evalScriptCallback);
}
}
</script>
</head>
<body onkeydown="keyDownInBody(event)">
<input type="text" id="selected" value="var SelectedTrack = 0; var SelectedClip = 0; var SelectedEffect = 0;">
</body>
</html>
2) C:\Program Files (x86)\Common Files\Adobe\CEP\extensions\test\PProPanel.jsx
$._PPP_={
ChangeEffectParameters: function()
{
var NowSelectedTrack = SelectedTrack; var NowSelectedClip = SelectedClip; var NowSelectedEffect = SelectedEffect;
try {
var videoTracks = app.project.activeSequence.videoTracks;
}
catch(err) {
alert("Error!\nNo active sequence!");
return
}
try {
if (videoTracks[SelectedTrack].clips[SelectedClip].isSelected())
var clip = videoTracks[SelectedTrack].clips[SelectedClip];
}
catch(err) {
}
if (!clip)
{
exit_loops:
for (var i=0 ; i< videoTracks.numTracks ; i++)
{
for (var k=0 ; k< videoTracks[i].clips.numItems ; k++)
{
if (videoTracks[i].clips[k].isSelected())
{
var NowSelectedTrack = i; var NowSelectedClip = k;
var clip = videoTracks[i].clips[k];
break exit_loops;
}
}
}
}
if (!clip)
{
alert("Error!\nNo clip selected!");
return
}
var effects = clip.components;
try {
if (effects[SelectedEffect].matchName == ControlledEffect)
var effect = effects[SelectedEffect];
}
catch(err) {
}
if (!effect)
{
for (var l=0 ; l< effects.numItems ; l++)
{
if (effects[l].matchName == ControlledEffect)
{
var NowSelectedEffect = l;
var effect = effects[l];
break;
}
}
}
if (!effect)
{
alert("Error!\nNo such effect!");
return
}
var property = effect.properties[ControlledProperty];
if (property.isTimeVarying())
{
alert("Error!\nParameter has keyframes!");
return
}
var value = property.getValue();
property.setValue(value + step, true);
if (NowSelectedTrack == SelectedTrack && NowSelectedClip == SelectedClip && NowSelectedEffect == SelectedEffect)
return
else
return ('var SelectedTrack = ' + NowSelectedTrack + '; var SelectedClip = ' + NowSelectedClip + '; var SelectedEffect = ' + NowSelectedEffect + ';');
}
}
C:\Program Files (x86)\Common Files\Adobe\CEP\extensions\test\CSXS\manifest.xml
<?xml version="1.0" encoding="UTF-8"?>
<!--
/*************************************************************************
* ADOBE CONFIDENTIAL
* ___________________
*
* Copyright 2014 Adobe
* All Rights Reserved.
*
* NOTICE: Adobe permits you to use, modify, and distribute this file in
* accordance with the terms of the Adobe license agreement accompanying
* it. If you have received this file from a source other than Adobe,
* then your use, modification, or distribution of it requires the prior
* written permission of Adobe.
**************************************************************************/
-->
<ExtensionManifest Version="5.0" ExtensionBundleId="com.adobe.PProPanel" ExtensionBundleVersion="11.1"
ExtensionBundleName="Premiere Pro sample panel"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<ExtensionList>
<Extension Id="com.adobe.PProPanel" Version="10.3.0" />
</ExtensionList>
<ExecutionEnvironment>
<HostList>
<Host Name="PPRO" Version="9.0" />
</HostList>
<LocaleList>
<Locale Code="All" />
</LocaleList>
<RequiredRuntimeList>
<RequiredRuntime Name="CSXS" Version="6.0" />
</RequiredRuntimeList>
</ExecutionEnvironment>
<DispatchInfoList>
<Extension Id="com.adobe.PProPanel">
<DispatchInfo >
<Resources>
<MainPath>./index.html</MainPath>
<ScriptPath>./PProPanel.jsx</ScriptPath>
<CEFCommandLine>
<Parameter>--allow-file-access</Parameter>
<Parameter>--allow-file-access-from-files</Parameter>
</CEFCommandLine>
</Resources>
<Lifecycle>
<AutoVisible>false</AutoVisible>
<StartOn>
<!-- Premiere Pro dispatches this event on startup -->
<Event>com.adobe.csxs.events.ApplicationActivate</Event>
</StartOn>
</Lifecycle>
<UI>
<Type>Modeless</Type>
<Menu>PProPanel (SDK sample panel)</Menu>
<Geometry>
<Size>
<Height>300</Height>
<Width>180</Width>
</Size>
</Geometry>
</UI>
</DispatchInfo>
</Extension>
</DispatchInfoList>
</ExtensionManifest>
Скрипт автохотки:
SleepDuration := 5
FirstPressDelay := 0.15
#InstallKeybdHook
#InstallMouseHook
#UseHook
DetectHiddenWindows, On
#If WinActive("ahk_exe Adobe Premiere Pro.exe") and WinExist("Script Alert ahk_exe Adobe Premiere Pro.exe")
q::
w::
return
#If WinActive("ahk_exe Adobe Premiere Pro.exe")
q::
w::
SetBatchLines -1
SetKeyDelay, -1, -1
If (A_PriorKey != "q") and (A_PriorKey != "w")
{
SetControlDelay -1
ControlClick, Chrome_WidgetWin_01, ahk_exe Adobe Premiere Pro.exe, Chrome Legacy Window,,, NA
loop
{
ControlGetFocus, Focus, ahk_exe Adobe Premiere Pro.exe, Chrome Legacy Window
if (Focus = "Chrome_WidgetWin_01")
break
}
}
KeyWait, %A_ThisHotkey%, T%FirstPressDelay%
If ErrorLevel
{
DllCall("Winmm\timeBeginPeriod", UInt, 3)
loop
{
if !GetKeyState(A_ThisHotKey, "P")
break
SendInput {%A_ThisHotKey%}
loop % SleepDuration
DllCall("Sleep", UInt, 1)
}
DllCall("Winmm\timeEndPeriod", UInt, 3)
}
Else
SendInput {%A_ThisHotKey%}
Теперь при нажатии q,e выделенный клип будет уменьшаться/увеличиваться.
В манифесте я прописал автозапуск в скрытом режиме.
Для изменения параметров эффекта с ключами нужно прописывать отдельно условия, можешь этим заняться - мне лень .
Скорость уменьшения/увеличения значений эффекта при зажатии кнопки прописывается в автохотки.
SleepDuration - пауза между посыланием кнопок во время зажатия.
FirstPressDelay - время после нажатия кнопки за которое скрипт определяет, кнопка зажата или нет.
Так как я сижу на премьере 2017 года, то последнее их апи у меня не работает, а там есть, вроде, отлавливание событий изменения выделения на линейке:
https://github.com/A...anel/ext.js#L55
csInterface.evalScript('$._PPP_.registerSequenceSelectionChangedFxn()'); // Selection within the active sequence changed
https://github.com/A...miere.jsx#L1973
registerSequenceSelectionChangedFxn : function() {
var success = app.bind('onActiveSequenceSelectionChanged', $._PPP_.myActiveSequenceSelectionChangedFxn);
},
https://github.com/A...miere.jsx#L1958
myActiveSequenceSelectionChangedFxn : function() {
var sel = app.project.activeSequence.getSelection();
$._PPP_.updateEventPanel('Current active sequence = ' + app.project.activeSequence.name + '.');
$._PPP_.updateEventPanel( sel.length + ' track items selected.');
for(var i = 0; i < sel.length; i++){
if (sel[i].name !== 'anonymous'){
$._PPP_.updateEventPanel('Selected item ' + (i+1) + ' == ' + sel[i].name + '.');
}
}
}
Сообщение отредактировано Malcev: 12 Nov 2018 - 08:17