This repository was archived by the owner on Jul 13, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathcopy-article-number-to-clipboard.jsx
More file actions
69 lines (62 loc) · 1.72 KB
/
copy-article-number-to-clipboard.jsx
File metadata and controls
69 lines (62 loc) · 1.72 KB
1
(function (thisObj) { var doc = app.activeDocument; if (doc === null) { alert("No document"); return; } if (doc.selection.length === 0) { alert("No selction"); return; } var sel = app.selection[0]; if (sel.hasOwnProperty('images')) { if (sel.images.length === 0) return; var link = sel.images[0].itemLink; // if(link.needed === false){ // alert("embedded"); // return; // } // var path = ""; // if(link.status == LinkStatus.LINK_MISSING){ // alert("image is missing"); // return; // } // var img = File(path); // alert(img.path); myScript = 'do shell script "echo \''+ link.name.split("_")[0] +'\' | pbcopy"'; app.doScript(myScript, ScriptLanguage.applescriptLanguage); message("--- copied " + link.name.split("_")[0] + " to clipboard ---", 2000); } else{ alert("Not a image frame"); }/** * Taken from ScriptUI by Peter Kahrel * @usage * var progress_win = new Window ("palette"); * * var progress = progress_bar(progress_win, 100, 'my Progress'); * * progress.value = i++; * progress.parent.close();// important close it!! * * @param {Palette} w the palette the progress is shown on * @param {Number} stop [description] * @return {Progressbar} [description] */function message ( labeltext, millisec) {var w = new Window ("palette");var txt = w.add('statictext',undefined,labeltext);// var pbar = w.add ("progressbar", undefined, 1, stop); pbar.preferredSize = [300,20];w.show ();sleep(millisec);w.close();}function sleep(milliseconds) { var start = new Date().getTime(); for (var i = 0; i < 1e7; i++) { if ((new Date().getTime() - start) > milliseconds){ break; } }}})(this);