Quantcast
Channel: Adobe Community : Popular Discussions - InDesign Scripting
Viewing all 15932 articles
Browse latest View live

How to call a variable file path in javascript

$
0
0

Hi,

 

My objective is to capture a file path on mac and windows. However, this file path gets changed with various users.

 

For example the path is:

 

c:\user\username\AppData\Local\Temp\myfolder------> this is for windows machine

 

/users/username/Library/Application Support/tempfolder/Temporary Files/-------> this is for mac machine

 

As you can see, the path will be same for all the machines. Only the difference will be in searching the user and username at the start of file path. Rest folders will remain same on all the machines.

 

Is there any grep pattern through which I can call this complete path in a variable for all the users.

 

Any help will be appreciated.

 

Regards,

 

Abhi


Automate cross reference script Indesign

$
0
0

Hi All

 

I have to reference more than 600 part numbers to their respective pages in my cross reference chart. I've created text anchors for every part number and now going through the process of inserting the cross references via the insert cross reference panel - text anchor - part number.

 

Image 2.jpg

 

 

 

I have a 100 pages to cross reference the process is proving too slow and tedious.

 

My question is there a script that will automate the cross reference page numbers without me having to manually go down the insert cross reference path?

Any input on how to get this done faster is much appreciated.

 

Regards

 

Mono

Create a build script for Extend Script

$
0
0

I have several scripts I want exported as binary via "File > Export as Binary" in ExtendScript Toolkit. I want to be able to call ESTK via shell script and tell it to compile that certain file.

GREP Exclude characters

$
0
0

Hello!

In my text the letter g means glossary. 

And I need DELETE all paragraph contains only numbers.  I mean, I need keep the paragraph if contain the cross references like the letter g and (See...)

Here you can see in color PINK the paragraph I need delete.

Screen Shot 2018-09-17 at 12.43.34.png

 

here is my code, but I don't know how can I EXCLUDE the other paragraph.

replaceTextUsingGREP ("+(\\d[–\\d, -]*\\d?) *","\r");

function replaceTextUsingGREP (input, output) { 
    app.findGrepPreferences = app.changeGrepPreferences = NothingEnum.nothing;     app.findGrepPreferences.findWhat = input;    app.changeGrepPreferences.changeTo = output;    var changedResults = app.activeDocument.changeGrep();    app.findGrepPreferences = app.changeGrepPreferences = NothingEnum.nothing; 
}

 

Thanks so much!

Release all anchored objects at once

$
0
0

Dear All, I want to release an all anchored objects from my file. All anchors are created inside the table. I am using InDesign CS4.

 

I have a file for 4 pages which is containing more than 150 images to be released from anchored. That images should be placed in the same place. Only need to release. I want to do this for more than 100 files (400 pgs. it may increase in future). I tried this in Search/replace option using Object, but only i can able to find using custom option in the anchor options panel, not able to relase using search and replace.

 

Please help me ASAP.

 

Thanks in Advance, Thiru

Check if a file exists in network dir (JS)

$
0
0

I've found an old post that has pointed me at:

 

if (myFile.exists){

alert("File Exists");

}

else

alert("File doesn't exist");

 

The problem is that when I use the path  macname/volumes/dir/folder/folder/file.indd (which was created from variables) as myFile the script doesn't find a file that I know exists. All I get is the "File doesn't exist" alert.

 

Do I need to define myFile as being a string?

 

I'm still fumbling my way around JS, and converting Applescripts to JS to work cross-platform. Thanks in advance....

UI dialog problem

$
0
0

Hi experts,

 

In Adobe CC version of InDesign, the Java Script UI has a problem, if active the ui, it will cause script jump out InDesign (if some folders are open) after run the script.

 

    var        w = new Window("dialog","UI_Stub", undefined, {closeButton: false}),         p = w.add("panel"),            mLine = p.add("group"),                mStat1 = mLine.add("statictext", undefined, "Leave left: "),                mEdit1 = mLine.add("edittext", undefined, ""),                mStat2 = mLine.add("statictext", undefined, " character(s)"),        mB = w.add("group");        mB.add ('button', undefined, "OK", {name: "OK"});          mB.add ('button', undefined, "Cancel", {name: "Cancel"});         mLine.alignChildren = "left";        mEdit1.characters = 3;        mB.spacing = 50;        mEdit1.active = true;        if (w.show() == 1);

 

 

