Applescript: Find a phrase and add text below it

Hello, I am somewhat new to Applescript. I am trying to create a script that will contain dialogs to gather a few pieces of info then use that info to add 1) an item to a text file list and 2) add the input to a script file. Here's what I have:
This is the part of the script that creates a list of choices in a dialog (I'm using an Applescript application):
set Parts to paragraphs of (read POSIX file (theFolder & "Contents/Resources/list.txt"))
repeat with nextLine in Parts
          if length of nextLine is greater than 0 then
                    copy nextLine to the end of listOfParts
          end if
end repeat
set chosen to (choose from list listOfParts with title "Add A Part" with prompt "Select part" without multiple selections allowed) as text
Once it's chosen, I set variables based on the choice:
if chosen is "Limit Thermostat" then
          set theItemNumber to "29329.1000"
          set itemDescription to "Limit thermostat "
          set theWarehouse to "parts"
          set theLocation to "a8d1a"
end if
Then there's a short script below this section which adds the selected part to my accounting application.
This works perfectly. Now, let's say I have a new part to add to my list and need to create the section above in my script. How can I add the text to the script file below the last section of "if chosen..." but before the rest of the script using an Applescript?

Hello, I am somewhat new to Applescript. I am trying to create a script that will contain dialogs to gather a few pieces of info then use that info to add 1) an item to a text file list and 2) add the input to a script file. Here's what I have:
This is the part of the script that creates a list of choices in a dialog (I'm using an Applescript application):
set Parts to paragraphs of (read POSIX file (theFolder & "Contents/Resources/list.txt"))
repeat with nextLine in Parts
          if length of nextLine is greater than 0 then
                    copy nextLine to the end of listOfParts
          end if
end repeat
set chosen to (choose from list listOfParts with title "Add A Part" with prompt "Select part" without multiple selections allowed) as text
Once it's chosen, I set variables based on the choice:
if chosen is "Limit Thermostat" then
          set theItemNumber to "29329.1000"
          set itemDescription to "Limit thermostat "
          set theWarehouse to "parts"
          set theLocation to "a8d1a"
end if
Then there's a short script below this section which adds the selected part to my accounting application.
This works perfectly. Now, let's say I have a new part to add to my list and need to create the section above in my script. How can I add the text to the script file below the last section of "if chosen..." but before the rest of the script using an Applescript?

Similar Messages

  • Purchased Acrobat XI Pro - was able to edit text and add text and now does not allow me to do anything -

    was able to edit text and add text and now does not allow me to do anything - Except purchase the software again.Can't find an answer to this anywhere.

    Use Adobe Acrobat, not Adobe Reader.

  • Is there a way to increase the icon size (and the text below) without using zoom?  I am trying to help out someone who has moderate visual impairment that does not want to use zoom just to see the icons and their labels.

    Is there a way to increase the icon size (and the text below) without using zoom in iOS 7?  I am trying to help out someone who has moderate visual impairment that does not want to use zoom just to see the icons and their labels.

    Hello Apple.
    It seems you have gone to great lengths to improve accessibility in many areas of the iPad. Why was this obvious problem with icon text size missed?  (It's not with the Mac.). And for so long too.
    Do you employ people with actual accessibility problems to help you do UI design?
    I think too, that some buttons are too close for people who might have motor control problems.
    I love my iPad but I fear as I age, the iPad might not keep up with me.

  • Draw a symbol and add text in UIImageView.

    I want to Draw a symbol and add text in UIImageView. when move it should move together. When it would get opened next time, it should be editable. pls needful for me

    Hi,
    You can check out a similar thread where the poster has opted to use imageicons instead of shapes. That thread is here.
    http://forums.java.net/jive/thread.jspa?threadID=15074&tstart=0.
    As for creating different color shapes for different cells of the jtable, it is definitely possible once you have a custom renderer for your jtable. Just read up on how to create custom table cell renderer.
    cheers,
    vidyut
    http://www.bonanzasoft.com

  • How Do I Remove and Add Text To a .aep Movie Template?

    Hi,
    I have a .aep file that contains a video template. The template is made to be edited with Adobe After Effects. I am very new to the software and have no idea how to proceed. I have imported the .aep file  to After Effects and it shows up there just fine. the movie template consists of four or five different screens where the text is to be changed to text of my choice.  I need to change the text in each individual screen. How do I do it without changing the existing text effects?
    Can some one point me in the right direction?
    Thank you for any help you can give me I am confused as well as desperate! Help...

    Todd thank you also I will read the information that you sugested.
    Tontyp

  • How do I edit and add text to a file on my android

    Oil need to fill a form that was sent to me . I also want to be able to make a pdf first

    Hi timsdream:
    I don't think this is a Firefox question. I don't think you can edit PDFs in Android from a browser if that is what you are asking or are you asking about text editing on Android?
    Anyhow if it is a Firefox question please let us know the usual troubleshooting stuff:
    * what version of Firefox
    * what version of Android
    * what you did, what you expected, what happened
    * any other details that might help!
    ...Roland

  • The icons in the bookmark tool bar are blank and the text that use to be below the icon is gone. I now have to cursor over the blank icons to see the text and the one I want. Can the icon/text customization be returned?

    In the Navigation Toolbar, the icons "Back", "Forward" etc. show the small icon and the descriptive text below the Icon. My Bookmark Toolbar use to have the same icon/text format but at some point, possibly a browser update, that changed. Currently, I do have a visible Bookmark Toolbar BUT the icons do not show the website icon, as previously, and the text below each icon is gone. I an cursor over each icon and the text becomes visible next to the icon. This is a bit of a pain to find a bookmark. Can I do a customization to return to the icon/text format.
    Was this changed because browser users requested this option, or was it an internal decision.? If the later why make such changes when not requested?
    Ed Sander

    That wasn't a change in Firefox. It sounds like something is broken in your Firefox installation, or you are misunderstanding the different between the Bookmarks Toolbar and the other Toolbars.
    In the Bookmarks Toolbar the text appears next to the website icon, not below the icon as with the other two Toolbars, and it's not switchable between text and no text as with the other Toolbars. With both the bookmark icon and the Bookmark name missing, something is broken in your installation. You need to do a little troubleshooting.
    Do you have that problem when running in the Firefox SafeMode? <br />
    [http://support.mozilla.com/en-US/kb/Safe+Mode] <br />
    ''Don't select anything right now, just use "Continue in SafeMode."''
    If not, see this: <br />
    [http://support.mozilla.com/en-US/kb/troubleshooting+extensions+and+themes]
    If your problem isn't related to an extension, your bookmarks data base file (places.sqlite) is probably corrupt. <br />
    http://kb.mozillazine.org/Locked_or_damaged_places.sqlite <br />
    Be aware that if you delete the "places.sqlite" and similar files, your bookmark website icons won't automatically appear (the JSON backups don't have that icon data) when you restart Firefox and the places.sqlite is rebuilt using the backup data file, but the icons should be saved the first time each bookmark is used for the first time.

  • Photoshop open multiple image and add different texts

    Hi All,
    Hope you are all doing great. I just started doing photoshop scripting due to the requirement which I will mention in detail below.
    My scripting is knowledge is very basic so I was hoping you guys could be able to help me out with this.
    The requirment is that I have 100's of images which needs to be opened in photoshop and add text based on the image name then save the image as JPEG at 70 quality. For example:
    I have images named as below in my desktop folder,
    Image1.jpg
    Image2.jpg
    Image3.jpg
    Image4.jpg
    Image5.jpg
    Image6.jpg
    Image7.jpg
    Image8.jpg
    Image9.jpg
    Image10.jpg
    For the script, I think the easiest way is that if I define what image name are:
    image[1] = Image1.jpg
    image[2] = Image2.jpg
    image[3] = Image3.jpg
    image[4] = Image4.jpg
    image[5] = Image5.jpg
    image[6] = Image6.jpg
    image[7] = Image7.jpg
    image[8] = Image8.jpg
    image[9] = Image9.jpg
    image[10] = Image10.jpg
    and for text I have done this:
    text [1] = Image1
    text [2] = Image2
    text [3] = Image3
    text [4] = Image4
    text [5] = Image5
    text [6] = Image6
    text [7] = Image7
    text [8] = Image8
    text [9] = Image9
    text [10] = Image10
    So everytime when I run the script image1 will be added to the photoshop and the text name Image1 will be added (For this I think defining layer name would be better so I will gave "Imagetext").
    Then the image will be saved on a specific location on my desktop.
    I have all this plan on what I want to do but I don't know how to write the script using photoshop API and my limited javascript coding.
    So if you guys could help me out with this, that would be awesome. Hope to hear on this soon.
    Kind Regards,
    Zoogle

    Hi Ghoulfool,
    Thank you very much for taking your time in looking into my question.
    Also thanks for the script you've provided. Your script works perfectly close to my requirements but there are few minor addon that I would like to request please.
    My apologies for not being very clear
    First of all to answer your questions:
    Image size varies but mostly between 1200-1000 pixels.
    Good question regarding text size, I would like to control the size of the text based on how long the character length is.
    Position varies so I would like to adjust it manually or if I could definie within the script that would be superb.
    The images open in new window rather that staying in the currently opend psd, I have other layers which I need to keep it as static and use the script to add the image between these layers.
    I wouldn't mind if all these 100's of images stay in current psd as layers.
    I was hoping if possible I would have more control over what text I would like to put on the image.
    Below is the example , I am sure the code below is wrong but with my limited scripting that's all I could come up with
    This is the code that would be controlling what text/text size appear on images based on the i value:
    var publicPath = 'C:/Users/Username/Desktop/imagesavetest';
    var outputPath = publicPath;
    var imagetext = new Array();
    imagetext[0] = "imagetext0";
    imagetext[1] = "Apple";
    imagetext[2] = "imagetext2";
    imagetext[3] = "Pineapple";
    imagetext[4] = "Orange";
    imagetext[5] = "imagetext5";
    imagetext[6] = "imagetext6";
    imagetext[7] = "Berries";
    for (var i in imagetext) {
      textLength = imagetext[i].length;
      saveMyFile = imagetext;
      theText.contents = imagetext[i].toUpperCase();
      switch (true) {
        case textLength <= 9:
          theText.font = "Arial";
          theText.size = 38;
          theText.contents = imagetext[i].toUpperCase();
          break;
        case textLength > 9 && textLength <= 12:
          theText.font = "Arial";
          theText.size = 28;
          theText.contents = imagetext[i].toUpperCase();
          break;
      saveAsJPEG(outputPath,  saveMyFile);
      counter++;
    And to open files from the user defined location:
    var inFolder = new Folder("C:/Input")
    var image = new Array();
    image[0] = "image0.jpg";
    image[1] = "image1.jpg";
    image[2] = "image2.jpg";
    image[3] = "image3.jpg";
    image[4] = "image4.jpg";
    image[5] = "image5.jpg";
    image[6] = "image6.jpg";
    image[7] = "image7.jpg";
    for (var j in image) {
    if j=0 look for i=0 and add i value as text
    To simplify i'll open psd with layers, add image between existing layers and add text based on the text name which we defined in script.
    Sorry for long post, but hope I have not made this simple process confusing.
    Please do let me know if you have any questions. Hope you hear from you soon and Thanks for your time.
    Kind Regards,
    Zoogle.

  • Difference between 'add text' tools and adding Layers

    I am trying to add text to a .pdf form that has no preset text boxes. I see I can either add text via the tools menu with the 'add text' tool or the fill and sign menu with the 'add text' tool as well. They both seem to behave differently and I have a difficult time selecting, moving or editing text that is close to existing elements with both tools. What is the intended difference between these tools? Also, it would be nice to add a layer to just add my text to without interfering with the existing elements, but I see no way to actually add a layer in Acrobat Pro XI. I know I can do this in Illustrator, but I was looking for a simpler solution that works in Acrobat.
    Thanks!
    Colin

    Hey Kolinized,
    Difference between "add text" tool via the 'tools' pane and "add text" tool via 'fill and sign' pane :-
    * Tools>Content Editing>Add Text :- Selecting this option, we can customize the text as well the rectangular box it will create.We can place the box anywhere on the page.
    * Fill & Sign>Fill & Sign Tools>Add Text :- This option is slightly easier ,however, customizes text only(Typewriter tool in Acrobat X).This tool is preferred to fill up various kinds
    of forms .
    Thanks
    Sukrit Dhingra

  • How to add text to photos[non slides]

    I can't find any way to add text to a slide except with slideshow or book page. Surely Aperture couldn't forget this. Anybody??

    Aperture didn't forget that -- it's outside its remit.
    Aperture provides powerful tools for two tasks:
    Digital photograph conversion and development (esp. RAW), and
    Digital asset management (a/k/a DAM).
    You might be able to do what you want with the free but full-featured Aperture plug-in Border FX.
    For true compositing (combining graphics elements, text, and geometric primatives), you need a graphics program.
    Terence Devlin has provided a superb linked list here.

  • How To Add Text Outside Of The Spread Sheet Grid?

    The data in the SS has been entered and saved. I want to add text below the grid as there is room to do so.

    Hello
    You may open the Tools palette (with the red suitcase) then select the "huge A" icon to create a text frame in which you will be able to enter text.
    An other soluce would be to create a WP or a Draw document, create a SS frame on it, then copy paste your existing SS into the SS frame.
    At last, enter text in the free space.
    Yvan KOENIG (from FRANCE vendredi 25 août 2006 21:55:19)

  • Add text in any working page using script

    Hi there,
    I am writing a script which creates a text frame and adds text in it. The problem is, I want to add some information below everytime on many documents. Instead of copying from other sources everytime, I thought of writing a scirpt which by clicking creates a text frame and puts text in that because it is the same for all. Now two issues:
    1) It is coming but in the first page. I need that in the working page, for example clicking that it should come in page 2 or 4 and not in the first page.
    2) The text has a word should be in quotes giving like that the script shows error. My example code is given below:
    var myDocument = app.activeDocument;
    var myTextFrame = myDocument.textFrames.add()
    myTextFrame.geometricBounds = ["11.2in", "8in","10.99in","0.5in"];
    myTextFrame.contents = "This is a "sample" text.
    Please try without quotes first. Without quotes for sample word it is coming in the first page. With quotes it shows error.
    What is the solution. 1) need to add on the current working page. 2) should also include a word within quotes.
    Help really appreciated!

    Hey Rohan,
    It did worked. GREAT.
    If you can give the solution for the second one, i.e. getting the text within the quotes, that will be a great help.
    As You and Ken said, I sent this to the scripting forum too. But as you have already got the first one, had a hope that you might get the other too.
    Thanks

  • Text below images in mail converteted to .txt or html attachemnts when sent

    Using Apple mail with Exchange account.
    If I add text below an image in an e-mial, the text is often (but not always)
    converted to an attachment ending in .txt or .html.
    So the recipient rarely sees the text message. Very frustrating.
    Apple Care is like huh?
    I did some searching on it a few weeks ago, but no sound solution.
    Anybody figure this one out yet?
    TIA!

    Burnt by Apple PR wrote:
    I am using Rich Text and the messages even show up that way in my Sent folder and when I CC them to myself, I get the same thing.
    Now that's unusual. It sounds like your ISP could be "helping" you. Unfortunately, e-mail issues are very difficult to debug in a web-based forum. To really track things down and identify where the problem is, you have to see the message. You can send an example to me at the address info at etresoft dot com.
    I have to warn you that Apple Mail comes out blameless 8 times out of 10.

  • How do I add text to a photo when making a calendar from iPhoto?  I see the text box for the dates but not for the actual photo...thanks.

    I can't find a way to add text to a photo once it's been put into the top pane of the calendar month...is there a way to do this since I'd like to add a descriptor to the photos?  I see the text box when you click on the calendar date, but don't find one for the photo pane.  Thanks for any assistance.

    Right - you can not add text to photos with iPhoto - you must use an external editor
    LN

  • I can no longer sign or add text to documents that I was able to with past versions of adobe

    I am using the same documents I always have. they have blue fillable sections that work still, but blank lines at the bottom to add text such as date, name and a signature. I cannot add that info anymore. I have tried reinstalling and repairing the newest adobe. I have other forms that I can sign and add text but these forms don't have the fillable fields in them. All permissions are given on all the documents. I have the workaround of filling out the forms, printing as a pdf, saving, opening and THEN signing them but that is an awful lot of extra steps to go through. Any help with this is appreciated.

    Hi William,
    Please let me know the version of Adobe Reader & operating system installed on your computer.
    Regards,
    Aadesh

Maybe you are looking for

  • How can i register multiple apple id's and ipad with a single credit card?

    Hello Everyone, I am trying to register 15 iPad 2 with 15 apple id using same credit card details in the itunes section. When i register for more than one user i get an error message saying "please contact iTunes support to complete this transaction"

  • Getting error while hitting weblogic server from EBS client instance

    Hi, We are trying to hit weblogic server from EBS client instance. Steps Done from our side :- 1. Created a self signed key store and certificate (.cer file) with server host name and used it for SSL enabling on weblogic server. 2. Created a self sig

  • How to setup a sound bar on LED TV 42SL417U

    So I've been trying to figure out how to setup a sound bar that uses AUX Left and Right cables onto my LED TV 42SL417U. I've been trying to connect the cables into every possible port on the TV and nothing works. What do I do???

  • QuickTime is not playing a Torrent Video

    I downloaded the first season of The Big Bang Theory and when I tried to play it, a window popped up saying that I needed to download a plug in or more softwate for QuickTime. I don't know which software or plugins I need to download. CAN SOMEONE PLE

  • XSLX as File Type in 10g Plus or 10g Desktop ?

    Does anyone know if any patch is available to make xslx as file type in either Discoverer 10g PLUS or DESKTOP Thanks