comparing strings / generic 'continue action' / skip opening to ACR

Anyone, especially newbies, asking for help with Photoshop Scripting and Photoshop Automation - as opposed to those contributing to discussion about an aspect of Photoshop Scripting

Moderators: Tom, Kukurykus

skrippy
Posts: 14
Joined: Sun Nov 27, 2016 5:34 am
Location: EU

comparing strings / generic 'continue action' / skip opening to ACR

Post by skrippy »

Question 1) is the one, but I'm grouping these cause they can all be seen as relating to potentially making a plugin out of an external program...

1) So what I've spent way too much time on is figuring out how to compare strings...

I'm having a program send a specific.tif (always the same) into Photoshop.
In my "Open document" event script, I want to check for this filename and if it's the one I want a stopped action to continue.

I can get the filename, but I can't find a way to have my string comparison trials working or be seen as good code.

Code: Select all


var doc = app.activeDocument;
var docName = doc.name;

// (a.o.) this is not working...:
If (docName == "specific.tif" ) {
// continue action
}
2) For the 'Continue action' (by default F1 key, I think), I can probably use the script listener code, but I'm seeing it's not generic and contains specifics about my continued action.

Is there a generic instruction to just "run/continue" the action, like pressing F1...? (when that is in focus in the actions panel)


3) I normally like to have all picture formats open in Camera Raw first, but in case of an automation, I'd like to be able to skip it for that specific picture.

I believe the setting to deal with this is only in Adobe Bridge now?
So would I be able or need to first run a script (instruction) that disables this pref in Bridge, and enable at the end?
And since Bridge often isn't even opened, does that make it impossible? (or impractical)

(BTW, this is the least of my problems; I disabled ACR for .tif files at the moment. Just wondering cause it would be nice to know.)


TIA! :)
JavierAroche
Posts: 29
Joined: Sat Jul 30, 2016 3:52 am
Location: San Francisco

Re: comparing strings / generic 'continue action' / skip opening to ACR

Post by JavierAroche »

1) So what I've spent way too much time on is figuring out how to compare strings...
You have a capital I in "If", it should be "if".

Code: Select all


var doc = app.activeDocument;
var docName = doc.name;

// (a.o.) this is not working...:
if (docName == "specific.tif" ) {
// continue action
}
If that's not the issue, maybe try forcing the document name to be a string?

Code: Select all

var docName = doc.name.toString();
2) For the 'Continue action' (by default F1 key, I think), I can probably use the script listener code, but I'm seeing it's not generic and contains specifics about my continued action.
What does the continue action do? Can you post what the script listener outputs?
skrippy
Posts: 14
Joined: Sun Nov 27, 2016 5:34 am
Location: EU

Re: comparing strings / generic 'continue action' / skip opening to ACR

Post by skrippy »

You have a capital I in "If", it should be "if".
Wow, thanks! I really should have caught that one... :oops: :mrgreen:
That's working now.
What does the continue action do? Can you post what the script listener outputs?
I have an action that feeds a pic to an external program (after which I have a midway STOP action step, waiting for the response). When the program sends the result to PS I want the action to continue and finish.

So I have this working now with the script listener code.
The problem is if I want a handful action variations and the code is pointing to a specific action (not generic). Then it could become "way complicated." (though I will think on using sub-actions to maybe help with that and keep the main one the same)

Code: Select all


if (docName == "specific.tif" ) {

// continue action (press F1 or play button) (script listener code)

var idPly = charIDToTypeID( "Ply " );
var desc3 = new ActionDescriptor();
var idnull = charIDToTypeID( "null" );
var ref1 = new ActionReference();
var idCmnd = charIDToTypeID( "Cmnd" );
ref1.putIndex( idCmnd, 8 );
var idActn = charIDToTypeID( "Actn" );
ref1.putName( idActn, "my ACTION NAME" );
var idASet = charIDToTypeID( "ASet" );
ref1.putName( idASet, "my ACTION SET" );
desc3.putReference( idnull, ref1 );
var idCntn = charIDToTypeID( "Cntn" );
desc3.putBoolean( idCntn, true );
executeAction( idPly, desc3, DialogModes.NO );

}
So I see 2 clear references to specifics (renamed "my ACTION NAME", "my ACTION SET") that I'd like to be generic.
"Cntn" may mean Continue at least :)
Maybe the specifics can be dropped and it will still work.

Thanks for your help, Javier :)