Page 1 of 1

Lable color

Posted: 03 Jan 2013 15:18
by shamsudeen
Hi all,
i have added a script to open jpeg file Open with photoshop here is the script "Bro Highend posted this script"

$photoshop = "C:\Program Files\Adobe\Photoshop\Photoshop.exe";
run """$photoshop ""<curitem>""";
tag "Red";

i need some more script for my work that is when i open first time the Jpeg file will be labeled in Red color likewise when i open this same file again it must label with red and blue i will open the file three times . your help will be appreciated .

Thank you
Shamsudee S

Re: Lable color

Posted: 03 Jan 2013 16:03
by PeterH
Just one thing: there are async double quotes!

After first substitution of outer quotes the rest will be:
"$photoshop "<curitem>"
I don't think this is intended?

Re: Lable color

Posted: 03 Jan 2013 16:22
by shamsudeen
PeterH wrote:Just one thing: there are async double quotes!

After first substitution of outer quotes the rest will be:
"$photoshop "<curitem>"
I don't think this is intended?
Thanks for your reply, i needed to open a Jpeg file three times here i need to know how many times i have used or worked in the Jpeg file, whether it is twice or once or thrice

Thank you
Shamsudeen S

Re: Lable color

Posted: 03 Jan 2013 16:34
by Marco
I think it's impossible. How can you discern if a file has been modified once or twice or thrice?
Maybe storing the modified date in a database, but seems impractical and not fully reliable.

Re: Lable color

Posted: 03 Jan 2013 16:44
by highend
Sure it can be done.

Just read the tags before you set one.

No tags = never opened
Only red = opened once
Red & blue = opened twice
Red & blue & green = three times

Set the tags accordingly.

He just asked for "opened", not modified :)
As an alternative, the comment could be modified...

Re: Lable color

Posted: 03 Jan 2013 16:48
by Marco
Assuming he always uses the script to load/open such files, right?

Re: Lable color

Posted: 03 Jan 2013 17:09
by shamsudeen
highend wrote:Sure it can be done.

Just read the tags before you set one.

No tags = never opened
Only red = opened once
Red & blue = opened twice
Red & blue & green = three times

Set the tags accordingly.

He just asked for "opened", not modified :)
As an alternative, the comment could be modified...
You are right brother, how to do that in user defined commands open with photoshop using the same script.

Thank you

Re: Lable color

Posted: 05 Jan 2013 00:59
by highend
Labels are exclusive, so you can't colorize a file with more than one color.

So:

Code: Select all

    $photoshop = "C:\Program Files\Adobe\Photoshop\Photoshop.exe";
    run """$photoshop"" ""<curitem>""";
    $label = report("{Label}", "<curitem>");
    if($label == "") {
        tag "Green";
    } elseif($label == "Green") {
        tag "Orange";
    } elseif($label == "Orange") {
        tag "Red";
    }
Depending on how often you've executed that script on a specific file, it will set the label to green, orange and on the third time, red.

@PeterH
Missing double quotes fixed.

Re: Lable color

Posted: 05 Jan 2013 11:48
by PeterH
highend wrote:@PeterH
Missing double quotes fixed.
:biggrin: :appl:

Re: Lable color

Posted: 05 Jan 2013 16:07
by shamsudeen
highend wrote:Labels are exclusive, so you can't colorize a file with more than one color.

So:

Code: Select all

    $photoshop = "C:\Program Files\Adobe\Photoshop\Photoshop.exe";
    run """$photoshop"" ""<curitem>""";
    $label = report("{Label}", "<curitem>");
    if($label == "") {
        tag "Green";
    } elseif($label == "Green") {
        tag "Orange";
    } elseif($label == "Orange") {
        tag "Red";
    }
Depending on how often you've executed that script on a specific file, it will set the label to green, orange and on the third time, red.

@PeterH
Missing double quotes fixed.
it worked well. thank you brother