This is a script I made for a coworker that works in Version Cue a lot. This will popup and ask if the user wants to sync the file in VC every time they save a file that is from VC - goal is the prevent users from unintentionally saving the file outside of VC.
Bind this script to the "Save Document" event under the Script Event Manager.
Code: Select all#script "Save a Version";
// File -> Save a Version... pulled from script listener
function saveVersion()
{
try
{
var id121 = charIDToTypeID( "save" );
var desc25 = new ActionDescriptor();
var id122 = charIDToTypeID( "Vrsn" );
desc25.putBoolean( id122, true );
var id123 = stringIDToTypeID( "comment" );
desc25.putString( id123, "whatever" );
executeAction( id121, desc25, DialogModes.NO );
}
catch (e)
{ // display error
}
};
// main routine
function main()
{
try
{
// reference active document
var docRef = app.activeDocument;
// if it is a version cue doc
if (docRef.managed == true) {
// ask to sync
var userinput = confirm("Sync in Version Cue?", true);
// if they choose yes
if (userinput == true) {
// sync in version cue
saveVersion();
};
};
}
catch (e)
{ // display error
alert("Script failed! \r\r" + e);
}
};
main();
Patrick