Multiple conditional using AppleScript in Indesign - won't work?

When I enter in a height and width of, say, 5 inches, it returns with a build size that doesn't make sense, according to the logic gate I built. Here's a stripped-down snippet of the code I wrote that should work in InDesign CS6. Any help would be greatly appreciated.
tell application "Adobe InDesign CS6"
activate
set myDoc to active document
set origLevel to user interaction level of script preferences
set user interaction level of script preferences to interact with all
set myDialog to make dialog with properties {name:"Make Template", can cancel:true}
tell myDialog
tell (make dialog column)
tell (make border panel)
tell (make dialog column)
make static text with properties {static label:"Width:", min width:60}
make static text with properties {static label:"Height:", min width:60}
make static text with properties {static label:"Bleed:", min width:60}
end tell
tell (make dialog column)
set myWidth to make text editboxes with properties {edit contents:"", min width:60}
set myHeight to make text editboxes with properties {edit contents:"", min width:60}
set myBleed to make text editboxes with properties {edit contents:"", min width:60}
end tell
tell (make dialog column)
make static text with properties {static label:"in", min width:0}
make static text with properties {static label:"in", min width:0}
make static text with properties {static label:"in", min width:0}
end tell
tell (make dialog column)
make static text with properties {static label:"", min width:25}
end tell
end tell
end tell
end tell
set userResponse to show myDialog
if userResponse is true then
set docWidth to edit contents of myWidth as string
set docHeight to edit contents of myHeight as string
set docBleed to edit contents of myBleed as string
destroy myDialog
else
destroy myDialog
error number -128
end if
set bigDim to docWidth as string
if docHeight > docWidth then
set bigDim to docHeight as string
end if
set buildSize to 1
if bigDim > 216 and bigDim ≤ 432 then
set buildSize to 2
else if bigDim > 432 and bigDim ≤ 864 then
set buildSize to 4
else if bigDim > 864 and bigDim ≤ 2160 then
set buildSize to 10
end if
set newWidth to (docWidth / buildSize)
set newHeight to (docHeight / buildSize)
set newBleed to (docBleed / buildSize)
tell myDoc
set document bleed top offset of document preferences to newBleed
set page width of document preferences to newWidth
set page height of document preferences to newHeight
end tell
set user interaction level of script preferences to origLevel
end tell

This solved it. I needed to swap the variable with the number. I didn't know that was a rule...
set buildSize to 1
  if 216 < bigDim and 432 ≥ bigDim then
  set buildSize to 2
  else if 432 < bigDim and 864 ≥ bigDim then
  set buildSize to 4
  else if 864 < bigDim and 2160 ≥ bigDim then
  set buildSize to 10
  end if

