Its possible to convert Apple script to Java script
Hi,
Please Help me anyone to do that script.
its possible to convert below mentioned Apple script to Java Script.
Thanks in advance.
Help me......!
-yajiv
Code:
tell me to addImageLabels()
on addImageLabels()
tell application "Adobe InDesign CS5"
set numberAdded to 0
activate
set enable redraw of script preferences to true
set currentFonts to (get name of every font)
if currentFonts does not contain fontname then
display dialog "The font \"" & fontname & "\" is not active on your system." buttons {"Continue anyway", "Cancel"} default button 2
end if
tell document 1
-- get a list of unique page IDs in this document
set allpageids to my getPageIds()
repeat with p from 1 to (length of allpageids)
set pgid to item p of allpageids
-- loop through these, getting a list of unique page item IDs to inspect
tell page id pgid
set pageitems to (get id of every page item)
repeat with i from 1 to (length of pageitems)
set pid to item i of pageitems
tell page item id pid
try
-- certain boxes will fail to yield a content type, whatever
if content type is graphic type then
set c to class
set i to id
-- get the name of the link, i.e. the filename, subject to labelFormat (full name, first six chars, etc.)
set gn to my getImageName(pgid, c, i)
if (gn is not "Empty") and (gn is not "") then
set b to visible bounds
set h to (item 3 of b) - (item 1 of b)
set newtop to (item 1 of b) + (h / 2)
set item 1 of b to newtop
set w to (item 4 of b) - (item 2 of b)
if w < minwidth then
set item 4 of b to ((item 4 of b) + 0.2)
set item 2 of b to ((item 2 of b) - 0.2)
end if
set l to (make new text frame at beginning of page id pgid with properties {visible bounds:b, fill color:fillcolor, contents:gn, label:"imagelabel"})
tell l
tell paragraph 1
set justification to center align
try
set applied font to fontname
end try
set point size to fontsize
set fill color to textcolor
end tell
set inset spacing of text frame preferences to ((insetspacing as string) & " in") as string
fit given frame to content
set numberAdded to numberAdded + 1
end tell
end if
end if
end try
end tell
end repeat
end tell
end repeat -- allpageids
end tell -- document 1
display dialog "Added " & numberAdded & " labels." buttons {okButton} default button 1 giving up after 10 with title scriptName
end tell -- InDesign
end addImageLabels
on getPageIds()
tell application "Adobe InDesign CS5"
tell document 1
tell master spread 1
set masterpageids to (get id of every page)
end tell
set docpageids to (get id of every page)
end tell
end tell
return masterpageids & docpageids
end getPageIds
on getImageName(int1, cla1, int2)
tell application "Adobe InDesign CS5"
tell document 1
tell page id int1
if cla1 is rectangle then
set imagename to (name of item link of graphic 1 of rectangle id int2)
else if cla1 is polygon then
set imagename to (name of item link of graphic 1 of polygon id int2)
else
return "Unknown"
end if
try
if (labelformat is "First six characters") then
return (characters 1 thru 6 of imagename) as string
else if (labelformat is "Base name of linked file") then
set op to offset of "." in imagename
return (characters 1 thru (op - 1)) of imagename as string
else
return imagename
end if
on error
return "Empty"
end try
end tell
end tell
end tell
end getImageName
Yajiv:
I realize English is probably not your first language, but you are not really making sense. Perhaps you could use more words and write in more detail.
It seems you already have your script in AppleScript. Why do you need to convert it to JavaScript?
It's going to be inconvenient at best and probably not worth anyone's time.
Just use the AppleScript.
Similar Messages
-
Adobe acrobat java sdk is available? if yes then its possible to convert pdf to word
adobe acrobat java sdk is available ? if yes then its possible to convert pdf to word(doc)
There is little interest in automating Acrobat with Java, since it cannot be run on a server. On a client workstation, OLE is available, and perhaps Java can use that.
(JavaScript is of course another story). -
Apple script to java script...
Hi everyone,
As i want to change below apple script code to java script. I have tried upto duplicating the frames with java script and its working fine. But i don't know how to use whose condition in javascript. If it is possible to do whose condition in java script then i don't want to go for loop. Can anyone look into this and help me out.
-----Apple script-----
set xx to {}
tell application "Adobe InDesign CS3"
tell document 1
repeat with i from 1 to (count of text frame)
if class of parent of parent of text frame i is not in master spread then
set end of xx to id of text frame i
end if
end repeat
duplicate (every text frame whose id is in xx)
delete (every text frame whose id is in xx)
end tell
end tell
//---Java script---
var doc=app.activeDocument;
var myFrames=doc.textFrames.everyItem();
myFrames.duplicate();
Thanks in advance
ThiyaguHi Kasyan,
I have checked with your code its working fine. Thanks for your valuable & great support. I was out of station for past one week. Thats the reason for no reply.
After posted my query in to forums, in the mean time i developed the script. In this script i supposed to use the same approach to unlink frames, by getting frame IDs of the text frames. For time consuming only i expected the equivalent code of JS. For your reference i have posted my script below.
var doc=app.activeDocument;
var myArray=new Array();
var myFrames=doc.textFrames.everyItem().id;
for(j=0; j<myFrames.length; j++)
myArray.push(myFrames[j]);
doc.textFrames.everyItem().duplicate();
var myDupFrames=doc.textFrames;
for (k=0; k<myDupFrames.length; k++)
for(s=0; s<myArray.length; s++)
if (myDupFrames[k].id==myArray[s])
myDupFrames[k].remove();
break;
Also i have modified my script after seen your post. And it is working greatly. Once again i am thanking you.
Regards
Thiyagu -
As i am fresher Please share the doc of ECMA script using java script in SharePoint 2013 step by step also how we can insert,update,delete records in list using ECMA script.
Thanks and Regards, Rangnath MaliHi,
According to your post, my understanding is that you want to use JavaScript to work with SharePoint list.
To create list items, we can create a ListItemCreationInformation object, set its properties, and pass it as parameter to the addItem(parameters) function
of the List object.
To set list item properties, we can use a column indexer to make an assignment, and call the update() function so that changes will take effect when you callexecuteQueryAsync(succeededCallback,
failedCallback).
And to delete a list item, call the deleteObject() function on the object.
There is an MSDN article about the details steps of this topic, you can have a look at it.
How to: Create, Update, and Delete List Items Using JavaScript
Thanks & Regards,
Jason
Jason Guo
TechNet Community Support -
Is it possible to convert *.doc to *.rtf in a java program?
Hi :-)
My challenge is to develop a web-app in ADF Faces. Now i verify some technologies to store mailmerge letters in an easy way. The user of my web-app should upload a MS Word mailmerge document and a csv data source file. My web-app must thereupon convert this two files to a pdf per csv-row and store it to a ftp.
I have build a demo using the open office API. But now i want to try the same by using apache POI and FOP. I can merge the doc files with POI and i can create PDF with FOP.
My problem is, that POI cant convert to a rtf file and FOP uses an rtf file to create a pdf. I dont know, if its possible to convert a doc file to a rtf file. If its possible, is there an API, which will help me out?
Regards
Majo
btw...I am not sure, if its the right forum for my question :-/HeHe, no sorry. The binary file is the same, because Windows bind doc and rtf with MS Word, it opens the file, which you have renamed to *.rtf in MS Word. But as a doc document, not as a rtf file ;-)
And i dont want to open the rtf file in MS Word. I want to process the rtf file in java.
Thanks
Majo -
Need help with Java Script to perform a calculation in Adobe Acrobat Pro 9 form
I have a form (test) that I am creating in Adobe Acrobat Pro 9.
I need help creating custom Java Script so I can get the desired answer.
1) There are several questions in each group that require a numerical answer between 0-4
2) There is a total field set up to sum the answers from all above questions
3) The final "score" takes the answer from Step 2 above and divides by the total possible answer
Any help on what Java Script I need to complete this would be greatly appreciated!
I've attached a "spreadsheet" that shows it in more detail as well as what formulas I used in Excel to get the desired end result.
Thanks in advance.Have you tried the "The field is the average of:"?
-
Doubleclick, banners, java script and K size
I've been making flash banners for 10 years and now am trying (unsuccessfully) make banners with adobe edge. The reason I say unsuccessfully is because of the 100k javascript files that are associated with the project. Anyone who makes banners 300x250, 728x90, 300x600, etc.... knows that the typical k size is 30-50 kilobytes. this isn't possible with the k size the java script ads to the project.
Doubleclick studio wont let the dns files be hosted.
Now I'm wondering if this is an antiquated method of gauging the effect a banner has on a website. My question is, should java script count towards the final K size of a banner? isnt it typically loading images that the publishers are concerned with?
Does a 100k java script file take up the same bandwidth of loading an image onto the site? I'm not sure how I could convince such large entities to change how they view the spec sheet but if as i suspect java script shouldn't be lumped into the same category as images then maybe I can convince someone to change the required specs and split it into "images" and "java script" kilobyte sizes.
chad demossI kind of doubt that it is in JRE issue, since Java and Javascript have not much to do with each other.
-
Convert javascript array to java array
Is there any way possible to convert javascript array to java array?
if you will try to experiment a javascript array
putting it to a hidden element, it will be converted
to a string (comma delimited). You can get the value
of that element as a string and use StringTokenizer
class to put the values into a java arrayThanks, got it. -
Calling Java Script Function from Applet
How can I call the Java Script method from Applet. This should work both on IE and NN running on both Windows NT and solaris. I know it is possible to call the function in Java script using JSObject. But I don't have JSObject at run time. Please let me know how to call Java Script function from applet without using JSObject.
For Java <-> JavaScript communication in Netscape / Mozilla see:
http://devedge.netscape.com/library/manuals/2000/javascript/1.5/guide/lc.html#1014290
http://devedge.netscape.com/library/manuals/2000/javascript/1.5/guide/lc.html#1008480 -
How to call a java script program in a vi?
Hi,
I have to call a script in java script with arguments. This script
contains 4 functions, and need an array to works. This array is
produced by my vi. It returns a float.
How can I call this script with parameters in my vi?
Thanks.
BD.
~ La programmeuse compile le C. ~
http://www.pmeonline.fr.st
http://www.nihon-fr.com
http://www.cinemasie.com
http://ippai.free.frNo, my java script program is composed of several functions. I just want to call the functions in my vi, with arguments, etc.
I don't know if it is easy to use
~ La programmeuse compile le C. ~
http://www.pmeonline.fr.st
http://www.nihon-fr.com
http://www.cinemasie.com
http://ippai.free.fr -
Expand Collapse Feature in OBIEE 10.1.3.4 version using Java script Issue
Hi All,
Tried to implement this script in OBIEE 10.1.3.4, but throughs error. Can any one help me in this regards
Steps followed
1. Create an answers report pulling Top Relations, Sub Relationship and Customer from the dimension and sales amount from the Sales fact
2. For Sub Relationship and Customer give the left padding as 25.
3. Create a pivot table view make Top Relationship, Sub Relationship hidden and select show the total before and select labels only (no totals) in the pivot table.
4.Add the image files in and the following code for Top Relationship, Sub Relationship columns select the data format to as HTML image and change it to custom text and add the following.
@[html]<img onclick="ExpandCollapse(this)" src="res/s_oracle10/images/PropertyGroup_minus.gif">@H
5. Add a narrative view and add the following java script.
// Java Script
function ExpandCollapse( el )
// Grab the ROW that was clicked and the TABLE that contains it
var tr = el.parentElement.parentElement;
var tbl = tr.parentElement.parentElement;
// Set the alternating display values for hiding/showing the row
var sDisplay = ( el.src.indexOf( "minus" ) == -1 ) ? "" : "none";
var sDisplayReverse = ( el.src.indexOf( "minus" ) == -1 ) ? "none" : "";
//Switch the icon for the clicked row
el.src = "C:/Manohar/HTMLTest/PropertyGroup_" + ( el.src.indexOf( "minus" ) == -1 ? "minus" : "plus" ) + ".gif";
// Starting with the row below the clicked row, start checking each row
for ( var i = tr.rowIndex + 1; i < tbl.rows.length; i++ )
// Set the Current row indicator nad the left padding value
var trCurrent = tbl.rows( i );
var trCurrentLeft = trCurrent.cells(0).style.paddingLeft;
// if the current row contains an IMG in it, it's a clickable level and we either have to stop processing,
// or reset the icons to a + as it's being collapsed
if ( trCurrent.cells( 0 ).firstChild && trCurrent.cells( 0 ).getElementsByTagName( "IMG" ).length )
// If the current row is at the same level or above in the tree, then stop processing,
// else reset all the signs below it, essentially collapsing all branches underneath the one that is beig collapsed.
if ( stripTrailing(trCurrentLeft , UOM_SIZE) <= stripTrailing(tr.cells(0).style.paddingLeft , UOM_SIZE) )
{ break; }
else
if (el.src.indexOf( "minus" ) == -1 )
trCurrent.cells(0).getElementsByTagName("IMG").item(0).src = "C:/Manohar/HTMLTest/PropertyGroup_plus.gif";
// Now, we determine if the row should be hidden or shown.
if ( eval(stripTrailing(tr.cells(0).style.paddingLeft, UOM_SIZE)+ INDENT_SIZE) < stripTrailing(trCurrentLeft, UOM_SIZE) && el.src.indexOf( "minus" ) >0 )
trCurrent.style.display = sDisplayReverse;
} else
trCurrent.style.display = sDisplay;
Thanks,
Kumaravel
Edited by: 840515 on Feb 28, 2011 10:00 PMSince the SP is on connection pool (and looks like expecting a input value), that may causing for error.
Column in the report, pass PS variable and hide it if it not required in the report.
Pls mark if helps -
Hi,
I have a link on the page, when i click on the link i should call java script. Java script is written on page level edit area as HTML text.
Can you give me the syntax ? how to call that scriptsay you had a javascript function defined on or accessible to your current page that looked like this...
function popupURL(url)
{w = open(url,"winLov","Scrollbars=1,resizable=1,width=800,height=600");
if (w.opener == null)
w.opener = self;
w.focus();}
...you could then call it with a link that looked like this...
<a href="javascript:popupURL('http://www.google.com');">Open Google in Another Window</a>
...hope this helps,
raj -
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 -
Add xml Tags 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) problem.
Can anyone write/suggest me how i can add xml tags. By Apple/Java Script
My Probleam =>
[&x+2, y+3&]
Solution => (But its manual)
<inlineequation><inlinemediaobject><textobject role="xpressmath">[&x+2, y+3&]</textobject></inlinemediaobject></inlineequation>
I want add xml tags on my powermath equaiton. Its ETMV2 xml tags.
Any insight is appreciated!
Thank you so much
snegigHi John,
(1) Without xml tags my InDesign file
(2) After add tags my file (its manually)
Is this any script when i select my power math equation data then add xml tags automatically
Thank's any suggestion -
Is it possible to convert Java to EXE and run this EXE file without any JRE
hello friends
I have GCC/GCJ for windows but dont know how to work with it... it creates file with .o extension but i m not able to create .exe from that... i installed mingw for that also .. unsuccessful ...
tell me the solution for it... i want to generate machine dependent exe from java file...on the web i ve seen that GCC/GCJ is used on linux platform..not cleared properly..
Again i m writing my question
Is it possible to convert Java to EXE and run this EXE file without any JRE if yes then how... tell me the procedure to do that...Vipul wrote:
Its software now hardware .... some times u need these things ...anyway do u ve solution for my questionSo what? By creating a native executable you are restricting the program to the OS for which that native executable was made, just like removing the engine from a car restricts driving to downhill only. So like the I said, the principle remains the same, "Why would you want to?"
I am asking you, truthfully, why do you feel the need to negate the largest advantage of using Java by creating a native executable from it?
What is your rationale?
I can pretty much guarantee there is a much better way of achieving your wish without "removing the engine".
Maybe you are looking for
-
I have an iPhone 4S and decided one day to encrypt my backup function. Then after I started to receive information from my iPhone stating that it hasn't been updated in XX weeks, (actually now 23), I decided that maybe the problem was with the encryp
-
Plug-in Builder not showing up in JDeveloper
Following instructions here: Plug-in Builder Under the "Installing Plug-in Builder into an Existing JDeveloper Instance" section, I successfully get to Step 7, at which point "EM Plug-in Builder" is not an option on the Preferences page. I've also t
-
Salesforce third party works on Ipad but not mac
We use salesforce.com at work, to which I can access both from the Ipad & the Mac, But we have a third pary app the launches within Salesforce. This works on the Ipad but I get unable to access message in the mac. I think there is a setting I need to
-
Any ideas on my faulty Hub and lights...?
Yesterday morning...all was well, working from home... Yesterday afternoon..no connectivity...hmm, checked the hub and only the power and wireless lights were illumninated blue... So went through the old power on/off etc..same thing, checked a spare
-
I am on an HP pavilion running Windows7, and for the past couple of days, whenever I try to open the FireFox browser, or a new tab, all I get is a blank screen. The URL bar is empty, and gives the prompt: type an address. When I try to type in the ad