Add specified tag to comments

I’ve been trying to learn AppleScript, but I simply don't get how you develop a script from scratch. Do you start with the Applescript library? Do you start with lines of script that you already know? The books I‘ve read don't seem to really explain the workflow process for actually creating scripts. They simply describe scripts; yet, they say it it’s easy to develop scripts because it’s almost like the English language.
Anyway, I want to develop a script that will add specified tag(s) to selected tracks.
I got this bit of code from another script, and tried to add what I thought might work, but needless to say, it doesn’t.
tell application "iTunes"
set theTrack to (item 1 of (get selection))
set commentText to comment of theTrack
set commentList to paragraphs of commentText
set newComment to {“youtube download”}
Can anyone assist me?

I don't know whether it's the nature of the language, the skill of the author, or just me, but I've never found a book that I think really teaches AppleScript.
AppleScript is both simple and complex at the same time. Its simplicity comes from the natural-language format of the application, its complexity comes from the diverse (and inconsistent) AppleScript implementation within other AppleScripts.
You see, unlike most other languages the basic abilities of AppleScript are fairly limited. Where it gets its power is in its ability to drive other applications to do the heavy lifting. For example, I wouldn't even consider writing an AppleScript to rotate an image or, in your case, edit an audio file, but it's almost laughably easy to write an AppleScript to tell some other application (e.g. Photoshop for the image, iTunes for the audio file, etc.) to do it.
And that is really where the learning curve of AppleScript comes in - knowing which applications to target, and the specific implementation of AppleScript within that app.
The AppleScript Editor helps some here - it allows you to read the AppleScript dictionary of any application which exposes the commands the application can execute, as well as the classes of objects the application understands.
In your case, if you open the iTunes dictionary in AppleScript Editor you'll see, amongst other things, a track object, along with the properties of a track (i.e. the data that iTunes knows about that track and can manipulate). Familiarity with various application dictionaries is key to getting the most out of AppleScript (you don't need to memorize the entire dictionary, just have an idea of what the app can do, then use AppleScript Editor to view the dictionary and explore).
So for example, how did you know to add: “set newComment to commentText & return & "youtube download"“? Did you look that up in the dictionary, reference book, or did you just know that script you needed?
In this particular case, that's just pure vanilla AppleScript.
As I mentioned above, the base AppleScript language has limited scope that mostly hinges around basic object classes (e.g. 'integer', 'text', 'boolean', etc.) as well as operators (+, -, *, /, etc.), logic ('if/then/else') and loops (e.g. 'repeat').
Your goal required building a new comment for the track where the new comment consists of the existing comment text plus some additional text, so that's what that statement does:
set newComment to commentText & return & "youtube download"
The & character is used to concatenate string (text) objects together. In this case the command combines commentText (previously declared as the existing comment for this track), a return character, and the string of characters "youtube download".
Once those strings have been concatenated they're assigned to the variable newComment which can be used to reference that data later in the script (in this case, on the very next line, but it could be much further away).
That's pure AppleScript. That line of code doesn't depend on any other application (as long as commentText is properly defined, of course).
The trick, and the part you were missing, was knowing to pass that data back to iTunes to apply it to the track.
So how do you learn this stuff?
Well, the AppleScript Language Guide covers pretty much all the basic/pure AppleScript stuff (base classes, operators, loops, handlers, etc.), but it is really a reference guide - something to refer to as needed, not to read end-to-end, so keep it handy but don't sweat it.
The second resource is the AppleScript Editor, especially the dictionary viewer to see what each application can do.
Then there's trial and error - poke around and see what happens.
Then there are forums like this one, and MacScripter where you can ask questions to the community - by and large the people who love AppleScript really LOVE AppleScript and are happy to help solve any problem or question.