Similar Messages

  • I am trying to connect my macbook air through my led tv using hdmi but it won't work. I could not find arrangement option on my system preference. how do i make it appear again on my system preference so i can mirror it through my tv. thanks

    I am trying to connect my macbook air through my led tv using hdmi but it won't work. I could not find arrangement option on my system preference. how do i make it appear again on my system preference so i can mirror it through my tv. thanks

    Hi jenette,
    If you are having issues using an HDTV via HDMI as an external display to your MacBook Air, you may find the following article helpful:
    OS X: How to use multiple displays with your Mac in Mountain Lion and earlier
    http://support.apple.com/kb/ht5019
    (Note: You will generally only see the arrangement option in Displays when you are configured to use the external display in Extended Desktop mode; there is no arrangement in Mirroring as both screens are showing the same image.)
    Regards,
    - Brenden

  • HT1937 Hi . I am using a carrier that is not listed in my country which is Saudi Arabia and I'm using Mobily line it won't work with me ..what should I do ?

    Hi . I am using a carrier that is not listed in my country which is Saudi Arabia and I'm using Mobily line it won't work with me ..what should I do ?

    Contact that carrier's technical support people.  It sounds like your issue is with that specific carrier, so only they will be able to help you make a particular device work on their network.
    P.S. if you mean you bought a phone from Mobily and are trying to use it with another carrier, you cannot.  A mobily phone will be locked to mobily, and according to Apple's list, they do not offer unlocking of their iPhones (http://support.apple.com/kb/ht1937).

  • Trying to make a page turning book on a Mac in InDesign, won't work

    I have been trying for a few days to create an interactive book (where the pages turn) but when I go to preview the navigation button won't work (they show the roll over but don't actually move to the next page).  Also I try to export and save as a .swf file but it says that it is 'not supported'.  Can anyone help, I would be very grateful!

    Alright thanks! Ok this is what happens in my end:
    - The interactive PDF you sent me works fine. The iD file opens fine as well and is exactly the same process so that checks.
    -I exported your iD file to .swf, created a new iD document and imported the exported .swf file from the file you created. I exported this new document to interactive PDF. I open it and again I click the links and only google chrome windows open
    This is the link it probably works fine on your end
    https://www.dropbox.com/s/on5tun0v0eunjhu/buttons%20email%20text%20swf%20imported%20to%20i nteractive%20pdf.pdf
    I think there is something going on in my end. "Google Chrome" or "Flash" might be intersecting email links or something becuase I cannot get these .swf + interactive pdf combo to open the email client not even after I used your iD file, exported .swf, imported it and export again to interactive pdf.
    Again the interactive pdf you sent works fine and when I export my file to interactive pdf it works on my end as well, its only after i export to swf and then I use the file inside iD and export to interactive pdf that it does causes me trouble. I will see what I can do to fix this. At least it was working for you so if its only in my end then its not that bad but it will bugg me forever haha!
    Thanks again for your help!! Sorry to take your time Salah!
    -Sebastian

  • Email button created in InDesign won't work on Interactive PDF. Anyone know a fix?

    Hello there, I am trying to make a e-mail button work after its .swf file is imported into a new iD document and exported as a interactive PDF. I have tried various things and work around but I can not seem to be able top make it wrong. I ask iD twiter for help and after a conversation with them I was told to try here.
    OS: Windows 7, iD Version 9.2.1 x64
    This is my process (Will include images and document files)
    1. Create simple solid color box object. Add a text title to the box and otline the text.
    2. Group the objects and make it into a button. Add a roll over appearance.
    3. Add "go to URL" action. One sample button URL is: mailto:test@email(dot)com, Second sample URL is: mailto://test@email(dot)com (the forum editor kept making links to this fake emails)
    4. Export iD document to .swf (Settings where default)
        NOTE* Here the .swf open in chrome and the email buttons work fine as a .swf alone
    5. Import the SWF into a new iD file. Export this second iD file to an Interactive PDF (Seetings where default)
    After doing this I click on the email buttons inside the interactive PDF but they dont start my email app (Outlook 2013) However every time I click either button a new empty Google Chrome window opens.
    Here is a dropbox link to the files themselves, the type is outlines so no need to worry for missing fonts. https://www.dropbox.com/sh/fp76buzt98td8fy/4DD6tqImd9
    I hope someone can help me getting this fixed. Http:// Link buttons work fine on interactive PDF's following this process. For soem reason the email ones are the only ones that wont work. I have to use this process because I am working with an interactive PDF that has an animated roll over menue that does not work with ePub so the only way for my project to work the way I want it too is by exporting .swf of the finished file, importing on a new iD file and re-exporting to a interactive PDF.
    It was really hard finding anyhting related to this issue im having. Here is the only similar  issue I could find and it is from 2008! http://forums.adobe.com/thread/324167 I do hope I am the one doing something wrong here and not that Adobe has not fixed this .swf email links issue.
    Thanks for the help!
    -Sebastian

    Alright thanks! Ok this is what happens in my end:
    - The interactive PDF you sent me works fine. The iD file opens fine as well and is exactly the same process so that checks.
    -I exported your iD file to .swf, created a new iD document and imported the exported .swf file from the file you created. I exported this new document to interactive PDF. I open it and again I click the links and only google chrome windows open
    This is the link it probably works fine on your end
    https://www.dropbox.com/s/on5tun0v0eunjhu/buttons%20email%20text%20swf%20imported%20to%20i nteractive%20pdf.pdf
    I think there is something going on in my end. "Google Chrome" or "Flash" might be intersecting email links or something becuase I cannot get these .swf + interactive pdf combo to open the email client not even after I used your iD file, exported .swf, imported it and export again to interactive pdf.
    Again the interactive pdf you sent works fine and when I export my file to interactive pdf it works on my end as well, its only after i export to swf and then I use the file inside iD and export to interactive pdf that it does causes me trouble. I will see what I can do to fix this. At least it was working for you so if its only in my end then its not that bad but it will bugg me forever haha!
    Thanks again for your help!! Sorry to take your time Salah!
    -Sebastian

  • How to call javascript using applescript in InDesign cs2 Mac

    Hi,
    I need to integrate javascript with my apple script??? how to use it???please help me...i need it immediately..........

    Hi Andrew,
    Here is an example for you – a snippet from my script:
    global myBridgeLabel
    -- function that runs on clicking the button in adobe script studio project
    on clicked theObject
    if name of theObject is "b1" then
    set processName to "Started working"
    set myBridgeLabel to "Red"
    set myLabel to 1
    else if name of theObject is "b2" then
    set processName to "Started doing this"
    set myBridgeLabel to "Green"
    set myLabel to 2
    else if name of theObject is "b3" then
    set processName to "Started doing that"
    set myBridgeLabel to "Yellow"
    set myLabel to 3
    else if name of theObject is "b4" then
    set processName to "Finished doing this"
    set myBridgeLabel to "Blue"
    set myLabel to 4
    else if name of theObject is "b5" then
    set processName to "Finished doing that"
    set myBridgeLabel to "Purple"
    set myLabel to 5
    end if
    tell application "Adobe InDesign CS2"
    set mydocument to active document
    set myDocumentPath to full name of mydocument
    set workerName to "Kasyan"
    tell metadata preferences of mydocument
    set theDate to current date
    set myWeekday to weekday of theDate as string
    set myDenNedeli to my convertWeekday(myWeekday)
    set myRecord to (processName & " – " & workerName & " – ") & myDenNedeli & " " & text 1 thru -4 of time string of theDate & " \r"
    set myHistory to get property namespace "http://ns.adobe.com/photoshop/1.0/" path "History"
    set property namespace "http://ns.adobe.com/photoshop/1.0/" path "History" value myHistory & myRecord
    end tell
    set myJavaScript to "var myLabel =\"" & myBridgeLabel & "\"; app.activate(); var bt = new BridgeTalk; bt.target = \"bridge\"; myScript = 'app.displayDialogs = \"none\"; var t = new Thumbnail (File (\"" & myDocumentPath & "\")); var mdata = t.metadata; mdata.namespace = \"http://ns.adobe.com/xap/1.0/\"; mdata.Label = \"' + myLabel + '\";'; bt.body = myScript; bt.send();"
    do script myJavaScript language javascript
    In this javascript I use pares of single and double quotes.
    The main java script – myJavaScript – (inside double quotes) contains another java script – myScript – (inside single quotes) which runs in Bridge via BridgeTalk.
    I also put variables from AppleScript into JavaScript by using two pares of double quotes – the outside pare I escape with slashes:
    set myBridgeLabel to "Red" -- a variable I defined in AppleScript
    set myJavaScript to "var myLabel =\"" & myBridgeLabel & "\"; app.activate();
    -- the contents of myBridgeLabel variable now becomes part of the JavaScript
    Kasyan

  • Replace text with image using Applescript in InDesign CS5

    Hi to everyone, i'm looking for some suggestions to resolve my problem.
    I've to replace some strings with jpeg images stored on my pc
    Here is the code to replace two strings with the new ones.
    tell application "Adobe InDesign CS5"
              set myDocument to active document
              set myPage to page 1 of myDocument
              set stringsToReplace to {"111", "222"}
      repeat with iterator from 1 to (count stringsToReplace)
           set find text preferences to nothing
           set change text preferences to nothing
           set myFoundItems to nothing
           set element to item iterator of stringsToReplace
          if element is "111" then
               set find what of find text preferences to "111"
               set change to of change text preferences to "ONE"
               set myFoundItems to change text
               display dialog ("Found : " & (count myFoundItems) & " occurences of " & element)
          else if element is "222" then
               set find what of find text preferences to "222"
               set change to of change text preferences to "TWO"
               set myFoundItems to change text
               display dialog ("Found : " & (count myFoundItems) & " occurences of " & element)
          end if
              end repeat
      set find text preferences to nothing
      set change text preferences to nothing
    end tell
    Can you hel me?
    Thanks in advance.

    Hello, I have a couple of questions for you… How come you have strings in text frames… Would you not be better off using labels for this…? ( thats how I would do this ). Off the top of my head I think you will need to remove any text content from the frame to be able to change it's content type… only then will you be able to place a graphic… How are you associating your strings with the required image files… Do you have this in some extenal file Excel or FMP.

  • Multiple keypress using applescript

    Hi there.
    I would like to be apple to have a script to quickly press three keyboard key (q,w,e) when I hold them down. I'm playing a videogame slowly breaking my hand... :-(. I tried to write it in applescript, but I'm really a newbie. Could someone help me. I don't mind the script to be in function outsite the game application (it would then be a "simple" multiple key hold repetition). I would really appreciate help...
    Max

    Be careful what you ask for:
    The literal answer to your question looks like:
    tell application "System Events"
      key down "q"
      key down "w"
      key down "e"
    end tell
    However, that only addresses half the problem. This will run indefinitely, and I'm assuming at some point you want to let go of the keys, too? You don't specify that part of the equation. How do you intend to signal the keys to be released.
    Ultimately the script should include corresponding 'key up' commands to release the keys. You just need to work out the mechanics of how to do that.

  • OS 10.3 works with Linksys but when startup using 9.2.2 won't work

    I apologize if I'm on the wrong forum. I don't know if what I'm asking applies to Express or Extreme--all I know is that I have an airport card in my laptop. I have a wirless airport card in my old titanium G4 and it works fine with my Linksys SRX router when I'm running 10.3. When I start in 9.2.2 (which I have to do to run the version of Virtual PC I own) I can't seem to get the computer to talk to the Linksys. I set appletalk to airport and TCP/IP to airport and DHCP but when I type in the password for the router it says it can't go to the network. Any thoughts? I used to use the 9.2 side with an airport base station that has since died and I hadn't used the 9.2 since I bought the linksys. Thank you.

    I hope I'm doing this right. I forgot to mention
    that I am using WPA personal
    This is why.
    You need to be running 10.3 or later to connect to a WPA encrypted network, a Mac running OS 9.22 will only be able to connect to a WEP encrypted network.
    iFelix

  • Multiple operation using the same port does not work

    I am trying to have multiple operations on both ports
    here is my wsdl snapshot
         <portType name="CommonAlerter">
              <operation name="initiate">
                   <input message="client:CommonAlerterRequestInitMessage"/>
              </operation>
              <operation name="StartWait">
                   <input message="client:CommonAlerterRequestInitMessage2"/>
              </operation>
              <operation name="StopWait">
                   <input message="client:CommonAlerterRequestInitMessage3"/>
              </operation>
         </portType>
         <portType name="CommonAlerterCallback">
              <operation name="onResult">
                   <input message="client:CommonAlerterResponseMessage"/>
              </operation>
         </portType>
    I just added two new methods "StartWait" and "StopWait" to the default async. template that got generated when I created a new BPEL Project "CommonAlerter"
    Now I call this BPEL process from another BPEL project
    The three methods I call "initiate", "StartWait" and finally "StopWait" are at different stages in my calling BPEL processes. Although "initiate" gets called first.
    When I debug the calling process instance I get an error on the call to "StopWait" which gets called after "StartWait".
    Here is the error message
    Exception not handled by the Collaxa Cube system.
    An unhandled exception has been thrown in the Collaxa Cube system. The exception reported is: "ORABPEL-08010
    Failed get operation definition.
    Failed to get the WSDL operation definition of "StopWait" in portType "{http://xmlns.oracle.com/CommonAlerter}CommonAlerter".
    Please verify that operation "StopWait" is defined in portType "{http://xmlns.oracle.com/CommonAlerter}CommonAlerter".
    Now I do have this method in my WSDL
    Can some one help.
    My Message part XSD is
         <element name="CommonAlerterProcessInitRequest">
              <complexType>
                   <sequence>
                        <element name="initializeparam" type="string"/>
                   </sequence>
              </complexType>
         </element>
         <element name="CommonAlerterProcessResponse">
              <complexType>
                   <sequence>
                        <element name="result" type="string"/>
                   </sequence>
              </complexType>
         </element>
         <element name="CommonAlerterProcessRequest2">
              <complexType>
                   <sequence>
                        <element name="waittime" type="duration"/>
                   </sequence>
              </complexType>
         </element>
         <element name="CommonAlerterProcessRequest3">
              <complexType>
                   <sequence>
                        <element name="stopargument1" type="string"/>
    <element name="stopargument2" type="string"/>
                   </sequence>
              </complexType>
         </element>

    Here are the steps for multi operation synchronous BPEL process :
    1.     Create a new BPEL process and delete request and response activities.
    2.     Now add the porttype/operation in the BPEL process wsdl.
    3.     Start the Process with a Pick activity and click on Create Instance checkbox. Remove the onAlarm branch as we do not need this. In the onMessage branch specify the name of the operation.
    4. Now add onMessage branches to match the number of operations. The flow for each onMessage branch is different. Just make sure that you create a reply activity at the end with the correct operation chosen. So you might end up having multiple return activities.
    Sometimes, a wsdl with multiple operations might not work as expected if the process version is 1.0. So try changing the process version in case you are not getting the expected results.
    Hitesh

  • InDesign won't work at all!

    I bought the Adobe CS5 over the summer. I installed it and registered it and all of those things. All of the programs have been working fine aside from InDesign. Every time I try to open the program I get as far as the blank document and then I get the spinning rainbow wheel. This happens every single time. I have tried to sit it out assuming that maybe something was really loading, but left alone it will just do the spinning rainbow wheel for hours on end. I do not know how to fix this. Every other program works without any issues but this one is completely unusable. Please help!

    The big three "suspects" for this sort of problem are usually Suitcase or Q2ID or SING.
    John Hawkinson, our resident Mac crash expert, will ask you to do the following:
    Run Activity Monitor, select InDesign, Sample Process, and upload the file to http://pastebin.com. Then run View > Send Signal: Abort (SIGABRT) to force a crash and upload the crash report there too. Post a link here and we'll tell you why it's hanging.

  • IChat using AIM account suddenly won't work with MAC accounts

    Hello,
    Our company is all Mac and uses ichat on a daily basis for employees to communicate around the world. I have a user in Canada who is experiencing a perplexing problem.
    Until recently, her iChat text ability worked just fine, whether it was to another user with an AIM or Mac ID. She is using an AIM ID. However, there are now 2 users that have Mac ID's that she is unable to receive or send text messages from. If they send her a message, it shows she has an incoming message but she cannot open it. Nor can she send them a message. She can however, video chat with them. I thought at first it had something to do with her having an AIM account and them having Mac accounts, but she is still able to send and receive messages from all other users with Mac accounts.
    I have gone through all her settings that I can think of; nothing is blocked. I asked her if she noticed the problem after an update or something like that. She thinks she was prompted to do a software update shortly before the problem started, but she's not 100%. She's on a MacBook running Mac OS X 10.5.8 and iChat 4.0.2 (604).
    Any insight into fixing this would be greatly appreciated!

    Hi,
    Check the two @Mac names are not set to use Encryption.
    9:21 PM Wednesday; November 3, 2010
    Please, if posting Logs, do not post any Log info after the line "Binary Images for iChat"

  • Need Help on using xdoxslt:ifelse multiple conditions

    Hi Experts
    I have a requirement with multiple conditions and not able to get this working e.g. if possible how to get the variable if condition then get_variable
    <?xdofx: if Group='X' and Price!=0 and ItemId='' then (xdoxslt:get_variable($_XDOCTX,'Price'), ' ')
    else if Group='Y' and ItemId!='' then 'Included'
    else if Group='Z' and ItemId!='' then 'Included' else '' end if?>
    Also I tried using xdoxslt:ifelse
    <?xdoxslt:ifelse((Group='X' and (Price)!=0 and ItemId=''),
    (xdoxslt:ifelse((Group='Y' and ItemId=''),Include,' ')),(xdoxslt:get_variable($_XDOCTX, 'Price'))?>
    Please help it is very critical
    Thanks

    Can you please explain a bit as to what you are trying to achieve?
    for example: if Group = X and Price <>0 and ItemID is null then what are you trying to do?
    You can use choose statements for your scenario.
    Example:
    <?choose:?>
    <?when:ReportStatus='Approved' ?>
    <?'Approved'?> <?end when?>
    <?when:ReportStatus = 'Closed'?>
    <?....?>
    <?otherwise:?>
    <?....?>
    <?end otherwise?>
    <?end choose?>
    Thanks,
    Bipuser

  • How I generate index markers using Applescript and tagged text!

    One of the challenges I've faced in automating the book making process using Applescript with inDesign is that there don't seem to be any AS commands for making new index markers (anyone please correct me I if I'm wrong about this).
    I've tried various js scripts which do an OK job, but they don't make the actual native markers. This means you have to wait until the book (consistiing of multiple ID files) is complete (so that all the page numbers have been established) to generate the index.
    Recently, I read a tweet from someone with a link to a technique which uses tagged text and find and replace with GREP to edit the tags, inserting the tagged text index tags in the text file and then re-placing the text file in the ID page. In itself, this works great. But I'm dealing with literally thousands of separate text frames, none of them connected in a story.
    The books typically consist of around 1200 pages with almost that many people, each of whose names I need to index with "Lastname, Firstname" references. And those particular strings don't (can't) appear anywhere on the pages. There will also be about 50 ID files all combined into one book. So it is imperative that I have ID generate the native index markers. To help keep things straight and efficient, I'm creating separate small text frames to hold the lastname, firstname strings. I created an object style for these frames which sets the attributes to "nonprinting", and I place the frames in the margin.
    Then I realized that I don't actually have to have ID export the tagged text files for each. I exported one prototype and copied its tags to properties in my script, and then I concatenate them with the respective list item values I import from the database.
    At the proper point in the page building script, I tell "textwrangleer" to make a new document, set its contents to the index string for the current record, save it to disk, overwriting the previous one, and then tell ID to "place" it in the index text frame, which generates the ID index mark.
    I actually got an AS error when I first tried this: "file doesn't exist" or some such. Then I realized that the "place" command was happening too soon, so I inserted a .5 sec delay in the script, and it worked.
    This is actually my first major script for actual work, and I'm so excited about it! I promises to cut production time down to about a thenth of what it was.
    I still have to add some logic to branch between handlers with slightly different parameters for five different page formats, but the same page building handler will work on all of them.

    A note on this:
    Daniel Swanson wrote:
    I've tried various js scripts which do an OK job, but they don't make the actual native markers. This means you have to wait until the book (consistiing of multiple ID files) is complete (so that all the page numbers have been established) to generate the index.
    These scripts typically search for words and immediately write out the page numbers they are found on -- one shot indexing.
    The solution is to add both the topic and its page reference to the current document's index:
    if (app.activeDocument.indexes.length == 0)
        app.activeDocument.indexes.add();
    app.activeDocument.indexes[0].topics.add(app.selection[0].contents).pageReferences.add(app.selection[0]);
    The first lines only make sure there is an index to add to (per default, a new document has none).
    The last line adds a selected word to the index (it must be a plain text string, hence the use of its 'contents'), and then adds a reference to the selection in the text itself.
    Adding the same word a second time will for a change (quite untypically for ID's Scripting) not result in an error but simply add another page reference to the existing one.
    When doing this in a loop: remember to work backwards, because the index marker itself gets inserted into the running text, and that will throw off your text indices.

  • Friend's iMessage Won't Work

    My friend has been trying to get iMessage to work on his iPod for ages. We even made a new Apple ID today to use but it still won't work. Pretty much, you go to sign in and it finishes that, gets to the stage where you select the email you want to use, and press next. From there it says "verifying" for a bit, but then without an error message or anything it kicks back to the sign in screen. My first thought was that his date was wrong, but it already is at "Set Automatically". I even tried a "Reset all Settings" but it does the same thing. The Apple ID signs in perfectly on all other devices. Please help.

    Well first if Him and his brother share a PC and have
    user accounts, His user account in windows must be
    set to be a administrator
    He can try installing the standalone version of
    quicktime to see if it fixes it
    http://www.apple.com/quicktime/download/standalone.ht
    l
    If that doesn't work point him to this link
    http://docs.info.apple.com/article.html?artnum=300361
    are ya sure he would have to be an administrator... cuz i dont thnk his brother's user account is sent up that way...cuz his brother is younger...but yea i dont think his bro's user account is set up that way and it still worx on his account...but not my friends...i dunno i also clicked on the 2nd link, and read thru it... and i dont thnk it is an instalation problem cuz his brother is able to use itunes....cuz if he had problems, or if nortonvirus was runnin his bro wouldn't be able to use it either right?

Maybe you are looking for