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

can one lift a file-name without the file.extension in javascript

Community Expert ,
Apr 22, 2008 Apr 22, 2008
I suspect this matter may have come up before but I could not find a thread on it ...
Anyway: If I grab a filename for later use with

var thedoc = app.activeDocument
var docName = thedoc.name

it picks up the original file-extension too.
Is there a way to avoid this or to »substract« the extension later on?

What I want to use that for is for saving multiple flattened CMYK-files from a layered RGB-psd-file into the same folder as the psd-file and appending a letter-combination to signify what printing-conditions they were generated for.

As Im plenty ignorant in Scripting-matters any help would be appreciated.
TOPICS
Actions and scripting
2.8K
Translate
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
Adobe
Explorer ,
Apr 22, 2008 Apr 22, 2008
>
> var thedoc = app.activeDocument
> var docName = thedoc.name

var basename = docName.match(/(.*)\.[^\.]+$/)[1];

This will choke if there is no '.' character in the name.

There may be a simpler way, but this was off the top of my head.

-X
--
for photoshop scripting solutions of all sorts
contact: xbytor@gmail.com
Translate
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
Community Expert ,
Apr 23, 2008 Apr 23, 2008
Thanks a lot, xbytor!
Im impressed ... very generous of You to offer help here.
Translate
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
Community Expert ,
Apr 24, 2008 Apr 24, 2008
Here I go again:
Originally I thought I would combine Actions and Scripts into a Droplet but then I got to thinking one Script containing all the operations would be neater.
However I cant figure out how to write the Color Conversion of the RGB-files to CMYK into the Script.
In »convertProfile« how do I address the ICC-Profiles and the Intent?

Once again help would be appreciated, as I simply cant seem to figure it out from the Adobe-documentation on Javascript or a web-search.
Translate
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
Community Expert ,
Apr 24, 2008 Apr 24, 2008
Never mind, I did figure it out:
thedoc.convertProfile ("ISO Web Coated", Intent.RELATIVECOLORIMETRIC, true, true)
Translate
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 ,
Mar 08, 2018 Mar 08, 2018

That's funny seeing you ever asked such question, now when you are so experienced scripter 😉

Translate
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
Community Expert ,
Mar 08, 2018 Mar 08, 2018
LATEST

Well, my Scripting still is somewhat patchy but I guess I have learned some things since back then.

Translate
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