• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Refresh filename/ path halfway through script

Contributor ,
Jun 15, 2021 Jun 15, 2021

Copy link to clipboard

Copied

I have a script that renames files and then passes them across to photoshop. 

the only problem being that it doesnt update the filenames, so the photoshop script cant open the renamed files.

How do i refresh the filenames/ paths of a selection in bridge

 i see something called refreshInfoset() in the bridge SDK but cant get it working. 

//this is the thumbnail object im trying to refresh
sel1[0].core.immediate.name

 

TOPICS
Scripting

Views

177

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

LEGEND , Jun 15, 2021 Jun 15, 2021

If you are renaming files, you already have the new filename in a variable, right? Otherwise use thumbnail/spec as the object and get one of the several name properties.

Votes

Translate

Translate
LEGEND ,
Jun 15, 2021 Jun 15, 2021

Copy link to clipboard

Copied

If you are renaming files, you already have the new filename in a variable, right? Otherwise use thumbnail/spec as the object and get one of the several name properties.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Jun 15, 2021 Jun 15, 2021

Copy link to clipboard

Copied

That's a fair point that did the trick! Many thanks for the script as well useful to see 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jun 15, 2021 Jun 15, 2021

Copy link to clipboard

Copied

LATEST

I have a bunch of scripts and tools on my Dropbox, all open source.

Adobe Scripts

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jun 15, 2021 Jun 15, 2021

Copy link to clipboard

Copied

Here is a script that doesn't use filenames. So you should be able to rename selections and then pass the files to PS. I have not tested renaming, however.

 

/*
Utility Pack Scripts created by David M. Converse ©2018-21

This script allows opening files directly into Photoshop, bypassing ACR

Last modified 6/7/2021

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

APACHE LICENSE, VERSION 2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
#target bridge
if(BridgeTalk.appName == "bridge"){
var openCommand = MenuElement.create('command', 'Open Directly', 'after Thumbnail/Open', this.menuID); //add to Contextual menu
}

openCommand.onSelect = function(){
openDirect();
}

function openDirect(){
try{
var t = app.document.selections;
var files = new Array();
for(var i = 0;i < t.length;i++){
if(t[i].spec instanceof File){
files.push(t[i].spec);
}
}
if(files.length > 0){
var scr = "var thumbs = eval(" + files.toSource() + "); for(var i = 0; i < thumbs.length;i++){photoshop.open(new File(thumbs[i]));}";
var bt = new BridgeTalk();
bt.target = 'photoshop';
bt.body = scr;
bt.onError = function(eObj){ retval = false; $.writeln(eObj.body); }
bt.send();
}
else{
alert('No files chosen.');
retval = false;
}
return retval;
}
catch(e){
}
}

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines