// Make an alias to the Photoshop documentation for the ESTK (ExtendScript Toolkit) application // The documentation will show up in the Help->SDK menu // // For CS3 the PDF documents are here on a windows machine // - C:\Program Files\Adobe\Adobe Photoshop CS3\Scripting Guide // and this script will make a alias/shortcut to them here on a windows machine // - C:\Program Files\Adobe\Adobe Utilities\ExtendScript Toolkit 2\SDK // // This script will also restart the ESTK // // Use BridgeTalk so I can run it anywhere // keep track of how many files i alias, tells me if a restart of ESTK is needed var doARestart = 0; // list of files to copy var filesToAlias = [ "Photoshop CS3 JavaScript Ref.pdf", "Photoshop CS3 Scripting Guide.pdf", "Photoshop CS3 VBScript Ref.pdf" ]; // file home location, this only works for CS3 so target that specifically var photoshopScriptingPath = Folder( File( BridgeTalk.getAppPath("photoshop-10")).parent + "/Scripting Guide/" ); // alias target location, this is the CS3 ESTK var estkSDKPath = Folder( File( BridgeTalk.getAppPath("estoolkit-2.0")).parent + "/SDK/" ); for ( i in filesToAlias ) { var f = File( photoshopScriptingPath.toString() + "/" + filesToAlias[i] ); if ( f.exists ) { var t = File( estkSDKPath.toString() + "/" + filesToAlias[i] ); if ( ! t.exists ) { if ( ! t.createAlias( f ) ) { alert( "Could not create alias for " + t.toString() ); break; } else { doARestart++; } } } else { alert( "Source file does not exist where I think it should " + f.toString() ); break; } } if ( doARestart ) { if ( BridgeTalk.isRunning( "estoolkit-2.0" ) ) { if ( app.name == "ExtendScript Toolkit" ) { if ( confirm( "I can quit the toolkit, you will need to relaunch, Do you want me to do that now?" ) ) { var bt = new BridgeTalk; bt.body = "app.quit()"; bt.target = "estoolkit-2.0"; bt.send(); } } else { if ( confirm( "Do you want me to restart the ExtendScript Toolkit?" ) ) { var bt = new BridgeTalk; bt.body = "app.quit()"; bt.target = "estoolkit-2.0"; bt.send(); // wait 5 seconds and see if the darn thing actually quits first var t = new Timer(); while ( BridgeTalk.isRunning( "estoolkit-2.0" ) && t.getElapsed() < 5 ) ; // this do nothing makes us wait for 5 seconds BridgeTalk.launch( "estoolkit-2.0" ); } } } else { BridgeTalk.launch( "estoolkit-2.0" ); } } else { alert( "All files are up to date." ); } ////////////////////////////////////////// ////////////////////////////////////////// ////////////////////////////////////////// ////////////////////////////////////////// ////////////////////////////////////////// ////////////////////////////////////////// // Library for timing things in JavaScript ////////////////////////////////////////// function Timer() { // member properties, you shouldn't need to access them this.startTime = new Date(); this.endTime = new Date(); // member methods // reset the start time to now this.start = function () { this.startTime = new Date(); } // reset the end time to now this.stop = function () { this.endTime = new Date(); } // get the difference in milliseconds between start and stop this.getTime = function () { return ( this.endTime.getTime() - this.startTime.getTime() ) / 1000; } // get the current elapsed time from start to now, this sets the endTime this.getElapsed = function () { this.stop(); return this.getTime(); } }