I active the mEdit1

 

Thanks

John

 

dailog.gif

Replace the complete text of paragraphs of a particular style with text "abc".

$
0
0

Replace the complete paragraphs of a particular style with text "abc". When i do it the formatting of other paragraphs changed. Somehow i could not able to select the paragraph without "return".

 

var myDoc = app.documents.item(0);

 

var i, j;

 

app.findTextPreferences = NothingEnum.nothing;

app.changeTextPreferences = NothingEnum.nothing;

 

app.findTextPreferences.appliedParagraphStyle= "Body_light_strategy";

 

var myFound = myDoc.findText();

//var myChange = myDoc.changeText();

 

// change here

for(i=0; i<myFound.length ; i++)

 

{

           

            // myFound[i].remove();

             myFound[i].contents = "xx\r";

                   //alert(myFound[i]);

}

 

app.findTextPreferences = NothingEnum.nothing;

app.changeTextPreferences = NothingEnum.nothing;

 

alert("Done")


Mail Merge to multiple unique PDFs with unique names from one template

$
0
0

I can't seem to find any info on this scenario which I thought would be something a ton of people use. I have a template. I want to use a CSV file to export the template as multiple PDFs. This is because each PDF output will have a separate address phone number and be shared with an office that doesnt need any of the either info that I am importing from the csv. I don't want them all to "merge" into one PDF.

 

It would also be nice to be able to have each of the first cells used in the name. so it ends up being "template_brampton.pdf" "template_toronto.pdf" etc.

 

Thoughts on how to do this?

Character style overrides

$
0
0

How to remove the character style overrides.

 

Its working if the content is non XML. But its not working if its xml structure content.

 

How to check the applied character style if  whole paragraph applied character style.

 

 

var myDoc = app.activeDocument;

 

var mystories =  myDoc.stories;  

for (var i = 0; i < mystories.length ;i ++){  

    for (var j = 0; j < mystories[i].paragraphs.length ; j ++){  

      

        if (mystories[i].paragraphs[j].texts[0].appliedCharacterStyle.fontStyle.toString()  != 'NOTHING'  )         {  

              

                if (mystories[i].paragraphs[j].appliedParagraphStyle.fontStyle.toString() ==  mystories[i].paragraphs[j].appliedCharacterStyle.fontStyle.toString()){                                        

                   try {

                            mystories[i].paragraphs[j].appliedCharacterStyle = myDoc.allCharacterStyles[0];  

                            mystories[i].paragraphs[j].clearOverrides(OverrideType.CHARACTER_ONLY);

                          } catch(e){}

                  

} } } }

Run .bat file with arguments?

$
0
0

Hi,

 

   I need to run the .bat file with parameters/arguments in Adode Indesign JavaScript. "File.execute()" executes the file using the appropriate application.It executes the .bat file suceessfully.But I am unable to pass the arguments.I need to execute the command like

Eg : test.bat parameter1 parameter2

 

var myFile=new File("c:\\test.bat");

myFile.execute();

 

The above statements works fine. Is it possible to execute the with parameters. Please suggest the solution to above problem.

Font size script

$
0
0

Hi, i was hoping it was possible to create a script to reduce all fonts in a given document down a point size (example: a heading at 16pt and a paragraph text at 12pt would then become 15pt and 11pt respectivly). I ask because I have a document and paragraph styles have not been used!! So is this possible and if so could anyone help with coming up with a relevant script? It also has to be able to work within tables!

 

Many Thanks

 

Rob

Execute a VBScript inside a JavaScript

$
0
0

Hi there

How are you doing?

 

I´ve found an excellent script from IndiSnip [InDesign® Snippets] | Adobe® InDesign® Scripting Snippets

It´s a VBScript that I would like to use inside a JavaScript.

When I use it as a VBS file, everything works good, but I am not successful when I write it in JavaScript using the
app.doScript('My VBSCript line', ScriptLanguage.visualBasic);

