Copy link to clipboard
Copied
Hi,
I've been using doScript recently, because I want to be able to undo my script (which makes many changes) by pressing ctrl-z once.
The thing is, as far as I can see, you have to turn the entire script into a string, which means going to the end of the line and deleting the linebreak.
(I'm avoiding putting the script in a file and calling that file, because I want to be able to send this script to other people with minimum hassle.)
Is there any quick way of turning a 30-line script into one long string?
Thanks,
Ariel
Copy link to clipboard
Copied
Untested, but perhaps it will do the trick
app.doScript("myFunction();",ScriptLanguage.JAVASCRIPT);
function myFunction() {
alert("Function was called");
}
I think i have read that you can actually disable the undo history while the script runs, so only the script itself will be in the history.
--
Thomas B. Nielsen
http://www.nobrainer.dk
Copy link to clipboard
Copied
Thanks Thomas,
It doesn't seem to work. But nice idea.
If there is a way to disable the undo history, then that's definitely what I'm looking for. I did do a search, and all I found was this technique of using doScript.
Thanks,
Ariel
Copy link to clipboard
Copied
You do not need to turn the script into a string.
Here's what you do...
app.doScript (main, undefined, undefined,UndoModes.FAST_ENTIRE_SCRIPT, "My Fancy Script");
function main(){
//your script body here...
}
Harbs
Copy link to clipboard
Copied
Thanks Harbs!
That works perfectly.
Thomas, I see your idea was halfway there!
Thanks,
Ariel
Find more inspiration, events, and resources on the new Adobe Community
Explore Now