Similar Messages

  • Add customized tags on shared review comments

    Hi,
    We have been using shared review to do our document review heavily. Recently I got a request from our stakeholder to add customized tags so we can assign comments in different categories.
    Is it doable with some customization effort? I did some research online and found out Acrobat XI supports customization Wizard and for earlier version (we are on Pro 9), you can do customization using JavaScript, but it's not clear to me if these customization efforts can be applied on shared review PDF, or it's just on regular PDF.
    Does anyone have experience on Acrobat customization? Any thought or information will be appreciated.
    Thanks,
    -Yunju

    Hi Ajlan,
    Thanks for the answer. I also found out about the customization wizard later. Now I'm researching how to use the wizard and deploy the customization feature we desire.
    Here are the things we want to do:
    -  Creating customized menu so we can assign comments to different categories, something like set the comment status
    -  Modify the workflow. Instead of asking reviewer to "connect" or "cancel" when they first open the PDF, we can to only show "connect"
    I also have couple of questions about the wizard:
    1. Are the features I describe above can be done through wizard?
    2. If we deploy the changes using Acrobat 9 + wizard, will users with all version Acrobat/Reader see the same end result and preform regular shared review operations without problem?
    Thanks for the answer.
    -Yunju

  • How do I add Meta tags to pages?

    Is it possible to add meta tag information for the pages (such as keywords, description, robots, etc.) directly in Muse?
    I'd like to add meta tag data to describe the page to help with search engine optimization.

    I found a lot of useful information on here: http://www.muse-themes.com/blogs/news/6103624-seo-in-adobe-muse-search-engine-optimization #comments
    However I would like to know: If you have multiple pages dealing with different topics does one need to adjust the meta-data accordingly for each page.
    For example, I am redoing a website for a small earthmoving contractor who offers a range of services including new lawn installation (NOT mowing!), drainage, landscaping, post hole boring, driveways - to name a few; these are essentially the main pages with content explaining each service a little further.
    So would I be correct in assuming I should have a unique description, keywords and (obviously) page title for each page?
    How about the home page? Should the metadata attempt to cover all services offered within the website as a whole, or just the content of the home page?
    Thanks in advance!

  • Tags from 'Comments' field in Windows Explorer don't show up in iTunes

    I have thousand of files where I allready put tags directly in the comments field in the files proberties in Windows Explorer, but the tags don't show up in iTunes comments field?
    I can then manually put tags directly in iTunes comments field and they will not show up in the proberties of the files in Windown Explorer!
    So I ask, why on earth aren't those fields (in iTunes and in Windows Explorer) compatible, when all other fields (for example name, artist, year) are compatible?

    Okay, thanks for replies and for your time, but the problem continues.
    First: I've ripped CD's in different ways (before starting to use iTunes). I've used Nero, Windows Media Player, Lame and imported mp3 files directly from the internet. Some files have been through Flash Renamer and TigoTago. After importing the files I've tagged them with comments and other stuff directly in Windows Explorer. And then I decided to use iTunes because of buying iPods and playing music through AirPort Express.
    What I've tried to right now:
    I've tried to check files with MP3Val, but it said the files were OK.
    Then I tried - with another laptop - to install I new iTunes program (English language to be sure and there after I imported/ripped a new CD using iTunes to import. Before importing I put a tag in the Comments field in iTunes and it never showed up in Windows Explorer Comment field. I also tried after that to put tags directly in Windows Explorer Comment field and add the files once again to iTunes library, but again, no comments in iTunes. Also again put tags in iTunes, but no tags in Windows Explorer.
    Then I did more or less the same using Realplayer to import the CD, but with the same negative results.
    *Then I went back to my old laptop, imported a CD using iTunes and then tagged the comment field in Windows Explorer and suddenly I got comments in iTunes! But the comments look like this: "00000000 00000210 000008E8 0000000000775908 00000000 0040E5E1 00000000 00000000 00000000 00000000 00000000 00000000".*
    I don't know what to do with this?
    And apparently, it's only when importing new files using iTunes to rip the CD, that this happens. Otherwise, nothing happens at all.

  • How to add b tags in your XML when changing style to Bold

    I'm currently checking if there is an easier way to automatically add <b> tags when changing font style to Bold in your xml. I'm not sure how to override the format  of a structured application automatically in FM. Do I need to create a script for this? Or is there any configuration that can be made to make this work automatically?

    Most of the discussion on this thread has dealt with the relevance of the Bold button on FrameMaker's Text Formatting toolbar to structured documents.
    While someone made the suggestion to create a <b> element and then insert text within the new element, I don't think anyone has yet commented on how easy it is to wrap an element (<b> or another element) around existing content. You can do so with the Element Catalog. Simply select the content to be wrapped and double-click the tag of the new element (e.g., b) in the Element Catalog. Or click the tag in the Element Catalog and then the Wrap button at the bottom of the Catalog.
    If you prefer to use the keyboard, you can use what is called Smart Insert in FM 11 and quick keys in earlier versions. The first three buttons at the bottom of the Element Catalog window are Insert, Wrap, and Change. You don't need to have the Catalog open to use Smart Insert. I mentioned the buttons only because that order is pretty easy to remember--1. Insert, 2. Wrap, 3. Change. The keyboard shortcuts Ctrl-1, Ctrl-2, and Ctrl-3 bring up the Smart Insert or Quick Keys to Insert, Wrap, or Change an element. With Smart Insert, a pop-up menu appears that shows the available elements. You can use the up and down arrow keys to navigate to the one you want, or type a unique prefix. Then press Enter to perform the operation (or Esc to cancel). With Quick Keys, the left side of the status bar at the bottom of the document window or Structure View (whichever is current) will prompt for the element tag with I: for Insert, W: for Wrap or C: for Change. Again, use the arrow keys or a prefix to display the desired element tag and then press Enter.
    So, to create a new <b> element to hold an existing string, select the string, type Ctrl-2 b, and press Enter.
    That said, I will close with an observation on the use of format overrides in structured documents. While automatic formatting based on element structure is the heart of structured FM, the software was deliberately designed in recognition that as a practical matter it is sometimes necessary for an author to create formatting that the document's element definitions simply do not provide. It therefore allows the user to tweak the formatting (for example, by deliberating making some content bold without using the element structure to do so). Users should understand the difference between element-based formatting and format overrides and use the latter with care if at all.
         --Lynne

  • The function "containsIgnoreCase" for prefix "fn" can not be found in the specified tag library.

    Hi All,
    I am getting this error on my jsff
    The function "containsIgnoreCase" for prefix "fn" can not be found in the specified tag library.
    jsff includes -
         <jsp:root   xmlns:f="http://java.sun.com/jsf/core"
              xmlns:fn="http://java.sun.com/jsp/jstl/functions"
              xmlns:c="http://java.sun.com/jsp/jstl/core">
    Error at this line -    <af:inputListOfValues
                                                      disabled="#{fn:containsIgnoreCase(bindings.Items.attributeValue,'XYZ')}" >
    Is it Library file issue ? I have already added JSTL1.2.

    Hi Frank,
    I have imported the same directly by code.
    I am facing this issue on one of my system, but the same code is working fine in my other systems. I have tried re-insatlling jdev and importing all the files.
    But still facing the same issue.. This might be some jdev issue in specific system ?
    Please let me know if anything i need to add .

  • I am running 10.6.8 and using iweb for my web site. After several SEO analysis they all indicate I need H1-6 header tags. After looking at the source code I see there are none in iweb. Is it necessary to add? If so, how do I add H Tags to iweb.

    I am running 10.6.8 and using iweb for my web site. After several SEO analysis they all indicate I need H1-6 header tags. After looking at the source code I see there are none in iweb. Are they necessary to add?  Why would one add these tags and how do I add H Tags to iweb? And are there examples to look at? I am slowly learning about simple web design and assumed that iweb was stand alone without having to write code. Is this one of the reasons iweb is no longer supported? Thanks for looking at this!

    A simple text page like this:
    Heading
        sub heading
              text paragraph ....
    Is traditionally represented by html tags like:
    <h1>Heading</h1>
         <h2>sub heading</h2>
              <p>text paragraph ... </p>
    I would guess that the use of h1-h6 tags helps search engines to understand the structure of a page as the tags imply a certain structure.
    This can be compared to more generic tags like <div> that could represent any kind of content - and may be what iWeb uses (you'll have to check yourself).
    I would generally recommend that you use some kind of up to date blog/site building tool, perhaps Wordpress or Squarespace (I haven't used either one myself) that support current web technologies - this should reduce your SEO issues and make it easier to properly support mobile/tablet users.

  • How do I add Meta tags to my website

    I have produced a website in i web and published it to my .mac account.
    I need to know how to add meta tags to get it recognised by the search engines.
    The company I am using to do this want the ftp info. As I upload directly to my .mac account I am not sure what they need. Can you help please?

    I think I may have a good workaround here, not sure how it will work with .mac as I dont use it, I am in control of my default page within Apache.
    Create your site as normal within Iweb and publish it.
    Outside of iWeb create your site's real default homepage by hand, that contains the meta tags and that redirects to your iWeb homepage. In this way any Search engine hits to your site will hit the external page first, reading the meta tags then get redirected to your real home page. Not ideal of course but at least you don't have to keep an eye on your metatag's being overwritten by republishing your homepage.
    Here is the code from mine, it appears to work:
    +<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://+
    +www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><title></t+
    +itle><meta http-equiv="refresh" content="0;url= Welcome.html" />+
    +<META NAME="keywords" CONTENT="enter,your,keywords,here">
    +<META NAME="description" CONTENT="description of your website">+
    </head><body></body></html>
    This page will redirect to the "Welcome.html" page created in iWeb.
    Hope this helps.
    Message was edited by: berrymp

  • Add xml Tags in Indesign CS4 by Apple/Java script

    Hi,
    All, I'm new to Indesign Scripting, and I'm hoping someone can help me with the following add xml tags in my xml indesign cs4 files.
    I have IDML (ETMV2) xml Indesign CS4 files. But i have lots of powermath equation without xml tags. So i want how i can insert xml tags.
    My probleam like this =>
    <no open xml tags>[&x^{2}+y_{3}&]<no close xml tags>
    I want like this (But i do manualy)
    <inlineequation><inlinemediaobject><textobject role="xpressmath">[&x^{2}+y_{3}&</textobject></inlinemediaobject></inlineequation>
    Can anyone write/suggest me how i can add xml Tags. By Apple/Java Script
    Any insight is appreciated!
    snegig

    Hi,
    John Hawkinson thank you so much your suggestion.
    I am new  this type of discusion (on this page). So i think anybody could not replay my answer. So i repost my question.
    I want insert tags in my Indesign CS4 files. Is this posible when i select my powermath equaiton then run script. Script add tags automatically before/after my equation. Please ignore IDML word.
    Yes i an comfortable with XSLT presently i working with Pearson ETMV2.
    I have one more question when i past my snapshot its appear properly but when i agin see my commant then my snapshot disappear (see small blue rectangle).
    Thank you John again i am new in this industry please guide.
    snegig

  • What is the best way to add "meta tags" in edge?

    Trying to add meta tags for search engines, what are the best ways to do this?

    With the latest version of Edge (3.0) is still the best practice to edit index.html or is there a better one?
    Y try for example...
    var meta1 = '<meta name="robots" content="index, follow" />';
    $(meta1).appendTo("head");
    ...in creationComplete or in document.compositionReady but I can't see these lines in index.html file, are stored in index_edgeActions.js file.
    But maybe that works to attach the meta tags with append to head because it does work fine (and neither are saved in the index.html):
    var favicon = "<link rel='shortcut icon' href='images/volicon.png' type='image/png'/>" ;
    $(favicon).appendTo("head");
    I don't know if Google detect meta tags stored in index_edgeAtions.js or is more recommended to modify index.html manually with notepad.
    Maybe the best practice are save and publish Edge project with a name different than index (for example project.an and project.html) and to create an index.html manually with meta tags, code of Google Analytics and Google Tag Manager, etc., and with HTML meta http-equiv Attribute for to redirect immediately to project.html generate with Edge (remember disallow project.html in robots.txt). In this way is not necessary to modify the index.html file each time that we publish.
    How do you see?

  • Need to add xml tag in the request message

    Hello Experts,
    Need ur help.
    Right now i am working on the scenario Http -> to -> Proxy.
    Whatever request i am getting is not having XML tag in it, and because of that my mapping is failing.
    Can you tell me that how can i add XML tag in my request so it will not fail in Mapping?
    Need to add : <?xml version="1.0" encoding="UTF-8"?> in request.
    Thanks,
    Hetal

    HI Hetal
    Instead of adding this to the source message. Remove this tag from mapping.
    Use a XSLT mapping without this initial tag. it will work.
    <?xml version="1.0" encoding="UTF-8"?>
    <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:m="http://namespace">
    <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
    <xsl:template match="/">
    <xsl:for-each select="//tag">
    <xsl:value-of select="." disable-output-escaping="yes"/>
    </xsl:for-each>
    </xsl:template>
    </xsl:stylesheet>
    Use this mapping without
    <?xml version="1.0" encoding="UTF-8"?>
    If you still see XML tag then use
    <xsl:output method="html"
    instead of
    <xsl:output method="xml"
    Thanks
    Gaurav

  • How to add meta tag flash file

    Is there an easy way to add meta tags to a Flash file that is
    used in Dreamweaver? I would like to have the information within
    the file be picked up by the SE spiders. Thanks for any
    suggestions. -ab

    No. SEs don't read Flash.
    Walt
    "Alberg15" <[email protected]> wrote in
    message
    news:f6pi4i$86r$[email protected]..
    > Is there an easy way to add meta tags to a Flash file
    that is used in
    > Dreamweaver? I would like to have the information within
    the file be
    > picked up
    > by the SE spiders. Thanks for any suggestions. -ab
    >

  • Trying to add DOCTYPE tag to Portal base Page

    I am trying to add the tag <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd"> to the top of my base Portal pages so I can use some of the CSS positioning functions. IE does not seem to want to support them unless the DOCTYPE is set. This is an 8.48 / Portal 9.0 installation.
    I am having trouble ascertaining which object or code sets the header tags.
    I am seeing:
    <html dir='ltr'>
    <!--
    Copyright (c) 2000, 2006, Oracle. All rights reserved.
    NETSCAPE/7.0 ToolsRel: 8.48.09 Portal Target URL: -->
    <head>
    I have seen various spots where <html dir is built in HTML or code but none of them seem to be called along with any code to insert Oracle copyright information.
    Is a certain part of this being built through server configuration rather than PeopleCode/HTML combinations?
    Does anyone know the objects being invoked?
    Thanks,
    -Bryan

    Hi friend,
    thanks for your reply,
    I have done the KM iview, where i uploaded the document.
    i have the link http://<hostname>:<port>/irj/go/km/docs/documents/testfile.ppt
    can you please tell me which files needs to be edited, what href code need to put their please assist me.
    after i done the code means how can i execute & perform unit test in NWDI to get my exact result.
    pls assist me with some documents, if you have....
    thanks,
    Udhaya.

  • Error:"The specified tag name was not found"

    Hello:
    My problem is the FieldPoint error message in LabWindows/CVI v6.0.
    When hook up with Ethernet module(FP-1600), NO Problem on the source code, specially item Name "All". See the actual code.
    if(status = FP_CreateTagIOPoint (ServerHandle, resourceName, deviceName, "All",&IOPointHandle))
    But When hook up with RS-232C Module(FP-1000), occured error. The error code is 32812, that means "The Specified tag name was not found."
    What makes this error? Why item name "All" makes the error when using FP-1000?
    Please help me.
    Thank You.

    Make sure the resourceName and deviceName match what is in FieldPoint Explorer. See the following KB:
    http://digital.ni.com/public.nsf/websearch/02EB73D02715981A8625682B00774F8F?OpenDocument
    Also, I have seen this error when targetting serial modules with FieldPoint Explorer open. Make sure FP Explorer is closed.

  • HTML tags in comments

    How do you disallow HTML tags in comments?
    I want users to be to be able to submit comments on my site
    but I don't want them to input their own html. Whatever they type
    should show as plain text on the comments page.
    I am using PHP / MySQL.

    .oO(AngryCloud)
    >Doesn't mysql_real_escape_string already do exactly what
    magic quotes does?
    It does even more. mysql_real_escape_string() performs a
    DB-specific
    escaping and takes the used charset into account. Magic
    quotes actually
    just do the same as addslashes(), which is not enough for DB
    security.
    >Magic quotes just seems to just be an annoyance. Can I
    just turn it off so I
    >just don't have to worry about it?
    Yes. In PHP 6 they will be removed anyway. If you can turn
    them off on
    your server - do it.
    >Also, I have A LOT of dynamic text on my site amongst
    many pages. Does this
    >mean I need to go and put the htmlspecialchars function
    in front of each and
    >every little bit of dynamic text?
    To be safe - yes. If you are sure that the printed text
    doesn't contain
    any of these chars &, ", <, then you can omit it, but
    for anything else
    (especially if the texts are entered by users) it's better to
    use it.
    >Would it be a bad idea to use the function in
    >the insert script instead?
    Yes. You shouldn't store HTML in the DB (unless it's really
    necessary),
    but the raw text without any special encoding. Maybe some day
    you want
    to use the same text from the DB not only for a webpage, but
    also in an
    email or newsletter as plain text. Any HTML would be a
    problem then and
    would have to be removed.
    Just store the raw text and call the necessary
    escaping/encoding
    function when you output it.
    Micha

Maybe you are looking for

  • Dynamic Subject Line not appearing in PO mail

    Hi Experts, In tcode ME28 when i get the list of POs to be released , I click on the release possible icon against the PO number. On clicking of this, a mail goes to the vendor of the PO. My requirement is to change the subject line of this mail. I h

  • Iterator vs. ViewLink

    Build JDEVADF_11.1.1.3.PS2_GENERIC_100408.2356.5660 Hello, I have a link view of two views, such personView and employeesView . I can see the viewEmployees under viewPerson in Data Controls. I want to show the elements of two views on my jsp page. fo

  • Making old material number mandatory for mm02

    hi,    how to make  old material number(mara-bismt) mandatory for mm02 transaction. regards

  • Export to file fails

    Hi, We are not able to export to a file from any form File---> Export 12.0.6 Please help

  • Skype: no system-tray icon with Arch (+ xfce)

    When I close Skype (the one and only skype window), skype is still running in the background. When I run Zenwalk with xfce, there is a skype icon as part of the taskbar, which indicates that skype is still running in the background. This icon does no