Skip to content

Instantly share code, notes, and snippets.

@bigxixi
Last active December 7, 2017 10:04
Show Gist options
  • Save bigxixi/7f66c867a7ab25f3d5e985a353cd018e to your computer and use it in GitHub Desktop.
Save bigxixi/7f66c867a7ab25f3d5e985a353cd018e to your computer and use it in GitHub Desktop.
Run AE script directly in AE.
(function drawUI(thisObj)
{
function UI(thisObj){
var win = (thisObj instanceof Panel) ? thisObj : new Window("palette","Run Script",[0,0,500,450],{resizeable:true,});
if(win != null){
var btn = win.add("button",[180,415,330,435],"Run");
var script = win.add("edittext",[5,5,505,405] ,"Paste your code here, and run to test.",{readonly:0,noecho:0,borderless:0,multiline:1,enterKeySignalsOnChange:0});
btn.onClick = function(){
if(!app.preferences.getPrefAsLong("Main Pref Section", "Pref_SCRIPTING_FILE_NETWORK_SECURITY")){
alert("Please check this option:\n'Preferences->General->Allow Scripts to Write Files and Access Network'");
app.executeCommand(2359);
}else{
eval(script.text);
}
};
}else{
alert("Faile to run the script, please try again.");
}
return win;
}
if(parseFloat(app.version) < 9.0){
alert("Your AE version is too low to run the script...")
}else{
var drawPanel = UI(thisObj);
if(drawPanel !== null){
if(drawPanel instanceof Window){
drawPanel.center();
drawPanel.show();
}else{
drawPanel.layout.layout(true);
}
}
}
})(this)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment