Hello Friends, I am new in InDesign Java Script
Hello Friends,
I am new in InDesign Java Script. I want to edit the page's master text Frame Object through Java Script. Any Idea regarding this will help me a lot.
thanks in advance
Have you read any of the documentation? It doesn't seem so :-)
Vivek Singh, the documentation is a great tool for understanding object model. Once you got the main concept of hierarchy between objects, accessing objects is quite a child game.
I am not meaning scripting is easy but have a look on the documentation, it's a essential starting point. I bought too the Peter Karhel's guide
http://oreilly.com/catalog/9780596528171/index.html
it's really cheap regarding to the quality of the learning.
Welcome in this world.
BTW, masterspreads is a property of document. So you should work with something like :
app.activeDocument.masterSpreads[0].xxx
Loic
Similar Messages
-
New to Java Script(Want to open a new window using Java Script)
Hi all,
I am new to using Java Script. Now I have a HTML(First.html) page with a ADD button at the end of the page. What I want to know is, if I drag and select some part of the First.html and click on the ADD button a second HTML page(Second.html) should open displaying only the selected contents....
Please help :-(myRef = window.open(self.location,'mywin',
'left=20,top=20,width=500,height=500,toolbar=1,resizable=0'); -
Indesign Java Script running error
Hi
I am new in indesign scripting
I want to create indesign Application using java script and without using ExtendScript ToolKit
In this case how create app (the application object).
if i use ExtendScript ToolKit then there is no need to create application object. app is bydefault
But i do not want to use of ExtendScript ToolKit .
I want to create simple java script using
<script type="text/javascript">
//body
</script>
when i run my java script (.js) file then it create indesign Application (instance).
For example on mac in Apple Script when i run my apple script
tell application "Adobe InDesign CS5.5"
set myDocument to make document with properties
end tell
in apple script editor which is inbuild with mac, Indesign Application start(create) sucessfully.
There is no need any ExtendScript ToolKit type tool to run (start) indesign application.
only script line tell application "Adobe InDesign CS5.5" create application instance.
In VBScript we create application object using this :
VBScript
Set myInDesign = CreateObject("InDesign.Application")
In Java Script how create Indesign Application Object.
I try to create Indesign Application object but not sucess.
<!DOCTYPE HTML>
<html>
<head>
<title>Testing JavaScript</title>
</head>
<body>
<script type="text/javascript">
var app = CreateObject("InDesign.Application");
var myDocument = app.documents.add();
var myTextFrame = myDocument.pages.item(0).textFrames.add();
myTextFrame.geometricBounds = ["6p", "6p", "24p", "24p"];
myTextFrame.contents = "Hello World!";
</script>
</body>
</html>
How create Indesign application Object using JavaScript ?Thanks Mark for reply
I put my script at Trusted location C:\\Documents and Settings\\Administrator\\My Documents\\Adobe Scripts\\NewSript.jsx
Now I want to execute my script using below method but it not execute and return message "No documents open".
#include "indesign.h"
INDESIGN::_Application oApplication;
if(oApplication.CreateDispatch(L"InDesign.Application") ==0) // it start Indesign Application
// Dispatch is not created
CString ScriptPath =L"C:\\Documents and Settings\\Administrator\\My Documents\\Adobe Scripts\\NewSript.jsx";
oApplication.DoScript(COleVariant(ScriptPath),long(1246973031),covOpti onal,long(1699967573),ScriptPath);
It prompt message "No document open". While I double click on NewScript.jsx it run sucessfully.
General syntex of oApplication.DoScript() is
any doScript (script: varies[, language: ScriptLanguage=ScriptLanguage.UNKNOWN][, withArguments: Array of any][, undoMode: UndoModes=UndoModes.SCRIPT_REQUEST][, undoName: string=Script])
Executes the script in the specified language as a single transaction.
I use long(1246973031) for The java script language.
I do not understand where is problem.
my .jsx file data is
var myDocument = app.activeDocument;
var myTextFrame = myDocument.pages.item(0).textFrames.add();
myTextFrame.geometricBounds = ["6p", "25p", "30p", "30p"];
myTextFrame.contents = "Adobe Indesign !"
Thanks -
Spawn a new PDF using Java Script within LC Designer
I am trying to spawn a new PDF file to be created from an existing PDF using Java Script within the LC designer
I have this example but I can't get it to work
function createPdf()
pdf = pdf$();
pdf.addText('Hello World');
pdf.writeToFile('c:/temp/hello_world.pdf');
window.open('file://c:/temp/hello_world.pdf');
Is it possible to create a PDF like this within LC Designer?Hi
I would like to see if it was possible. I thought it would be easy, as
there is a standard batch processing sequence (Print 1st page of all) using
Java that comes with Acrobat 7. This allows you to print the first page of
a number of files that you select when the sequence is run. Its code is:
/* Print 1st Page */
/* This sequence prints the first page of
each document selected to the default printer.
this.print
To my uninformed mind it seemed logical that the same code, slightly
modified to print all pages, should work from within a form.
Anyway, if there is a way to choose individual files, I would appreciate
that.
Thanks
Rob -
Hi Friends,
I am new to indesign scripting in vb.net. I just want to know how to start the scripting. I need some basics. Please let me know if there is any good sites to improve my basics and dive into the development.
Thanks,
SureshHi Ole,
In that tutorial, only javascipt, vbscript and applescripts are availble. I am looking for vb.net scripts. Now i am trying with that above mentioned scripts.
Thanks,
Suresh -
Hello,
As I know, we can use Java script to create client side menu. So user can browser through the menu tree to select the page they want.
My question is, Can we add more functionnality to this menu tree, so the menu can be anything but URL? ( For example, user browser the menu tree, click a link(or a button?) and call some function(which also writon in Java script) on the client side to perform some action other than call a linked page)
Thanks
Hui luHi,
You can try like this:
//in the <head> section write:
<script language="javascript">
function callFunc(){
//some code of yours
</script>
//On the menu item write this code:
<a href = 'javascript:callFunc();'>
Hope this will serve.
atanu -
CPU usage spikes while viewing webpage with java script
Can anyone tell me if it is normal for cpu use to spike up to 90% when I view a webpage that's using javascript? It is a scrolling news headline using java script 1.2 in the webpage.
ThanksFortunately, while my temps do go up and fan speed increases, mine does not become exceedingly loud. I apparently have a lot of good karma stored up because both the original midplane and its replacement - bad caps - have had quiet fans.
-
Can I post here(Acrobat Windows) Java Script questions here?
Hello
Can I post here(Acrobat Windows) Java Script questions here? If not, wht is the correct forum?
THank youBack up and down to Acrobat Scripting. Bot Windows and MacIntosh Acrobat versions use the same JavaScript.
If you are using LIVECYCLE DESIGNER use their forums. The JavaScript syntax and objects are different in LIVECYCLE DESIGNER! -
How create indesign using Java Script
I am new in indesign and want to create indesign application using JavaScript.
When i use AppleScript to create Indesign Application i use this statement
tell application "Adobe InDesign CS5.5"
set myDocument to make document with properties
end tell
Indesign Application create sucessfully.
How create Indesign Application using JavaScript ?
or what is equivelent statement of ( tell application "Adobe InDesign CS5.5" ) in Java Script.
There are some java scripting example given on forum or in sdk.These all example start with app.
when I debug these java script using ExtendScript ToolKit 3.6 It give error on app (undefined app).I think this app ia application object.
How create indesign application object app in javascript ?
While this script run sucessfully when i put these script in C:\Program Files\Adobe\Adobe InDesign CS5.5\Scripts
and to run these script use Scripts panel (choose Window > Utilities > Scripts), then double-click the script name in the Scripts panel in indesign application.But In this case first i start indesign application and then choose Window > Utilities > Scripts then double-click the script name in the Scripts panel.
I want to create Indesign Application (instance) using JavaScript.When I run or (debug) my JavaScript in any javaScript tool like ExtendScript ToolKit 3.6 then Indesign application should start, like in Apple Script.
ThanksThanks Vamitul for reply
For example when i run SelectObjects.jsx An InDesign CS5.5 JavaScript in ESTK then message prompt "Target Adove Indesign CS5.5 is not running. Do you want to lanch." Then on click yes Indesign application start.
I want to Know how indesign object "app" is created to start Indesign application on click yes.
http://wwwimages.adobe.com/www.adobe.com/content/dam/Adobe/en/devnet/indesign/cs55-docs/In DesignScripting/InDesign-ScriptingTutorial.pdf
Like in VB to create indesign object we use CreateObject("InDesign.Application"). In javascript how create object say "app" of InDesign Application.
For example if i write
var myDocument = app.documents.add();
var myTextFrame = myDocument.pages.item(0).textFrames.add();
myTextFrame.geometricBounds = ["6p", "6p", "24p", "24p"];
myTextFrame.contents = "Hello World!";
in a simple text file and save it with .js extention and to open this double click on this it give error undefined "app".
Source :Microsoft JScript runtime error
So how define "app" or create indesign object ?
Thanks -
Add xml Tags in Indesign CS4 by Apple/Java script
Hi,
All, I'm new to Indesign Scripting, and I'm hoping someone can help me with the following add xml tags in my xml indesign cs4 files.
I have IDML (ETMV2) xml Indesign CS4 files. But i have lots of powermath equation without xml tags. So i want how i can insert xml tags.
My probleam like this =>
<no open xml tags>[&x^{2}+y_{3}&]<no close xml tags>
I want like this (But i do manualy)
<inlineequation><inlinemediaobject><textobject role="xpressmath">[&x^{2}+y_{3}&</textobject></inlinemediaobject></inlineequation>
Can anyone write/suggest me how i can add xml Tags. By Apple/Java Script
Any insight is appreciated!
snegigHi,
John Hawkinson thank you so much your suggestion.
I am new this type of discusion (on this page). So i think anybody could not replay my answer. So i repost my question.
I want insert tags in my Indesign CS4 files. Is this posible when i select my powermath equaiton then run script. Script add tags automatically before/after my equation. Please ignore IDML word.
Yes i an comfortable with XSLT presently i working with Pearson ETMV2.
I have one more question when i past my snapshot its appear properly but when i agin see my commant then my snapshot disappear (see small blue rectangle).
Thank you John again i am new in this industry please guide.
snegig -
Java script application appearing everytime i open a new tab
Hi,
Everytime I open a new tab on my computer, a message pops up with Java script application in a box with a yellow triangle with an exclamation mark symbol. I have to click ok twice before I can continue using the internet.
Can you please tell me how to fix this, I think this happened after I upgraded my mozilla website.hello annap2677, you have quite a few malicious addons present. please try these steps:
# [[Reset Firefox – easily fix most problems|reset firefox]] (this will keep your bookmarks and passwords)
# afterwards go to ''firefox > addons > extensions'' and in case there are still extensions listed there, disable them.
# finally run a full scan of your system with different security tools like the [http://www.malwarebytes.org/products/malwarebytes_free free version of malwarebytes] and [http://www.bleepingcomputer.com/download/adwcleaner/ adwcleaner] to make sure that adware isn't present in other places of your system as well.
[[Troubleshoot Firefox issues caused by malware]] -
hello all scripters:
can any body help me to develope a script in javascript/apple script
i want search a paragraph style and a character style in indesign page with page num
i tried by this.. script.. any body give me this script in apple m not good in java script,,,,
var myDc =app.activeDocument;
var mySty = myDc.characterStyles.everyItem().name;
var myDia = app.dialogs.add({name:"Character Style Display Menu", canCancel:true});
with(myDia.dialogColumns.add()){
with(borderPanels.add()){
with(dialogColumns.add()){staticTexts.add({staticLabel:"Select Character Style: "});}
with(dialogColumns.add())
var SelSty = dropdowns.add({stringList:mySty, selectedIndex:0});}
var myRes = myDia.show();
if(myRes==true)
var myChoice = mySty[SelSty.selectedIndex];
myDia.destroy();
else
{ exit();}
app.findTextPreferences = app.changeTextPreferences = NothingEnum.nothing;
app.findTextPreferences.appliedCharacterStyle = myChoice.toString();
var myFind = app.findText(false).reverse();
for(var a=myFind.length-1; a>=0; a--){
var myString= myFind[a];
var myPg = myString.parentTextFrames[0].parent.name;}
app.findTextPreferences = app.changeTextPreferences = NothingEnum.nothing;
if(myCon==null)
{alert("not found");}Hi Vijay,
Please use the below JS code is as per your request.
var myDoc =app.activeDocument;
var myLW = 100;
var myStyleNames = myDoc.characterStyles.everyItem().name;
var myDialog = app.dialogs.add({name:"Character Style KT Page Numbers Create", canCancel:true});
with(myDialog.dialogColumns.add()){
with(borderPanels.add()){
with(dialogColumns.add()){staticTexts.add({staticLabel:"Choose the KT Character Style: ", minWidth:myLW});}
with(dialogColumns.add()){var myChooseStyle = dropdowns.add({stringList:myStyleNames, selectedIndex:0});}
var myResult = myDialog.show();
if(myResult == true){
var mySelStyle = myStyleNames[myChooseStyle.selectedIndex];
myDialog.destroy();
else{
myDialog.destroy();
app.findTextPreferences = app.changeTextPreferences = NothingEnum.nothing;
app.findTextPreferences.appliedCharacterStyle = mySelStyle.toString();
var mySearch = app.findText(false);
for(var a=mySearch.length-1; a>=0; a--){
var myText= mySearch[a];
var myPagenum = myText.parentTextFrames[0].parent.name;
var myContents = myText.contents;
app.selection[0].insertionPoints[-1].contents = String(myContents+"\t"+myPagenum);
app.selection[0].insertionPoints[-1].contents = "\r";
app.findTextPreferences = app.changeTextPreferences = NothingEnum.nothing;
thx
csm_phil -
Hello,
This is the java script I use to create a news ticker on one of my pages. It can be included anywhere in your application - region header, body or footer:
<script language="JavaScript1.2">
Cross browser Marquee script- © Dynamic Drive (www.dynamicdrive.com)
For full source code, 100's more DHTML scripts, and Terms Of Use, visit http://www.dynamicdrive.com
Credit MUST stay intact
//Specify the marquee's width (in pixels)
var marqueewidth="300px"
//Specify the marquee's height
var marqueeheight="20px"
//Specify the marquee's marquee speed (larger is faster 1-10)
var marqueespeed=1
//configure background color:
var marqueebgcolor="#DEFDD9"
//Pause marquee onMousever (0=no. 1=yes)?
var pauseit=1
//Specify the marquee's content (don't delete <nobr> tag)
//Keep all content on ONE line, and backslash any single quotations (ie: that\'s great):
var marqueecontent='<nobr><font face="Arial"><b>This is where my text goes.<b/></font></nobr>'
marqueespeed=(document.all)? marqueespeed : Math.max(1, marqueespeed-1) //slow speed down by 1 for NS
var copyspeed=marqueespeed
var pausespeed=(pauseit==0)? copyspeed: 0
var iedom=document.all||document.getElementById
if (iedom)
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100px;left:-9000px">'+marqueecontent+'</span>')
var actualwidth=''
var cross_marquee, ns_marquee
function populate(){
if (iedom){
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
cross_marquee.style.left=parseInt(marqueewidth)+8+"px"
cross_marquee.innerHTML=marqueecontent
actualwidth=document.all? temp.offsetWidth : document.getElementById("temp").offsetWidth
else if (document.layers){
ns_marquee=document.ns_marquee.document.ns_marquee2
ns_marquee.left=parseInt(marqueewidth)+8
ns_marquee.document.write(marqueecontent)
ns_marquee.document.close()
actualwidth=ns_marquee.document.width
lefttime=setInterval("scrollmarquee()",20)
window.onload=populate
function scrollmarquee(){
if (iedom){
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed+"px"
else
cross_marquee.style.left=parseInt(marqueewidth)+8+"px"
else if (document.layers){
if (ns_marquee.left>(actualwidth*(-1)+8))
ns_marquee.left-=copyspeed
else
ns_marquee.left=parseInt(marqueewidth)+8
if (iedom||document.layers){
with (document){
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
if (iedom){
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
write('<div id="iemarquee" style="position:absolute;left:0px;top:0px"></div>')
write('</div></div>')
else if (document.layers){
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
write('</ilayer>')
document.write('</td></table>')
</script>
This works fine and I would like to include some dynamic content into this script. Either some page iteme content or even some query results. My java script knowledge is quite "skinny" so I got to ask how to do that?
Thanks in advance,
DenesDenes,
I just came across your thread.
Just replace within
var marqueecontent='<nobr><font face="Arial"><b>This is where my text goes.<b/></font></nobr>'...
the: "THIS is where the text goes." with: &P1_text.
and you can manipulate the text dynamically.
Ofcourse you hv to create the item P1_text and shortly after you keyed in s.th. and push "Enter" - then the data is in the Session (look at Session in Developer bar).
After "Enter" the ticker/marquee works with your data.
Alternative 2:
Define in Application Attributes under Static Substitution Strings a "GLOBAL_ITEM" with a value: say: my News - then replace &P1_TEXT. by &GLOBAL_ITEM. (beware of the '.' after the item !!! it has to be there !!
Alternative 3:
Work with a table:
A)Define a table called "NEWS" with the fields News_id, text, active_inactive - work with sequence..
B) Define form and report for data entry. In the form go to the item "active_inactive" and modify iot to be a radio-button with LOV : STATIC: Yes,No
C) still use the item P1_text and in the attributes of the item go to "Source" - select "SQL-Query" and key in:
select text from news where active_inactive = 'Yes' - modify the P1_text item as "hidden"
--> now you can manage your news and just the "Active" news are shown.
Advanced: make sure, that only one record is active !!
Have fun !! (:-)
Bernhard -
Hello friends can help me Ipod shuffle
Hello friends I have a ipod shuffle 2GB 5th generation so thought this when I bought by amazon 2GB correctly is all excellent until I happened to leave it connected to the pc .... about 6 or 8 hours at 4am that turn the pc .... leaving my ipod connected ... it forgetfulness .... hours later at about 5pm lift me .... disconnect the ipod shuffle attempt the same turn I cast orange light ... green .... and red last .... and not caught more ..... after that I connect to the pc on and only emits a red light ... and no charge, do not recognize the pc ..... nor itunes ..... ask for your help if you have a solution my problem or my ipod completely died and I buy a new one I have friends with 2g ipod shuffle and tell me that is normal for them that sometimes q by sticking files or die but then it removes them but not before hand thanks and hope you can help me ....
Hey StatistaXS,
Welcome to the Apple Support Communities! It sounds like your iPod shuffle may have had a very low charge when connecting to your computer:
iPod shuffle: Checking the battery charge - Apple Support
http://support.apple.com/en-us/HT1510
If the iPod does not turn on after charging for an acceptable amount of time, it may need to be serviced. But first, check out the relative steps in this resource:
iPod shuffle troubleshooting and service FAQ - Apple Support
http://support.apple.com/en-us/TS1412
Thanks,
Matt M. -
Hello there, I'm new here and I'd be thankful if you help me a bit with my self introduction to Java. I'll write down a source of main and hope you will tell me my beginner's problems:
import java.util.*;
//public int createdInstances = 0;
public class Students{
private String name;
private String course;
public Enum Specialty{
administrator, developer, designer, none
public Specialty specialty;
public Enum University{
TU, SU, NBU, none
public University university;
private String email;
private long phone;
public static int instances;
public Students(){
this.name = "nullStudent";
this.course = "nullCourse";
specialty = Specialty.none;
university = University.none;
this.email = "none";
this.phone = 0;
public Students(String name, String course) {
this.name = name;
this.course = course;
specialty = Specialty.none;
university = University.none;
this.email = "none";
this.phone = 0;
public Students(String name, String course, String email, long phone){
this.name = name;
this.course = course;
this.email = email;
this.phone = phone;
public void Viewer(){
System.out.println("Name: " + name + " course: " + course + " @email: " + email + " #phone: " + phone);
public class Tasks{
public static void main(String args[]){
Students guys = new Students();
guys.Viewer();
}Thanks in advance.You can make a method that converts a string to a Server like this:
enum Server {
CPU, RAM, HDD
public Server stringToServer( String s ) {
if ( s == "CPU" ) {
return Server.CPU;
} else if ( s == "RAM" ) {
return Server.RAM;
} else if ( s == "HDD" ) {
return Server.HDD;
} else {
throw new IllegalArgumentException(); // or any other error handler :)
}
Maybe you are looking for
-
My hard drive crashed..what to do?
Hi, My hard drive crashed..What should i do now? Is there a way for me to upload the content of my ipod to a new/blank itunes library (on my new hard drive), eventhough i understand that it usually works the other way around (itunes to ipod)? Any hel
-
How to debug a smartform in WEBUI
Hi, I need to make a change in the smartform being displayed in WEBUI. I found the smartform and the code where I need to make the chnage. However in order to see the values during run time, I need to debug it. Can I place a session breakpoint in a s
-
The printer in question is a Kyocera 3050ci and the environment is a mixed Windows XP-7 / Mac 10.6-10.8 Printing this particular pdf from every version of Windows spools in seconds and prints out no problem. In EVERY Mac case this PDF never completel
-
Please Help. Itouch Keeps Losing Charge
I have bought my wife an Itouch for her birthday. I have set it up on her PC with Itunes, added music and downloaded some TV shows and fully charged the player. I then turn it off by holding the little button at the top and when the red slider comes
-
Hi All, Am facing one design issue, here my requirement. Am developing a component which calculates expected date. Considering some days in a weeks as holiday always. Input to the component is an integer and some other object[from which I want to fin