I did it in many ways, I could not complete the script in debug mode.

Anyone could help me?

 

Link of script:

Get network adapter Name/MAC/Speed | IndiSnip [InDesign® Snippets]

 

Thanks

 

strComputer = "."

 

 

SetobjWMIService = GetObject("winmgmts:\\"& strComputer & "\root\cimv2")

SetIPConfigSet = objWMIService.ExecQuery ("SELECT * FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled = True")

 

SetobjWMI = GetObject("winmgmts:\\"& strComputer & "\root\WMI")

SetAdaptInfo = objWMI.InstancesOf("MSNdis_LinkSpeed WHERE Active = True",48)

 

ForEachadaptInfo in AdaptInfo

    AdaptNameLink = AdaptNameLink & adaptInfo.InstanceName & vbNewLine

    AdaptSpeed = AdaptSpeed & adaptInfo.NdisLinkSpeed & vbNewLine

Next

 

ForEachIPConfig in IPConfigSet

    IfNotIsNull(IPConfig.Description) Then

        AdaptName = AdaptName + IPConfig.Description & vbNewLine

    EndIf

    IfNotIsNull(IPConfig.MACAddress) Then

        MACadd = MACadd + IPConfig.MACAddress & vbNewLine

    EndIf

Next

 

app.scriptArgs.SetValue "myAdaptNameLink", AdaptNameLink

app.scriptArgs.SetValue "myAdaptSpeed", AdaptSpeed

app.scriptArgs.SetValue "myAdapt", AdaptName

app.scriptArgs.SetValue "myMAC", MACadd

export each layer of a InDesign file (with 5 pages) to its own PDF.

$
0
0

I'm not sure if this is possible...but I am looking for a way (possibly a script?) to export each layer of a InDesign file to its own PDF.

I have a 5 page indesign file and each page has 3 layers, so the exported pdf would have 15 pages. Does anyone know of a way to do this?

 

 

 

[Moved by moderator from InDesign to InDesign Scripting]

 

 

.

running footer page range 1-10

$
0
0

I need to set as the page ranges as a running footer like ( 1- 10) in the template for each and every pages. How to do this using text variable

 

I don't want to update the current page number

 

i need to updated the first page number - last page number


Script execution delay while re-booting the InDesign CC2018

$
0
0

Hi All,

Kindly advice on the below.

 

Our process:

1. Start to run the applescript,

2. The applescript close our current InDesign application,

3. Applescript move the fonts in Application Font folder

4. Applescript open the InDesign application

5. Once application was open, the Javascript execute to Unzip the font folder (getting more delay to execute the Javascript - more than 3min)

 

Note: But the same process is working with in a minute on CC2015 and 17.

 

Important: As per use requirement, no need to place the Javascript (check point 5) in 'Startup Script'

 

Anything need to disable or updated in CC2018?

 

 

 

 

 

Thanks in advance,

Selva

Dynamically populate InDesign file and publish

$
0
0

Greetings,

 

I have a database full of text and I would like to publish the data into a nicely designed InDesign file. I can easily dump the data into XML, JSON, or raw Text but is it possible to dynamically populate an InDesign file with this data then publish straight to PDF? Are there any examples of dyanmic data being published from an external source (like XML, JSON, etc.)?

determine if a document is open

$
0
0

I am looping through a folder of InDesign documents. Is there an easy way to check and see if a particular document is already open in InDesign? Thanks in advance. -Rick

Horizontal text alignment

$
0
0

Hello,

 

I need drop down list or radio buttons to align LEFT or CENTER or RIGHT to the selected text frame.

 

I want to modify the text alignment manually from the selection.

 

Please help me.

 

Thank you

script for running multiple find/change queries

$
0
0

Working on a large ID book document (*.indb), I have saved several dozens of Find/Change Queries (named "col01", "col02" etc.) that I run on "All documents". For a particular reason I have to run these queries several times a day.

 

So I was wondering whether there is, or whether anybody out there would write, a script that runs these queries one after the other. Given the size of the book, it might be necessary to provide for the script to pause after each query is run (before it goes on with the next), but I am just guessing.

 

Any help is much appreciated!

Viewing all 15932 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>