Script for Document Setup size...

Hello All,
     I have a request for a script, not sure how one would go about it but here we go.
An AI CS4 user selects a shape, they then execute a script that...
Resizes the Document Setup Art Board to one inch larger (length width) than the selected shape.
Then a rectangle is drawn in the document and is sized the same as the art board.
Any help would be great!!!
Thanks in advanced.
Anton

All,
     I am tweaking this script again and have run into a road block that you may have a simple answer for.  When I execute this script when selecting a single object it works perfect, if I execute it while selecting a group of objects the script will not apply the spot color to the selection.  The script will however do everything but apply the spot color.  Here is the latest edit. Thanks for any input.
Anton
#target illustrator
function main() {
     if (app.documents.length == 0) {
          alert('Open a document before running this script');
          return; // Stop script here no doc open…
     } else {
          var docRef = app.activeDocument;
          with (docRef) {
               if (selection.length == 0) {
                    alert('No items are selected…');
                    return; // Stop script here with no selection…
               if (selection.length > 1) {
                    alert('Too many items are selected…');
                    return; // Stop script here with selection Array…
               } else {
                    var ccSpotColor = cmykColor(0, 100, 0, 0);
                    var ccCol = spots.add()
                    ccCol.name = 'CC';
                    ccCol.color = ccSpotColor;
                    ccCol.tint = 100;
                    ccCol.colorType = ColorModel.SPOT;
                    var cc = new SpotColor();
                    cc.spot = ccCol;
                    var selVB = selection[0].visibleBounds;
                    var rectTop = selVB[1] + 36;
                    var rectLeft = selVB[0] - 36;
                    var rectWidth = (selVB[2] - selVB[0]) + 72;
                    var rectHeight = (selVB[1] - selVB[3]) + 72;
                    selection[0].parent.name = 'ARTWORK';
                    selection[0].filled = false;
                    selection[0].stroked = true;
                    selection[0].strokeColor = cc;
                    selection[0].strokeWidth = 1;
                    var regLayer = layers.add(); // Creates Regmark Layer
                    regLayer.name = 'Regmark';
                    var tcLayer = layers.add(); // Creates TC Layer
                    tcLayer.name = 'Through Cut';
                    var ccLayer = layers.add(); // Creates CC Layer
                    ccLayer.name = 'CC';
                         var Cutline = selection[0]
                         Cutline.move(ccLayer, ElementPlacement.INSIDE);
                         var ThroughCutBox = tcLayer.pathItems.rectangle(rectTop, rectLeft, rectWidth, rectHeight, false); //This is TC box
                    ThroughCutBox.stroked = false;
                    ThroughCutBox.filled = true;
                    var tcSpotColor = cmykColor(0, 100, 90, 0);
                    var tcCol = spots.add()
                    tcCol.name = 'TC';
                    tcCol.color = tcSpotColor;
                    tcCol.tint = 100;
                    tcCol.colorType = ColorModel.SPOT;
                    var tc = new SpotColor();
                    tc.spot = tcCol;
                    ThroughCutBox.fillColor = tc;
                         tcLayer.visible = false;// Make TC Layer Invisable     Here
                    artboards[0].artboardRect = (ThroughCutBox.visibleBounds);
                    redraw();
                    rectWidth = (rectWidth-72)/72;
                    rectWidth = roundToDP(rectWidth,1);
                    rectHeight = (rectHeight-72)/72;
                    rectHeight = roundToDP(rectHeight,1);
                    var textString = rectWidth + ' x ' + rectHeight;
                    prompt('Copy Me', textString);
main();
function roundToDP(nbr, dP) {
     dpNbr = Math.round(nbr*Math.pow(10,dP))/Math.pow(10,dP);
     return dpNbr;
function cmykColor(c, m, y, k) {
     var newCMYK = new CMYKColor();
     newCMYK.cyan = c;
     newCMYK.magenta = m;
     newCMYK.yellow = y;
     newCMYK.black = k;
     return newCMYK;

Similar Messages

  • Items outside of Document Setup size don't appear in PDF

    I have a document which I'm saving as a PDF with Preserve Illustrator Editing Capability selected. When I open this PDF in Acrobat critical elements just outside of the Document Setup size are not showing up. These are critical for the production but unless they are physically touching the Document Setup boundary they disappear from the PDF. How can I get these marks  and other elements to stay in the PDF side of the document without increasing the document size?
    MAC OS 10.5.8
    Illustrator CS3

    Can you post a screen shot I am not certain I understand what you man by essential objects?
    Here I just duplicated the art board and put some extra text on the second artboard and all the marks were on the first and second page of the pdf.
    I don't say you don't have a good point but what I think they should have is a feature like ID but that can be included in the pdf which is a library
    similar to the symbols panel that you could perhaps access fro acrobat for placement but what one can do is to put essential content on a layer and turn it off and export as a pdf as 1.8 acrobat compatible and when opened in Acrobat you can access that content in Acrobat by turning on the layer.

  • Document Setup size change-frame defaults to centering

    In ID CS3, by default I have my Reference Point set to the upper left. I often get a repeat layout that may have a size change. If I originally had a 3"x5" ad and the repeat calls for a 4"x7", I reset the document setup. The frame goes to the left (0 x coord) but centers itself vertically (0.5" y coord). In QuarkXPress, the frame (box) would go to the 0 x and y coordinates. This is how i'd like InDesign to behave. Any way to do that?

    Hi Chinna, thank you for this - this is great - apologies if i didn't make it clear but this displays the info as an alert, and i needed it to appear in the "PageSize" text variable field as per the text in my post. However i think I've managed to work it out (pasted below if you're interested), and it works a treat now, so thank you ever so much for all your help.
    var doc = app.activeDocument; 
    doc.viewPreferences.horizontalMeasurementUnits = MeasurementUnits.millimeters; 
    doc.viewPreferences.verticalMeasurementUnits = MeasurementUnits.millimeters; 
    for(var i =0;i<doc.pages.length;i++)
        pagesize = app.activeDocument.textVariables.itemByName("PageSize"); 
    pagesize.variableOptions.contents = doc.pages[i].bounds[2] + "mm x " + doc.pages[i].bounds[3] + "mm"

  • I am new to scripting & I need Script for Document color mode

    Hi,
    Please help me to create a script which should find the Document color mode. I am new to scripting. And please let me know how to use the same.
    Balaji

    Are you using the Extendscript Toolkit Editor (ESTK)? In the Help menu you can find all the properties for Document that can be queried/changed.
    (Personally, I don't use ESTK, because I really really hate it. But I don't want to miss the Help, so I made my own version. I have Illustrator CS4, and it's possible your version doesn't have this, but under Document I find:
    documentColorSpace
    DocumentColorSpace:
    DocumentColorSpace.RGB
    DocumentColorSpace.CMYK
    readonly
    The color space used for the document.
    For the how-to-use I glady refer you to Adobe's own Starting With Scripting guides.)

  • Script for Document Footnote options change before first footnote above space.

    Hi hope u r all fine,
    Please help for this. I want to change the space in Document footnote option.
    That is Minimum space before first footnote = "12 pt"; and Rule above of First Footnote in Column should be Rule off.
    I need script for this.

    @hasvi – look up the properties and methods here:
    Jongware
    InDesign JavaScript Reference Guide
    http://www.jongware.com/idjshelp.html
    I recommend the chm files listed there for easy searchability.
    There is also a HTML version and a online version in HTML.
    Properties like footnoteFirstBaselineOffset, footnoteMinimumFirstBaselineOffset, ruleOn and ruleOffset with their possible values are documented here:
    http://jongware.mit.edu/idcs6js/pc_FootnoteOption.html
    To set the properties and their values you have to address the document.footnoteOptions:
    var myDoc = app.documents[0];
    myDoc.footnoteOptions.properties = {
        footnoteFirstBaselineOffset : FootnoteFirstBaseline.X_HEIGHT,
        footnoteMinimumFirstBaselineOffset : "12 pt",
        ruleOn : false
    Uwe

  • Script for document name labels

    How hard would this be?
    A script that would type the file name into the document. I searched for similar threads but no luck. Here are the details...
    1. If the document was named TEST.pdf the script would type TEST in the document.
    2. The font color, size, and type would be Black, Arial Bold,  0.4 in.
    3. The font would be converted to outlines.
    4. A rectangle 0.05" larger than text would be placed around the text.
    5. The rectangle would have no fill and a 100% magenta spot color named "CC" stroke.
    6. The rectangle stroke would be moved to the CC layer (pre-existing layer).
    7. The text "TEST" would be moved to the Artwork layer  (pre-existing layer).
    Thanks for any input or help.
    Anton

    Anton, this should be pretty close for a guide… I don't know what your exact font name would be… so this uses my closest match. Also you don't mention text positioning on the artboard/doc… The stroke is default 1pt as is. The height of the outlined text would be dependent on your font and you may have to tinker with the size where shown…
    #target illustrator
    function docNameToText() {
         if (app.documents.length = 0) {
              return;
         } else {
              var docRef = app.activeDocument;
              var docName = docRef.name;
              var text = docName.replace(/\.(ai|eps|pdf)$/i,'');
              var arialFont = app.textFonts.getByName('ArialMT-Bold'); // Add font name here…
              var nameText = docRef.textFrames.add();
              nameText.contents = text;
              var nameChar = nameText.lines[0].characters;
              for (var i = 0; i < nameChar.length; i++) {
                   nameChar[i].characterAttributes.textFont = arialFont;
                   nameChar[i].characterAttributes.size = 40; // Adjust font size here…
              var textGroup = nameText.createOutline();
              textGroup.position = [36,-36]; // Half Inch down/across from top/left
              var groupBounds = textGroup.visibleBounds;
              var ccLayer = docRef.layers.getByName('CC');
              textGroup.move(ccLayer, ElementPlacement.INSIDE);
              var artLayer = docRef.layers.getByName('Artwork');
              // This can't be the right way to do this now can it?
              var boxTop = groupBounds[1] + 4;
              var boxLeft = groupBounds[0] - 4;
              var boxWidth = (groupBounds[2] - groupBounds[0]) + 8;
              var boxHeight = (-groupBounds[3] - -groupBounds[1]) + 8;
              var spotBox = docRef.pathItems.rectangle(boxTop,boxLeft,boxWidth,boxHeight);
              spotBox.filled = false;
              spotBox.stroked = true;
              //spotBox.strokeWidth = 1; // Default is 1pt
              var ccSpot = docRef.swatches.getByName('CC');
              spotBox.strokeColor = ccSpot.color;
              textGroup.move(artLayer, ElementPlacement.INSIDE);
    docNameToText();

  • Script for Tablespaces/ASM size/usage

    Hi,
    We have a 10gR2 RAC database with ASM
    Part of the tablespaces are running with auto-extent.
    I am looking for a script that gives us an integrated view of the database storage:
    - tablepace size
    - tablespace usage
    - ASM size
    - ASM usage
    TIA.
    Best Regards,
    Rui Vilao.

    You can try this one for asm. Combining asm and tablespace/data files usage may be complicated and performance intensive script. You may use grid control or dbconsole.
    select group_number gn,name,type,state,total_mb,free_mb,usable_file_mb
    from v$asm_diskgroup
    Ashok

  • Script for user setup in Discoverer

    Do anyone have a script that I can use to scan a table or spreadsheet with User names and Business areas and setup the users in Discoverer. I need to setup lot of users in Discoverer and manually doing them is a time taking process.
    Thanks in advance

    Darn good idea, but I've never heard of anyone having such a thing.
    Note that if an Oracle Apps EUL, then all the Apps users and responsibilities are already in the EUL per se, just not associated to a business area via security. Likewise, if a non-Apps EUL, then all database user and responsibilities are already in the EUL per se, just not associated to a buseinss area via security.
    So, it's just the security you need to set up. Also, note that user: PUBLIC has the defaults for new users so maybe you can use that to save some time.
    Again, though, I've never heard of it but conceivable as there may be 1 or more EUL tables that can be updated by SQL outside of Disco.
    If you 'crack it', pls post as it would be a valuable bit of code.
    Russ

  • Powershell script for average message size and message sent

    Regarding this script from a Technet blog:
    #mjolinor
    #02/24/2011
    #requires -version 2.0
    $today = get-date
    $rundate = $($today.adddays(-1)).toshortdatestring()
    $outfile_date = ([datetime]$rundate).tostring("yyyy_MM_dd")
    $outfile = "email_stats_" + $outfile_date + ".csv"
    $dl_stat_file = "DL_stats.csv"
    $accepted_domains = Get-AcceptedDomain |% {$_.domainname.domain}
    [regex]$dom_rgx = "`(?i)(?:" + (($accepted_domains |% {"@" + [regex]::escape($_)}) -join "|") + ")$"
    $mbx_servers = Get-ExchangeServer |? {$_.serverrole -match "Mailbox"}|% {$_.fqdn}
    [regex]$mbx_rgx = "`(?i)(?:" + (($mbx_servers |% {"@" + [regex]::escape($_)}) -join "|") + ")\>$"
    $msgid_rgx = "^\<.+@.+\..+\>$"
    $hts = get-exchangeserver |? {$_.serverrole -match "hubtransport"} |% {$_.name}
    $exch_addrs = @{}
    $msgrec = @{}
    $bytesrec = @{}
    $msgrec_exch = @{}
    $bytesrec_exch = @{}
    $msgrec_smtpext = @{}
    $bytesrec_smtpext = @{}
    $total_msgsent = @{}
    $total_bytessent = @{}
    $unique_msgsent = @{}
    $unique_bytessent = @{}
    $total_msgsent_exch = @{}
    $total_bytessent_exch = @{}
    $unique_msgsent_exch = @{}
    $unique_bytessent_exch = @{}
    $total_msgsent_smtpext = @{}
    $total_bytessent_smtpext = @{}
    $unique_msgsent_smtpext=@{}
    $unique_bytessent_smtpext = @{}
    $dl = @{}
    $obj_table = {
    Date = $rundate
    User = $($address.split("@")[0])
    Domain = $($address.split("@")[1])
    Sent Total = $(0 + $total_msgsent[$address])
    Sent MB Total = $("{0:F2}" -f $($total_bytessent[$address]/1mb))
    Received Total = $(0 + $msgrec[$address])
    Received MB Total = $("{0:F2}" -f $($bytesrec[$address]/1mb))
    Sent Internal = $(0 + $total_msgsent_exch[$address])
    Sent Internal MB = $("{0:F2}" -f $($total_bytessent_exch[$address]/1mb))
    Sent External = $(0 + $total_msgsent_smtpext[$address])
    Sent External MB = $("{0:F2}" -f $($total_bytessent_smtpext[$address]/1mb))
    Received Internal = $(0 + $msgrec_exch[$address])
    Received Internal MB = $("{0:F2}" -f $($bytesrec_exch[$address]/1mb))
    Received External = $(0 + $msgrec_smtpext[$address])
    Received External MB = $("{0:F2}" -f $($bytesrec_smtpext[$address]/1mb))
    Sent Unique Total = $(0 + $unique_msgsent[$address])
    Sent Unique MB Total = $("{0:F2}" -f $($unique_bytessent[$address]/1mb))
    Sent Internal Unique = $(0 + $unique_msgsent_exch[$address])
    Sent Internal Unique MB = $("{0:F2}" -f $($unique_bytessent_exch[$address]/1mb))
    Sent External Unique = $(0 + $unique_msgsent_smtpext[$address])
    Sent External Unique MB = $("{0:F2}" -f $($unique_bytessent_smtpext[$address]/1mb))
    $props = $obj_table.ToString().Split("`n")|% {if ($_ -match "(.+)="){$matches[1].trim()}}
    $stat_recs = @()
    function time_pipeline {
    param ($increment = 1000)
    begin{$i=0;$timer = [diagnostics.stopwatch]::startnew()}
    process {
    $i++
    if (!($i % $increment)){Write-host “`rProcessed $i in $($timer.elapsed.totalseconds) seconds” -nonewline}
    $_
    end {
    write-host “`rProcessed $i log records in $($timer.elapsed.totalseconds) seconds”
    Write-Host " Average rate: $([int]($i/$timer.elapsed.totalseconds)) log recs/sec."
    foreach ($ht in $hts){
    Write-Host "`nStarted processing $ht"
    get-messagetrackinglog -Server $ht -Start "$rundate" -End "$rundate 11:59:59 PM" -resultsize unlimited |
    time_pipeline |%{
    if ($_.eventid -eq "DELIVER" -and $_.source -eq "STOREDRIVER"){
    if ($_.messageid -match $mbx_rgx -and $_.sender -match $dom_rgx) {
    $total_msgsent[$_.sender] += $_.recipientcount
    $total_bytessent[$_.sender] += ($_.recipientcount * $_.totalbytes)
    $total_msgsent_exch[$_.sender] += $_.recipientcount
    $total_bytessent_exch[$_.sender] += ($_.totalbytes * $_.recipientcount)
    foreach ($rcpt in $_.recipients){
    $exch_addrs[$rcpt] ++
    $msgrec[$rcpt] ++
    $bytesrec[$rcpt] += $_.totalbytes
    $msgrec_exch[$rcpt] ++
    $bytesrec_exch[$rcpt] += $_.totalbytes
    else {
    if ($_messageid -match $messageid_rgx){
    foreach ($rcpt in $_.recipients){
    $msgrec[$rcpt] ++
    $bytesrec[$rcpt] += $_.totalbytes
    $msgrec_smtpext[$rcpt] ++
    $bytesrec_smtpext[$rcpt] += $_.totalbytes
    if ($_.eventid -eq "RECEIVE" -and $_.source -eq "STOREDRIVER"){
    $exch_addrs[$_.sender] ++
    $unique_msgsent[$_.sender] ++
    $unique_bytessent[$_.sender] += $_.totalbytes
    if ($_.recipients -match $dom_rgx){
    $unique_msgsent_exch[$_.sender] ++
    $unique_bytessent_exch[$_.sender] += $_.totalbytes
    if ($_.recipients -notmatch $dom_rgx){
    $ext_count = ($_.recipients -notmatch $dom_rgx).count
    $unique_msgsent_smtpext[$_.sender] ++
    $unique_bytessent_smtpext[$_.sender] += $_.totalbytes
    $total_msgsent[$_.sender] += $ext_count
    $total_bytessent[$_.sender] += ($ext_count * $_.totalbytes)
    $total_msgsent_smtpext[$_.sender] += $ext_count
    $total_bytessent_smtpext[$_.sender] += ($ext_count * $_.totalbytes)
    if ($_.eventid -eq "expand"){
    $dl[$_.relatedrecipientaddress] ++
    foreach ($address in $exch_addrs.keys){
    $stat_rec = (new-object psobject -property (ConvertFrom-StringData (&$obj_table)))
    $stat_recs += $stat_rec | select $props
    $stat_recs | export-csv $outfile -notype
    if (Test-Path $dl_stat_file){
    $DL_stats = Import-Csv $dl_stat_file
    $dl_list = $dl_stats |% {$_.address}
    else {
    $dl_list = @()
    $DL_stats = @()
    $DL_stats |% {
    if ($dl[$_.address]){
    if ([datetime]$_.lastused -le [datetime]$rundate){
    $_.used = [int]$_.used + [int]$dl[$_.address]
    $_.lastused = $rundate
    $dl.keys |% {
    if ($dl_list -notcontains $_){
    $new_rec = "" | select Address,Used,Since,LastUsed
    $new_rec.address = $_
    $new_rec.used = $dl[$_]
    $new_rec.Since = $rundate
    $new_rec.lastused = $rundate
    $dl_stats += @($new_rec)
    $dl_stats | Export-Csv $dl_stat_file -NoTypeInformation -force
    Write-Host "`nRun time was $(((get-date) - $today).totalseconds) seconds."
    Write-Host "Email stats file is $outfile"
    Write-Host "DL usage stats file is $dl_stat_file"
    #Contact information
    #[string](0..33|%{[char][int](46+("686552495351636652556262185355647068516270555358646562655775 0645570").substring(($_*2),2))})-replace " "
    I would to target just one specific HT server in the environment, instead of all of them.
    How do I do this?

    I believe the line I need to target is this line:
    $hts = get-exchangeserver |? {$_.serverrole -match "hubtransport"} |% {$_.name
    But I'm not entirely sure how to target just one specific HT server?

  • What is a good ID5 Document Setup for an epub ebook for the iPhone?

    I'd welcome some help using ID5 to create an ebook that is optimized for displaying on the iPhone.
    In particular, I'm looking for appropriate dimensions of the base page, in pixels, to enter in the Document Setup dialog box.
    From what I've read, 320 x 480 pixels should work well for both the iPhone 4 as well as previous versions.
    Is that accurate?
    The Setup page also includes boxes for Bleed and Slug. Should any values be entered there, or should they remain zero?
    Thanks for the help.
    -- Mike

    On InDesignSecrets David Blatner lays out the Good, the Bad, & the Ugly facts in Best Document Size for EPUB Export:
    function(){return A.apply(null,[this].concat($A(arguments)))}
    This is a great question because it seems like there should be… but the truth is that there isn’t. The reason there isn’t is important: You don’t lay out an EPUB “ebook.”
    Since you got off with a bad start, you might want to invest in your background material; either new book in New InDesign-to-eBook Resources should be good for starters.

  • Each time I open firefox i receive two unwanted pop ups of the "you have chosen to open..." variety. two for firefox setup and one for a word document how do i stop this?

    i open firefox and get two popups that state "you have chosen to open and then its for firefox setup 3.6.1 or beta which i once used and uninstalled. a second is for a file in my documents--always the same file.

    Delete downloads.sqlite (plus downloads.rdf, if it exists) in the [http://kb.mozillazine.org/Profile_folder_-_Firefox Profile Folder]
    See http://kb.mozillazine.org/Unable_to_save_or_download_files#Manually_delete_download_history

  • We are trying to do a Quick payment from payment workbench and getting 'FRM-41830: List of values contains no entries' error for payment document column/field. Payment document setup looks good. Not sure what the issue is.

    We are trying to do a Quick payment from payment workbench and getting 'FRM-41830: List of values contains no entries' error for payment document column/field. Payment document setup looks good. Not sure what the issue is.

    Already gone through following three notes but didn't found resolution.
    APXPAWKB: FRM-41830 When Clicking on Payment Document LOV (Doc ID 1081305.1)
    R12: APXPAWKB: Payment Document Lov Is Empty When Entering A Payment (Doc ID 857587.1)
    R12: Payment Workbench Error: FRM-41830 List Of Values Contains No Entries (APXPAWKB.FMB) (Doc ID 1323875.1)

  • Script for combining multiple documents?

    hi there,
    well I think there's been a lot of discussion going towards this topic. My concerns aren't quite lining up with the topics. We using a script for placing images, and instead of going document to document...I would like to combine all the indd documents...there's usually at least 24...and to import NOT as pdf's, just as individual pages within the one document...insert my images using the other script...and then later choosing to re-export the pages as individuals. With ascending order of page numbers in the correct sequence they were brought in as.
    thanks for the help.

    -Printing by folder only helps when I need to run one copy of the files, typically I need to print multiple copies or save them for future printing.  Also I have had errors printing via that method before because it will sometimes overload the printer queue.
    -It would be great if clients always provided print ready documents, but that is usually not the case and I have to correct it which is why I am here asking how to do this.
    And if you can not do that then you need to insert a blank page into the files with an odd number of pages.
    Right.  That is what I am looking for; something to automate inserting a blank page into files that have an odd number of pages WITHOUT knowing the documents page counts before hand and WITHOUT having to manually insert blank pages.

  • Script for 'Check Links Before Opening Document' preference

    I'm trying to find the VB script for changing the "Check Links Before Opening Document" checkbox on the File Handling panel in the Preferences dialog? I haven't found any documentation referring to the Links items on that panel.
    Bob

    Thanks for the info.
    Was there a document you pulled this from?
    I have an old document from CS2 days that is invaluable for providing a detailed list of available script methods and properties. Obviously things that have been added in subsequent InDesign releases aren't in this document. Later InDesign CS releases offer script SDKs that contain helpful sample scripts but I don't find a detailed summary similar to one from CS2. Have I just not found them? Or how does one find the script method/property for things not contained in the sample scripts?

  • Script for billing document

    hi all ,
    is there any standard sap script and its print program for billing document (sd).
    and how to find the standard scripts for a particular requirement.
    regards
    reena

    hi,
    Script is RVINVOICE01
    Driver program is : RVADIN01.
    goto trns NACE select the application and click on the output types button and
    click on the output type and select processing routines...
    regards,
    priya.

Maybe you are looking for