Automate fractions using a script.

Hi,
i was looking to automate the layout of fraction with a script.
The script has to change 1/200, 1/20, 1/33 to fractions:
When we do it manually, we insert an anchored textframe which contains a 2 row/1 column table.
We then copy the numbers in the cells.
I found the script below in a previous discussion.
But i get an error 30480 on line 14.
I'm a bit of a dummy when it comes to scripting, so can anyone tell me what's wrong with it?
var theDoc = app.activeDocument;
var myTableStyle = "tabelbreuk"; //MUST  be set!!
var myCellStyle = "celbreuk"//MUST  be set!!
var myObjectStyle = "TF-breuk"//MUST  be set!!
app.findGrepPreferences = null; 
app.findGrepPreferences.findWhat = "\\d+/\\d+";   //should find all occurrences of number(s) + / + numbers(s)
var searchResults = theDoc.findGrep(); 
for(var i = searchResults.length -1; i >= 0; i--)
var foundFraction = searchResults[i];
var newTextFrame = foundFraction.insertionPoints[0].textFrames.add({geometricBounds: [0,0,foundFraction.leading, foundFraction.parentTextFrames[0].geometricBounds[3] - foundFraction.parentTextFrames[0].geometricBounds[1]], appliedObjectStyle:theDoc.objectStyles.itemByName(myObjectStyle)});
var tmpDest = foundFraction.move(LocationOptions.AT_BEGINNING, newTextFrame);
var fractionTable= tmpDest.convertToTable('\r', '/', 1);
fractionTable.appliedTableStyle = "tabelbreuk"
setTableWidth(fractionTable);
newTextFrame.fit(FitOptions.FRAME_TO_CONTENT);
function setTableWidth(fractionTable){
    var widthArray = [];
        var allCells = fractionTable.cells;
   for(var c = 0; c < fractionTable.cells.length; c++){
        var aCell = fractionTable.cells[c];
                aCell.appliedCellStyle = "celbreuk"
widthArray.push((aCell.texts[0].endHorizontalOffset - aCell.texts[0].horizontalOffset) + aCell.leftInset + aCell.rightInset)
widthArray.sort(Numsort);
fractionTable.width = widthArray[widthArray.length-1]
function Numsort(a,b){return a - b}
thx

Hi Ariel,
thank you for your answer.
But the fractions made with the openType feature are not the kind of fraction we need.
Our fractions have to look like this:
I don't think this is possible by changing the opentype settings.
regards
Arne

Similar Messages

  • Using a script to automate UNC definition updates for FEP 2010

    Hi all,
    I tested the script mentioned in this article
    http://blogs.technet.com/b/clientsecurity/archive/2010/09/16/using-a-script-to-automate-unc-definition-updates.aspx with no success. I am getting the following error:
    Line: 11
    Char: 5
    Error: The operation timed out
    Code: 80072EE2
    Source: WinHttp.WinHttpRequest
    the script content is as follows:
    strMSEx86URL = "http://go.microsoft.com/fwlink/?LinkID=121721&clcid=0x409&arch=x86"
    strMSEx86Location = "D:\defs\Updates\x86\mpam-fe.exe" 
    strNISX86URL = "http://go.microsoft.com/fwlink/?LinkId=197095" 
    strNISX86Location = "D:\defs\Updates\x86\nis_full.exe" 
    strMSEx64URL = "http://go.microsoft.com/fwlink/?LinkID=121721&clcid=0x409&arch=x64" 
    strMSEx64Location = "D:\defs\Updates\x64\mpam-fe.exe" 
    strNISX64URL = "http://go.microsoft.com/fwlink/?LinkId=197094" 
    strNISX64Location = "D:\defs\Updates\x64\nis_full.exe"
    Set objWINHTTP = CreateObject("WinHttp.WinHttpRequest.5.1")  
        objWINHTTP.open "GET", strMSEx86URL, false  
        objWINHTTP.send
    If objWINHTTP.Status = 200 Then
    Set objADOStream = CreateObject("ADODB.Stream")
       objADOStream.Open
      objADOStream.Type = 1 'adTypeBinary
    objADOStream.Write objWINHTTP.ResponseBody
    objADOStream.Position = 0 'Set the stream position to the Start
    Set objFSO = Createobject("Scripting.FileSystemObject") 
        'check if file exists if so delete 
        If objFSO.Fileexists(strMSEx86Location) Then objFSO.DeleteFile strMSEx86Location
    objADOStream.SaveToFile strMSEx86Location 
    objADOStream.Close
    end if
    Anybody can help?

    This is the script that I use and it works:
    strMSEx86URL = "http://go.microsoft.com/fwlink/?LinkID=121721&clcid=0x409&arch=x86" 
    strMSEx86Location = "C:\defs\Updates\x86\mpam-fe.exe" 
    strNISX86URL = "http://download.microsoft.com/download/DefinitionUpdates/x86/nis_full.exe" 
    strNISX86Location = "C:\defs\Updates\x86\nis_full.exe" 
    strMSEx64URL = "http://go.microsoft.com/fwlink/?LinkID=121721&clcid=0x409&arch=x64" 
    strMSEx64Location = "C:\defs\Updates\x64\mpam-fe.exe" 
    strNISX64URL = "http://download.microsoft.com/download/DefinitionUpdates/amd64/nis_full.exe" 
    strNISX64Location = "C:\defs\Updates\x64\nis_full.exe"
    Set objWINHTTP = CreateObject("WinHttp.WinHttpRequest.5.1")  
        objWINHTTP.open "GET", strMSEx86URL, false  
        objWINHTTP.send
    If objWINHTTP.Status = 200 Then 
    Set objADOStream = CreateObject("ADODB.Stream") 
        objADOStream.Open 
        objADOStream.Type = 1 'adTypeBinary 
        objADOStream.Write objWINHTTP.ResponseBody 
        objADOStream.Position = 0 'Set the stream position to
    Set objFSO = Createobject("Scripting.FileSystemObject") 
        'check if file exists if so delete 
        If objFSO.Fileexists(strMSEx86Location) Then objFSO.DeleteFile(strMSEx86Location)
    objADOStream.SaveToFile strMSEx86Location 
    objADOStream.Close
    End IF
    Set objWINHTTP = CreateObject("WinHttp.WinHttpRequest.5.1")  
        objWINHTTP.open "GET", strNISx86URL, false  
        objWINHTTP.send
    If objWINHTTP.Status = 200 Then 
    Set objADOStream = CreateObject("ADODB.Stream") 
        objADOStream.Open 
        objADOStream.Type = 1 'adTypeBinary 
        objADOStream.Write objWINHTTP.ResponseBody 
        objADOStream.Position = 0 'Set the stream position to
    Set objFSO = Createobject("Scripting.FileSystemObject") 
        'check if file exists if so delete 
        If objFSO.Fileexists(strNISx86Location) Then objFSO.DeleteFile (strNISx86Location)
    objADOStream.SaveToFile strNISx86Location 
    objADOStream.Close
    END IF
    Set objWINHTTP = CreateObject("WinHttp.WinHttpRequest.5.1")  
        objWINHTTP.open "GET", strNISx64URL, false  
        objWINHTTP.send
    If objWINHTTP.Status = 200 Then 
    Set objADOStream = CreateObject("ADODB.Stream") 
        objADOStream.Open 
        objADOStream.Type = 1 'adTypeBinary 
        objADOStream.Write objWINHTTP.ResponseBody 
        objADOStream.Position = 0 'Set the stream position to
    Set objFSO = Createobject("Scripting.FileSystemObject") 
        'check if file exists if so delete 
        If objFSO.Fileexists(strNISx64Location) Then objFSO.DeleteFile (strNISx64Location)
    objADOStream.SaveToFile strNISx64Location 
    objADOStream.Close
    END IF
    Set objWINHTTP = CreateObject("WinHttp.WinHttpRequest.5.1")  
        objWINHTTP.open "GET", strMSEx64URL, false  
        objWINHTTP.send
    If objWINHTTP.Status = 200 Then 
    Set objADOStream = CreateObject("ADODB.Stream") 
        objADOStream.Open 
        objADOStream.Type = 1 'adTypeBinary 
        objADOStream.Write objWINHTTP.ResponseBody 
        objADOStream.Position = 0 'Set the stream position to
    Set objFSO = Createobject("Scripting.FileSystemObject") 
        'check if file exists if so delete 
        If objFSO.Fileexists(strMSEx64Location) Then objFSO.DeleteFile(strMSEx64Location)
    objADOStream.SaveToFile strMSEx64Location 
    objADOStream.Close
    END IF

  • Automate Save as, Reader Extended for 160 .pdf forms using a script or macro?

    I have 167 pdf forms made using Adobe Acrobat Pro X. when I sent out a test it could not be saved using Adobe reader. I know how to Save As; Reader Exended pdf; Enable additional features.  this also forces me to create yet another document called something different like mydoc-2.pdf. Since you can't save these feature in the existing one?
    Is there a way to automate this using javascript or something so I don't have to do each one.
    1. open each pdf documewnt
    2. set the Save As; Reader Exended pdf; Enable additional features.
    3. save as name -2
    repeat 1-3 for 167 files in folder A

    There is no Adobe supported means for automating the application of usage rights, apart from their LiveCycle Reader Extensions server-based product. This is a very intentional restriction.

  • Automatic Generation of JMS event generator using WLST script

    is there any way to create and deploy JMS event generator using WLST script. i am using weblogic server 10.3.1

    You could see this informantion here:
    http://docs.oracle.com/cd/E14981_01/wli/docs1031/deploy/cluster.html#wp1519038

  • Using Powershell Script Run simple query in MS Access 2007 and export the results of query to Excel

    Hi Experts,
    I have a Access 2007 DB file and 2 Big tables inside that (bigger than the size that can be easily handled by MS Excel 2007).
    My requirement is automate using powershell scripts the below things.
    1. Create a SQL query in Access DB and save that in access DB
    2. Run the saved query and export the result in excel sheet where I can create the charts and Pivots. Thanks in advance
    Prajesh

    Do you have to use the Access query, couldn't you just recreate the query in Powershell?  Here's a link with good info that references an existing script for querying an Access database:
    http://blogs.technet.com/b/heyscriptingguy/archive/2009/08/13/hey-scripting-guy-can-i-query-a-microsoft-access-database-with-a-windows-powershell-script.aspx
    Once you have your dataset you can pipe it to
    Export-Csv -NoType c:\pathtofile\output.csv

  • Sending email using apple script...

    I have created a watch folder using apple script that when a file is dropped on it, it automatically opens, formats, and sends out a custom email.
    What I don't understand is, how can I include multiple variables in the "content" section (also known as the body section of the email)? I want to put custom type in the content section that says "There is a file awaiting your review." I also would like to choose an email signature from my mail program to use. Third, I would like to include the name of the file that is being sent....
    I found that by doing {content:iteminfo} I could get the file name...If I do {content:"There is a file awaiting your review."} I could get the custom type I wanted....
    BUT, I can't figure out how to get BOTH of them together in ADDITION to adding a custom email signature...
    I know there are some really smart people out there...Any tips?

    I can't figure out how to get BOTH of them together
    This is just standard AppleScript text concatenation with the &:
    ... {content: "There is a file awaiting your review: " & iteminfo}
    Here you can see I'm concatenating a literal string (enclosed in quotes) and a variable. You can extend this ad infinitum.
    As for the signature:
    tell theMessage to set message signature to signature "My Sig"
    (which assumes you have a signature named 'My Sig'. Adjust as necessary.

  • Move group of pages from one InDesign file to another InDesign File using VB.Script

    Dear team,
    I am trying to move group of InDesign pages from one indesign file to another indesign file using vb.script.
    I have written the code like
    Dim Pages=IndDoc.Pages
    Dim Mytype=TypeName(Pages)
    Pages.Move(InDesign.idLocationOptions.idBefore,IndDoc1.Pages.LastItem)
    but it is giving an error as method Move is not a member of Pages 
    please give mme the solution to move the Multiple pages or a group of page from one Indd to another Indd.

    Hey Peter, if I wan to move several page that part of Auto Flow text, I checked the "delete page after moving" but the content still there, not deleted.
    Is there any way to delete it automatically, just to make sure I have moved that autoflowed page?

  • Question about creating new tables using SQL script in WebLogic Server

    Hi,
    I am new to WebLogic and I am following a book Java EE Development with Eclipse published by PACKT Publishing to learn
    Java EE.  I have installed Oracle Enterprise Pack for Eclipse on the PC and I am able to log into the WebLogic Server Administration Console
    and set up a Data Source.  However the next step is to create tables for the database.  The book says that the tables can be created using
    SQL script run from the SQL command line.
    I cannot see any way of inputting SQL script into the WebLogic Server Admistration Console.  Aslo there is no SQL Command line in DOS.
    Thanks  for your help.
    Brian.

    Sounds like you are to run the scripts provided by a tutorial to create the tables, right?  In that case, you may need to install an Oracle client to connect to your database.  The client is automatically installed with the database, so if you have access to the server that hosts the database, you should be able to run SQLplus from there.
    As far as I know, there is no way to run a script from the Admin Console.  I could be wrong, however.

  • Change array index font size using VI scripting

    Hello All,
                         I have a array control in my front panel, I'm wondering is there any way to change that "array index" font size using VI scripting?
    Example:
    1. I have this array
    2. Manually I have changed the font size of the array in "Selection Font" panel as below
    3. Through VI scripting I'm able to control control font size, label font size.,.. But not the index font size. So it looks odd.
    4. I'm expecting to be modify this array as same as picture 1 through VI scripting.
    Note: It may not have any practical application, but some time it will be helpful for the programmers to make a quick drop. If anybody have any idea, please share.
    <Electro Sam>
    ELECTRO SAM
    For God so loved the world that he gave his one and only Son, that whoever believes in him shall not perish but have eternal life.
    - John 3:16

    Raven - you are right, Actually I'm looking for options to change the font size of the array index.
    Actually we have coding standard to follow. In that, all the front panel controls needs to be in Font size 14 and the size should be 25X120, so I'm trying to write a code which automatically converts the VI FP control sizes to be in standard size.
    I'm not only using one customer VI, I'm handling various customer VIs, so each one VI FP control sizes are different. So I'm developing this utility to standardize the VI's as per the guidelines we have.
    Except this array index most of the VI FP control elements I have handled, Only this array is troubling me.
    Appreciate your support guys, please share your thoughts.
    <ElectroSam>
    ELECTRO SAM
    For God so loved the world that he gave his one and only Son, that whoever believes in him shall not perish but have eternal life.
    - John 3:16

  • Any easy to way to use custom scripts?

    Is there any plug-in or whatever that gives me a separate window where i can just click to use custom script? Any other easy ways are fine.

    You should be able to use the Actions palette for this. You can record the selection of a Script as an Insert Menu Item step in an Action. But this has been broken almost since the scripting functionality was added, in that the steps which invoke the scripts disappear from your stored Actions after Illustrator is quit and relaunched.
    It would be a hugely useful thing if Adobe ever bothered to fix this. You could automate things that are a combination of operations that can be performed by Actions but not by scripts, and vice-versa. But people have been after Adobe to fix this for something like seven versions now.
    You can organize the Scirpts menu into folders. And you can organize the Actions palette into Sets. It's just idiotic that Illustrator provides no mechanism for easy access to that organization, as does InDesign. Typical half-baked feature implementation.
    But it's a moot point now, anyway. I really no longer care whether Adobe gets around to fixing the many, many things that Illustrator has so long needed, because I'm not going to pay monthly rent for Illustrator, even if they do. ;-)
    JET

  • Automatically display the Interactive Scripting on WinClient's CIC

    Is it possible to automatically display the Interactive Scripting for the cic Agent?
    I only have one script so there's really no need for the agent to choose when he only has that option.
    I'm on CRM 4.
    Thanks in advance,
    V

    Hi Vitor,
    To show the Interactive Scripting ViewSet as the default Viewset for your IC profile you will need to do the following customizing step:
    IMG > CRM > IC WebClient > Define Inital ViewSets and Transactions
    Create a new entry for your profile and set the Initial View to ScriptViewSet
    The views for Interactiver Scripting itself (in CRM4) are JSP's located in the Java Stack of the CRM server and can not be maintained using the ABAP workbench, so if you want to launch a script by default you will need to "extend" the coding of the appropriate JSP

  • How to remotely deploy adf application using ant script

    Please suggest some pointer on how to remotely deploy adf application using ant script.
    I have created automatic inbuild ant script using jdevloper and ojdeploy that create a war file into my adf application deploy folder.
    Now i want my war to be deploy remotely on weblogic server.
    Is there any inbuld functionality provided by jdeveloper for same.
    Can any one please share build.xml for adf application for deploying application remotely.
    I try to use wlserver but not much success.
    Thanks in advance.
    Sumit Bhasin

    [url http://download.oracle.com/docs/cd/E12839_01/web.1111/e13706/wldeploy.htm]the docs are pretty good.
    John

  • Automatic fractions?

    Hello!  I am using Pages 5.2 (and Mavericks).  Is there a way to get automatic fractions (e.g., when I type 1/2 it automatically turns into the special character with the 1 over the 2)?  I know how to add a fraction as a special character, but is there a way to get Pages to just  do this by itself?  Thank you!!
    - BH

    This is all handled in OSX:
    Menu > Apple > System Preferences > Keyboard > Text > Replace/With
    It is doing it on my System for all the fractions from 1/8 to 7/8
    Have you tried it on your System?
    Type the fraction with a space after.
    If you don't actually want the space, type it anyway and then delete it after the Auto-replacement is done.
    Peter

  • Failed to use OOTB script "exporttosvg"

    Hi everybody,
    I'm searching someone that could tell me how to use the scrpit supplied out-of-the box with Illustrator CC whose french name is "EnregistrerDocAuFormatSVG". As I have only a french version of the product, I do not know the english name. This script is supposed to export all opened files in Illustrator in SVG format in a suppplied folder.
    Each time I used it, the SVG that is done is not correct whereas the same operation I have done manually using "Save As..." is working. In other words, the SVG done manually is not the same as the SVG done using the script !!!
    So I think that there are some errors in the script or some missing configuration.
    Please help me solve this problem.
    Eric.

    Thanks for your answer.
    As I put also something in the general forum of Illustrator, I got anoter answer and succeeded in doing a part of what I wanted to do.
    I had to change the options in the script (there is a getOptions function we can modify).
    After that, I could run my script so that I got the same SVG as the one I was building manually using SaveAs menu entry in Illustrator.
    Now the followin step I need to solve is to automate the following:
    Given an input file readable by Illustrator, I need:
    1. To load the file in Illustrator
    2. to run this script to build an SVG file
    3. close the doc and Illustrator
    I tried using Illustrator as a COM object wrting a C# program. The program runs well, but now the SVG is no more the same. I mean that if I run the script from ILlustrator I get a different result as telling the Illustrator COM object to run the script !!! Problem: whereas the Illustrator developer team offers this way of using Illustrator, this function is not supported. So if there is a bug, I have to way to have it corrected as it is not supported...
    So now, I find another way to do the same thing, perhaps using Illustrator as a command line with some parameters, but I am searching the parameters I could use. Is it possible to run for exemple a given script from command line ?
    Eric.

  • Is it possible to use a Script within an action? - it doesn't seem to work...

    Is it possible to use a Script within an action? - it doesn't seem to work...
    I'm using the 'round any corner' script from SATO Hiroyuki..., and  I'd like to apply it to only one anchor point (on multiple boxes)

    An Action can call a script from the File>Scripts menu by means of the Add Menu Item Action step. But it will only work for the duration of your Illustrator work session. If you quit AI and then restart it, the Add Menu Item step will be blank. This bug has been reported for FOUR FULL VERSIONS of this sloppy program.
    However, if I am correctly understanding your description of what you are trying to automate, an Action will not be able to automate the selection of a particular anchorpoint in multiple paths. You'd have to make the selections all at first. Whether the script would then apply as desired to each path depends on how the script is written.
    JET

Maybe you are looking for

  • TMG - 0x80090325 -Certificate Chain was issued by an authority that is not trusted

    Hello, I am having some problems with testing a OWA (SSL) rule. I get that message. The TMG belongs to the domain and therefore as far as I know it gets the root certificate of my CA (I have deployed a Enterprise CA for my domain). That is why I don'

  • Scheduling a report to run in background

    Hi, I have few queries and is it possible to execute them with the help of a background job that would fecilitate in executing the query automatically??? Thanks & Regards.

  • Mm functional specifications needed

    hi friends   can any body send some sample functional specifications related to MM and the steps to prepare specification and the situations when we prepare such docs thanku

  • Delay execution time

    Hi Guys, I have two jsp page that load inside iFrames. One page sets a session variable that the other needs to read. The problem i am having is that the second jsp page sometimes renders before the the first one causing an error. I have tried the fo

  • Skype obduracy.

    Customer  service  ? " Hello  Ree-Ann B I  suppose  there  is  no  point  in  me  stating  that  you  did  NOT  read  the  entire  e-mail  Ree-Ann B, as  a different Customer  Service  person  answers  each  sorry  e-mail  in  this  shambles. I  have