Help with a simple applescript for combining Artist text with Track name

Hi all,
I'd like to put together a simple script that takes the artist names from a list of tracks in iTunes and copies the text to the start of the Title name, followed by " - ".
This is because, e.g. on a classical album, I want the artist names to all be "Classic Collection Gold" but I'd like to keep the artist name contained with the track name. This means when I browse by artist I don't get millions of artists...
I found this script, which does something kinda similar, but I'm new to script writing so not sure how to do it?
So I'd like to change:
Name
Planets: Mars
Artist
Gustav Holst
Ambum:
Simply Classical Gold (Disc 2)
To be:
Gustav Holst - Planets: Mars
Artist
Gustav Holst - Planets: Mars OR BETTER Simply Classical Gold (Disc 2)
Album
Simply Classical Gold (Disc 2)
This script has some ideas in, but I'm not sure how to tweak it....
"Artist - Name Corrector" for iTunes
written by Doug Adams
[email protected]
v1.6 May 17, 2004
-- removed ref to selection
v1.5 April 11 2004
checks if separator string is in name
v1.0 April 2 2004
Get more free AppleScripts and info on writing your own
at Doug's AppleScripts for iTunes
http://www.malcolmadams.com/itunes/
property separator : " - "
tell application "iTunes"
if selection is not {} then
set sel to selection
repeat with aTrack in sel
tell aTrack
if (get name) contains separator then
set {artist, name} to my texttolist(get name, separator)
end if
end tell
end repeat
end if
end tell
-- == == == == == == == == == == == == == == == ==
on texttolist(txt, delim)
set saveD to AppleScript's text item delimiters
try
set AppleScript's text item delimiters to {delim}
set theList to every text item of txt
on error errStr number errNum
set AppleScript's text item delimiters to saveD
error errStr number errNum
end try
set AppleScript's text item delimiters to saveD
return (theList)
end texttolist
Message was edited by: Chipstix

I'm not sure what that script thinks it's doing, but it's essentially doing nothing, so scrub that and start afresh.
The first thing you need is a way to identify the tracks to change - you don't want to do all tracks in the library (they might have already been munged). A good option is to work on the selected tracks:
tell application "iTunes"
if selection is not {} then
set sel to selection
You then need to iterate through those items, changing them one-by-one:
repeat with aTrack in sel
Now comes the easy part - build a list of the elements you want (in this case you want the name, artist, and album of each track:
set trackName to name of aTrack
set trackArtist to artist of aTrack
set trackAlbum to album of aTrack
Now you have the information you need, so reset the fields as appropriate:
set name of aTrack to trackArtist & " - " & trackName
set artist of aTrack to trackAlbum -- or to trackArtist & " - " & trackName, depending on your choice
Now clean up by closing off the repeat and tell blocks:
end repeat
end tell
Putting it all together you get:
tell application "iTunes"
  if selection is not {} then
  set sel to selection
  repeat with aTrack in sel
    set trackName to name of aTrack
    set trackArtist to artist of aTrack
    set trackAlbum to album of aTrack
    set name of aTrack to trackArtist & " - " & trackName
    set artist of aTrack to trackAlbum -- or to trackArtist & " - " & trackName, depending on your choice
  end repeat
end tell

Similar Messages

  • Help with Simple Applescript for Midipipe

    Hey all, I'm in desperate need of help with some Applescript for use in a program called Midipipe:
    http://web.mac.com/nicowald/SubtleSoft/MidiPipe.html
    I simply require an Applescript for Midipipe that filters out all OFF notes except for the most recently pressed key, or most recently pressed ON note. So for example, when multiple keys have been pressed, only the most recently pressed key will send an OFF note. I hope that is clear enough, i've had some major issues trying to get this work and my last hope is to hit the forums and find some help .. I've posted on some of the audio forums and i'm hoping someone here knows how to code this.
    Thanks so much!! .. Its for an upcomming show next week so i'm hoping someone can get me in the right direction to solving this.
    -Jes

    I try to help, but you'll need to apply your brain cells to get it working with what I've already explained (three times with what I offer below).  Try something like the following (I am renaming your buttons to ch1,ch2,ch3,ch4,ch5,ch6 so that the same functions can be shared by all buttons...
    // this assigns listeners to all 6 buttons
    for(var i:uint=1; i<7; i++){
              this["ch"+String(i)].addEventListener(MouseEvent.CLICK, fl_ClickToSeekToCuePoint);
    // this processes any one of the 6 btns when they are clicked
    function fl_ClickToSeekToCuePoint_1(event:MouseEvent):void
        var btn = event.currentTarget;
        var cuePointInstance:Object = vid.findCuePoint(btn.name);
        vid.seek(cuePointInstance.time);
       resetButtons();    // this makes all buttons go back to normal
        btn.upState = btn.overState; // this makes the clicked button change states
    function resetButtons():void {
         for(var i:uint=1; i<7; i++){
              this["ch"+String(i)].upState =  this["ch"+String(i)].hitTestState;
    For this to work, your buttons need to have the same artwork in the hit frame as they do in the up frame.

  • Need help making a simple script for my webcam

    Hey everyone, fairly new to applescript programming. I just bought a usb camera for my macbook because I use it for video conferencing/playing around, and it is better quality than the built in isight. However, in order to use this camera I need to use drivers from a program called camTwist. This being said camTwist needs to be opened first and the usb camera must be selected from camTwist Step 1 list in order for any other application to use the camera. I just want to make a simple program that would open camTwist first, then select "webcam" from the list (double click it like I always have to in order to select it) in order to activate the driver, and then open photo booth which would then be using the camTwist driver in order to take pictures.
    I made a crude program but it does not automatically select "webcam" from the Step 1 list in camTwist:
    tell application "CamTwist" to activate
    delay 10
    tell application "Photo Booth" to activate
    that’s basically it. I set the delay to 10 seconds so that when camTwists boots up first I can manually select my webcam. HOWEVER, I would like to make a script that would boot up CamTwist first, select my webcam from the list automatically, and then open Photo Booth with the CamTwist webcam driver already selected.
    Don't know much about applescript so any help to make a working script to solve my problem would be greatly appreciated! Thanks!

    Solved my problem but now I need help with something else! First I used CamTwist user options to create user defined hot keys with the specific purpose to load the webcam. I chose Command+B. I tested it out in CamTwist and it worked. The program follows a logical order from there. First it loads CamTwist, then after a short delay it presses the hot keys in order to load the webcam from the video source list, then another short delay and Photo Booth is opened with the driver loaded from camTwist. Everything works Perfect! Here's the code:
    tell application "System Events"
    tell application "CamTwist" to activate
    delay 0.5
    --Press command+b which is a user defined hot key to load webcam
    key code 11 using command down
    end tell
    delay 0.5
    tell application "Photo Booth" to activate
    My Next question is, would it be possible with this same script to have both applications quit together. For example I always quit Photo Booth first, so when I quit photo booth is there a way to make CamTwist also quit and keep everything within the same script? Please let me know. This forum has been very helpful and lead me to a solution to my problem! Hoping I can solve this next problem as well! Thanks everyone.

  • Help to create simple Applescript

    Hi, hopefully somebody will be able to help me with a simple Applescript.
    I want to be able to drag a pdf file onto a desktop icon, enter a new filename into a dialogue box and for the file to be copied to a specific folder. It will only be pdf files, and I want it to automatically append the .pdf extension.
    Could sombody possibly point me in the right direction? Thanks in advance.

    Oops, forgot one more check. If a file exists with the same name as the original file, then it will error when you duplicate it. One way to solve that is to duplicate in place. Then "copy" is added to the name. You then move the file to the destination folder and probably there is no file with "copy" in its name.
    property folder_location : (path to desktop)
    property folder_name : "Files"
    on open these_items
    -- added check for main folder
    tell application "Finder"
    try
    set main_folder to (folder folder_name of folder_location) as alias
    on error
    set main_folder to (make new folder at folder_location with properties ¬
    {name:folder_name})
    end try
    end tell
    repeat with this_item in these_items
    set n to name of (info for this_item)
    if n ends with ".pdf" then
    set temp_prompt to "Enter a name for duplicate of " & n & ":"
    repeat
    display dialog temp_prompt default answer "name"
    set new_name to (text returned of result) & ".pdf"
    tell application "Finder"
    if not (exists file new_name of main_folder) then
    set the_duplicate to (duplicate this_item) as alias
    move the_duplicate to main_folder
    set name of the_duplicate to new_name
    exit repeat
    else -- inform user to enter a different name
    set temp_prompt to "Enter a different name. The name " & new_name & " is used."
    end if
    end tell
    end repeat
    end if
    end repeat
    end open
    Otherwise, What I usually do is create a empty temp folder for doing renaming, but then it gets more complicated. For now, just don't use "copy" in names.
    gl,

  • Help with Track / arrange & mixer relationship

    Sorry for a simple(ish) question.
    I have LP7, my friend has express (he's coming from a pro tools background, i'm from FCP background)
    This is a 2 part question.
    First, I have the Mac Pro video logic 101 videos, and have watched them almost through twice. They answer a few questions, but they are not very complete.
    1. We can't figure out the relationship between the tracks, channels and audio/inst tracks.
    We are unsure what happens when you make a new track. Sometimes I make a new track, change the name, and another track's name changes. I end up with two tracks the same.
    What is the track, channel, instrument relationship?
    2. Why doesn't the track / mix window do the same thing? I hit MUTE, or solo or whatever, on one, and it doesn't show up in the other (same track)
    If someone could tell me where to look in the manual, or a video to buy to explain that aspect of LP7, we'd be happy(er)
    Thanks for the help!
    Bryan

    The mute button in the arrange mutes that track. It stops the regions on that track being processed, and is not instantaneous, as it frees up resources. (Ie if no regions are active, no CPU is used in processing plugins etc - Logic simply stops processing them)
    The mute in the mixer mutes the channel so you can't hear it, but resources are not freed up - any plugins or audio is still being processed by the CPU. Muting is instantaeous.
    So:
    - arrange mute = "stops the stuff on that track being played/processed"
    - mixer mute = "stops that mixer channel being heard"
    You should think of arrange mutes as more of an arragement tool, as it helps determine which regions are going to be played, and the mixer mutes as a mixing tool.
    Think of the situation where you have 10 different vocal takes recorded to different tracks, all being sent to audio channel 1 where your vocal processing plugins live. Arrange mutes determine which of these 10 takes is active. Muting audio channel 1 in the mixer will mute the vocal, whichever track a given section is coming from.
    So, you should be able to see that muting an arrange track is a different function to muting a mixer channel.
    Does that help?

  • I need help with tracking

    Ok the video that you can see on my youtube is the one I need help with. The video is actually in 1080p and I have no idea why it is showing in such a low resolution, but that is not the problem. I need to track the gun and add a null to that track, after that I want to add a red solid layer and bring down its opacity a little, to simulate a laser sight from the gun.Then I tried to parent and SHIFT parent the red solid to the track, the end product would have to look like what you can see in the picture. I have watched a TON of videos about tracking and just can not the the result I need. the laser needs to follow the gun as I aim up and bring the gun down. How should I do this.......? Please someone help or link me a tutorial that will be helpful.....

    You have a couple of problems. First you don't need to use shift parent, just parent. Second, your red solid is a 3D layer and you have applied 2D tracking info to the solid. Actually, there's another mistake and it is in the tracking. You should also be tracking scale because the gun moves from left to right as well as up and down. This changes the distance between the front and back tracking points.
    My workflow with this project would be:
    Track Motion of the front and back of the gun including position, scale and rotation
    Apply the track info to a null called GunTrack or something like that
    Add a solid and apply the beam effect or mask the red solid to simulate the shape of a laser sight
    Change the blend mode of the solid to ADD
    Move the anchor point to the center of the starting point of the laser
    Parent the solid to the Gun Track null
    That should do it.

  • Need help with updating Name Server update for home webserver

    I set up a webserver at home to run my own domain/website. I am able to type my IP address into Safari/IE and get to my website fine. I now need to update the NameServer with the previous domain hosting service, but I have no idea how to find out the NameServer (Compast is my ISP) to put into the UPDATE NAME SERVERS form for the previous hosting company. I need to obviosly do this before people who type in my web address can be directed to my home server instead of the old hsoting company. The previous hosting server is ns.teammediaonline and ns1.teammediaonline.com. Do I use something like ns.comcast.net or something? I already have the IP address and know it works fine. Comcast does notchange the IP's too often and I will not have much traffic to my site, so I should not have any issues with them. I am sure this is a very simple issue. Any help would be greatly appreciated.

    Hi--
    You definitely do not want to contact Comcast. Servers are forbidden to their residential customers. If you contacted them, not only would they refuse to help, that might put you on a list to watch in case you do set one up. Now, if you're careful, don't server out a lot of traffic, and aren't a general nuisance to the people on your node, they most likely won't notice if you don't contact them.
    However, you'll need to look into a different DNS solution. Do a search for "Dynamic DNS" and you'll find a number of services that will be able to help you out. This one, DynDNS, has some reading material that might help to explain what you need to do...
    charlie

  • *Help* making a simple RPG for my AP CS class

    I am in desperate need of help, I am creating an RPG(of sorts, it is a purely a battle RPG in which characters level up and modify stats) there will be no storlyine (Yet) or adventure elements. I've reached a severe mental roadblock in the actual programming of the game but I have a very clear picture of exactly how the game runs. Here's how the game works, after starting a new game from the opening screen, the player begins with a simple battle against one monster. The player has four characters and each character starts with one basic attack. Battle continues in typical RPG style in which the player selects attacks, and then battle ensues in order based on the speed of each participant. At the end of each battle, all the characters level up once and the player can distribute a certain amount of stat points to each of the characters individual stats. The game continues like this for 40 levels with increasing difficulty, new attacks, and an upgrade to a new class at level 20. level 41 is a final boss fight against a typical RPG boss monster. Here is what i particularly have trouble on
    1. Determining how to create the attacks that the player can choose and figuring out how i can call upon them and have them do their damage based on certain specs
    2. Determining how to create an interactive interface that allows the player to choose the attack for each character, upgrade individual stats after each battle, and save (this will be a point and click menu system)
    3. Figuring how to create and input my own homemade graphics into the game (the book i have doesn't seem to cover putting in graphics that you create on your own, just the graphics that are part of the java package)
    Any help on this would be greatly appreciated becuase it is a major grade in my class

    Hello,
    I have been programming (in various languages) for years now. I also am in AP CS and I have been trying to think up a good game to make, i'm about 2 months ahead of my coursework in class and spend my time making and re-making various games during class.
    If i were to program this game i would go about the Attack issue by having a class called Attack (as was mentioned early). In it have the methods and variables and such for the attack, i would have a database or something along those lines of all the attacks (but for now start small with a basic one) and then each player could have one (or multiple - depending on whether or not they have an assortment of attacks) class attached to it (or if multiple perhaps an array or vector of classes). The attack class would contain basic information like the Name of the Attack, the Damage, Type, etc. And the class could even include methods which get the 'Level' of the player and calculate the damage multiplier or something along those lines.
    As far as choosing what to have the characters/players do i would (for yours and simplicity's sake) make a side menu which allows you to choose whatever attack, etc. you want. It's simple and easier to work with, just have a JPanel within the JFrame which controls the players, and it will control each player when it's their turn. This shouldn't be too difficult to do.
    The graphics part (you have already recieved some suggestions about), i prefer to use ImageIcons in my games. They're simple and easy to work with and are painted just as a circle or rectangle is. You just draw the images outside of the program and use them in the program through ImageIcons. If you have a good image-edittor (Photoshop, Flash even), you can make Animated Gifs which will add to the look and quality of the graphics of your program.
    The trick with big projects like this (and the goal of Object Oriented Programming) is to take a big problem (Like and Entire RPG Game -- The Program) and break it up into smaller problems and tackle each one, one at a time (divide the Program into an assortment of Classes).
    I wish you the best of luck, i myself am starting a small game (Something similar to Zelda i'm thinking), i'm still designing it on paper and I personally think if you design and organize everything on paper and make a checklist of sorts, things go much smoother and more organized (not to mention faster).

  • Please help with ENGLISH names for extd details

    Please can anyone with an ENGLISH OS (en-xx, Sub langID should all be the same ?? i guess) run the following lines and post the result.
    tab = Text.GetCharacter(9)
    tmpFile = File.GetTemporaryFilePath()
    allDetails = LDShell.AllDetails
    nDetails = Array.GetItemCount(allDetails)
    ' TextWindow.WriteLine(allDetails)
    'Goto End '
    For n = 1 To nDetails
    File.WriteLine(tmpFile, n, n-2 +tab+ allDetails[n-2])
    'File.WriteLine(tmpFile, n, allDetails[n-2])
    EndFor
    File.WriteLine(tmpFile, n+1, tab)
    File.WriteLine(tmpFile, n+2, "sum:" +tab+ nDetails)
    LDProcess.Start("notepad.exe", tmpFile)
    End:
    Needs LitDev extension and will return a long list like this one in german (Win7 SP1):
    -1    Infotip
    0    Name
    1    Größe
    2    Elementtyp
    3    Änderungsdatum
    4    Erstelldatum
    5    Letzter Zugriff
    6    Attribute
    7    Offlinestatus
    8    Offline verfügbar
    9    Erkannter Typ
    10    Besitzer
    11    Art
    12    Aufnahmedatum
    13    Mitwirkende Interpreten
    14    Album
    282    Datenrate
    283    Bildhöhe
    284    Einzelbildrate
    285    Bildbreite
    286    Gesamtbitrate
    I would need the ENGLISH (original) detail names for
    Win7 and up, if there are more then 286 (288) extended details available or other details on newer Win8, Win8SP1 and/or Win10.
    The only old overview in englsh i could find was on
    Get Extended File Properties (kixtart) and this is incomplete (or incorrect) too. Seems the latest there is from Win7 (noSP ??)
    The list is rather long ~300 lines, so if it's too long to post, maybe try an ID, an upload anywhere or pastebin.com.
    Thanks

    Windows 7 Professional SP 1
    -1 Infotip
    0 Name
    1 Size
    2 Item type
    3 Date modified
    4 Date created
    5 Date accessed
    6 Attributes
    7 Offline status
    8 Offline availability
    9 Perceived type
    10 Owner
    11 Kind
    12 Date taken
    13 Contributing artists
    14 Album
    15 Year
    16 Genre
    17 Conductors
    18 Tags
    19 Rating
    20 Authors
    21 Title
    22 Subject
    23 Categories
    24 Comments
    25 Copyright
    26 #
    27 Length
    28 Bit rate
    29 Protected
    30 Camera model
    31 Dimensions
    32 Camera maker
    33 Company
    34 File description
    35 Program name
    36 Duration
    37 Is online
    38 Is recurring
    39 Location
    40 Optional attendee addresses
    41 Optional attendees
    42 Organizer address
    43 Organizer name
    44 Reminder time
    45 Required attendee addresses
    46 Required attendees
    47 Resources
    48 Meeting status
    49 Free/busy status
    50 Total size
    51 Account name
    52 Task status
    53 Computer
    54 Anniversary
    55 Assistant's name
    56 Assistant's phone
    57 Birthday
    58 Business address
    59 Business city
    60 Business country/region
    61 Business P.O. box
    62 Business postal code
    63 Business state or province
    64 Business street
    65 Business fax
    66 Business home page
    67 Business phone
    68 Callback number
    69 Car phone
    70 Children
    71 Company main phone
    72 Department
    73 E-mail address
    74 E-mail2
    75 E-mail3
    76 E-mail list
    77 E-mail display name
    78 File as
    79 First name
    80 Full name
    81 Gender
    82 Given name
    83 Hobbies
    84 Home address
    85 Home city
    86 Home country/region
    87 Home P.O. box
    88 Home postal code
    89 Home state or province
    90 Home street
    91 Home fax
    92 Home phone
    93 IM addresses
    94 Initials
    95 Job title
    96 Label
    97 Last name
    98 Mailing address
    99 Middle name
    100 Cell phone
    101 Nickname
    102 Office location
    103 Other address
    104 Other city
    105 Other country/region
    106 Other P.O. box
    107 Other postal code
    108 Other state or province
    109 Other street
    110 Pager
    111 Personal title
    112 City
    113 Country/region
    114 P.O. box
    115 Postal code
    116 State or province
    117 Street
    118 Primary e-mail
    119 Primary phone
    120 Profession
    121 Spouse/Partner
    122 Suffix
    123 TTY/TTD phone
    124 Telex
    125 Webpage
    126 Content status
    127 Content type
    128 Date acquired
    129 Date archived
    130 Date completed
    131 Device category
    132 Connected
    133 Discovery method
    134 Friendly name
    135 Local computer
    136 Manufacturer
    137 Model
    138 Paired
    139 Classification
    140 Status
    141 Client ID
    142 Contributors
    143 Content created
    144 Last printed
    145 Date last saved
    146 Division
    147 Document ID
    148 Pages
    149 Slides
    150 Total editing time
    151 Word count
    152 Due date
    153 End date
    154 File count
    155 Filename
    156 File version
    157 Flag color
    158 Flag status
    159 Space free
    160 Bit depth
    161 Horizontal resolution
    162 Width
    163 Vertical resolution
    164 Height
    165 Importance
    166 Is attachment
    167 Is deleted
    168 Encryption status
    169 Has flag
    170 Is completed
    171 Incomplete
    172 Read status
    173 Shared
    174 Creators
    175 Date
    176 Folder name
    177 Folder path
    178 Folder
    179 Participants
    180 Path
    181 By location
    182 Type
    183 Contact names
    184 Entry type
    185 Language
    186 Date visited
    187 Description
    188 Link status
    189 Link target
    190 URL
    191 Media created
    192 Date released
    193 Encoded by
    194 Producers
    195 Publisher
    196 Subtitle
    197 User web URL
    198 Writers
    199 Attachments
    200 Bcc addresses
    201 Bcc
    202 Cc addresses
    203 Cc
    204 Conversation ID
    205 Date received
    206 Date sent
    207 From addresses
    208 From
    209 Has attachments
    210 Sender address
    211 Sender name
    212 Store
    213 To addresses
    214 To do title
    215 To
    216 Mileage
    217 Album artist
    218 Album ID
    219 Beats-per-minute
    220 Composers
    221 Initial key
    222 Part of a compilation
    223 Mood
    224 Part of set
    225 Period
    226 Color
    227 Parental rating
    228 Parental rating reason
    229 Space used
    230 EXIF version
    231 Event
    232 Exposure bias
    233 Exposure program
    234 Exposure time
    235 F-stop
    236 Flash mode
    237 Focal length
    238 35mm focal length
    239 ISO speed
    240 Lens maker
    241 Lens model
    242 Light source
    243 Max aperture
    244 Metering mode
    245 Orientation
    246 People
    247 Program mode
    248 Saturation
    249 Subject distance
    250 White balance
    251 Priority
    252 Project
    253 Channel number
    254 Episode name
    255 Closed captioning
    256 Rerun
    257 SAP
    258 Broadcast date
    259 Program description
    260 Recording time
    261 Station call sign
    262 Station name
    263 Summary
    264 Snippets
    265 Auto summary
    266 Search ranking
    267 Sensitivity
    268 Shared with
    269 Sharing status
    270 Product name
    271 Product version
    272 Support link
    273 Source
    274 Start date
    275 Billing information
    276 Complete
    277 Task owner
    278 Total file size
    279 Legal trademarks
    280 Video compression
    281 Directors
    282 Data rate
    283 Frame height
    284 Frame rate
    285 Frame width
    286 Total bitrate
    sum: 288

  • Help me! - Simple Applescript to make a word doc center all contents

    Hello!
    I am working on a small applescript which I will be using in Automator, however I can't for the life of me figure out how to script in telling the word doc to automatically center everything (text and images).
    I have the following applescript which sets up the word doc in the margins and orientation I need, but now I just need to figure out how to center the contents.
        tell application "Microsoft Word"
                        set orientation of page setup of section 1 of active document to orient landscape
                        set pmRpt to page setup of active document
                        set left margin of pmRpt to (inches to points inches 0.85)
                        set right margin of pmRpt to (inches to points inches 0.95)
                        set top margin of pmRpt to (inches to points inches 1.5)
                        set bottom margin of pmRpt to (inches to points inches 1)
              end tell
    Can anyone help me?
    Thanks!!!

    Hi,
    Like this :
    set alignment of paragraphs of active document to align paragraph center

  • Help required on simple validations for Flex Numeric Stepper

    Friends,
    I need a small help in Flex Numeric Stepper validation.
    I have setted a min value to 1 and max value to 10, Now my requirement  is when ever user can enter a value other than the range between 1 - 10,  i want to display an alert saying "please enter the val's between 1 and  10". I want this scenario to be success in all possible event listeners  like Keyboardevents/mouseevents/default numeric stepper events.  Actually i am failing to produce an alert if i typed the value as "0".  Other than this everything is fine.
    i am attaching the code as well for reference. i need solution asap.
    your help will be appreciated.
    Rajesh
    private var nsTextInput:Number;
    private var nsTextInputOld:Number;
    private var ns:NumericStepper = new NumericStepper();
    ns.minimum = 1;
    ns.maximum = 10;
    ns.addEventListener(FlexEvent.CREATION_COMPLETE, creationCompleteNs);               
    ns.addEventListener(Event.CHANGE,creationCompleteNs);
    addChild(ns);
    private function creationCompleteNs(event:FlexEvent):void{
        var textInput:TextInput = event.currentTarget.getChildAt(0) as TextInput;
        textInput.addEventListener(KeyboardEvent.KEY_UP, keyUPTextInput);
        textInput.addEventListener(FocusEvent.FOCUS_OUT, focusOutTextInput);
        textInput.addEventListener(FocusEvent.FOCUS_IN, focusInTextInput);
                private function keyUPTextInput(event:KeyboardEvent):void
                    nsTextInput = event.target.text;
                private function focusInTextInput(event:FocusEvent):void
                    nsTextInputOld = event.target.text;
                private function focusOutTextInput(event:FocusEvent):void
                    if((nsTextInput<ns.minimum || nsTextInput>ns.maximum) && nsTextInput){
                        Alert.show("Please provide values from "+ns.minimum+" to "+ns.maximum+".","Alert!");
                        event.target.value = nsTextInputOld;
                    nsTextInput = null;

    you may want to take a look at Flex's validator classes
    http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/mx/validators/NumberVal idator.html

  • Help with finding name for query type

    Hi,
    A number of years ago I remember at a SQL course coming across a query that had output that looked something like this;
    header_1     header_2
    value 1        value 2
    col_1        col_2       col_3
    value_a     value b     value c
    value_b     value c     value dIm pretty sure its based on a group by query. Would anybody be able to point me in the right direction to find more information for a query that would output in SQL Plus that is a very basic form of a report with header information. Or give me the name of this sort of query so that I can google it?
    Benton
    Found it Heirarchy Query
    Found this as well http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:556385200346423686
    Edited by: Benton on Aug 12, 2011 1:21 PM
    Edited by: Benton on Aug 12, 2011 1:36 PM

    Trooper wrote:
    is there any fuction like nearby, cant use betweenThe MIN aggregate function perhaps?
    select   min(g.grade) from comqdhb.gradevalues@glink g ...Regards,
    Rob.

  • JTable - Help with column names and rowselection

    Hi,
    Is there anyone that can help me. I have successfully been able to load a JTable from an MS access database using vectors. I am now trying to find out how to hardcode the column names into the JTable as a string.
    Can anyone please also show me some code on how to be able update a value in a cell (from ''N'' to ''Y'') by double clicking on that row.
    How can I make all the other columns non-editable.
    Here is my code:
         private JTable getJTable() {
              Vector columnNames = new Vector();
    Vector data = new Vector();
    try
    // Connect to the Database
    String driver = "sun.jdbc.odbc.JdbcOdbcDriver";
    // String url = "jdbc:odbc:Teenergy"; // if using ODBC Data Source name
    String url = "jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)};DBQ=C:/Documents " +
              "and Settings/Administrator/My Documents/mdbTEST.mdb";
    String userid = "";
    String password = "";
    Class.forName( driver );
    Connection connection = DriverManager.getConnection( url, userid, password );
    // Read data from a table
    String sql = "select * from PurchaseOrderView";
    Statement stmt = connection.createStatement();
    ResultSet rs = stmt.executeQuery( sql );
    ResultSetMetaData md = rs.getMetaData();
    int columns = md.getColumnCount();
    // Get column names
    for (int i = 1; i <= columns; i++)
    columnNames.addElement( md.getColumnName(i) );
    // Get row data
    while (rs.next())
    Vector row = new Vector(columns);
    for (int i = 1; i <= columns; i++)
    row.addElement( rs.getObject(i) );
    data.addElement( row );
    rs.close();
    stmt.close();
    catch(Exception e)
    System.out.println( e );
              if (jTable == null) {
                   jTable = new JTable(data, columnNames);
                   jTable.setAutoCreateColumnsFromModel(false);
                   jTable.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_NEXT_COLUMN);
                   jTable.setShowHorizontalLines(false);
                   jTable.setGridColor(java.awt.SystemColor.control);
                   jTable.setRowSelectionAllowed(true);
                   jTable.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
                   jTable.setShowGrid(true);     
              return jTable;
         }

    this method has a default behavior to supply exactly what you're seeing: column names consisting of the capitalized letters, "A", "B", "C".Thanks Pete, had seen that but never really thought about it... about 10 days ago somebody needed to obtain Excel column names, I'd offered a rigorous solution and now see it would have been shorter and simpler (if a little heavier) to extend DefaultTableModel and provide the two additional methods needed (getOffsetCol and getColIndex).
    Not much of a difference in LOC but certainly more elegant ;-)
    Darryl

  • Help with tracking. Point or Planar???

    I am making a short action sequence for fun and am having extreme difficulty tracking some of the explosions and blood splatter effects in the short.  The main blood splatter I tracked with a point tracker in AECS4 and it's extremely shacky and you can cleary see how fake it is.  So then I looked into it and realized planar tracking with Mocha existed and I can't seem to figure out how to make it work.  This is a link of a RAM preview of what I have with the point tracker. Am I even close to being on the right track? SOMEONE HELP PLEASE!
    http://vimeo.com/21179009

    > I looked into it and realized planar tracking with Mocha existed and I can't seem to figure out how to make it work.
    There are lots of tutorials for using mocha. Start here.

  • Help with tracking my phone

    My iPhone 4s was stolen from me today in the post offfice. I dont have the find my phone ap as I dont go out that often being disabled. I noticed it was missing within 5 minutes and called it from a shop phone, It went to voicemail. EE blocked it for me and I do have a 4 digit passcode on it. I have the latest version of ios7 as someone said this may help.
    All my family photo's are on there including ones of my recently deceased grandad which im deverstated about.
    My mac book pro seems to think it knows my phone as I've tried the find my phone app on it but it says its offline. Is there anyway I can trace it?

    The Find My iPhone app has nothing to do with this. The Find My iPhone app can be used by you to locate another iOS device you own or your Mac using your iPhone, or someone else that lost their iPhone or iOS device can use the app on your iPhone to locate their iPhone or iOS device.
    Having Find My iPhone enabled with your iCloud account settings on the iPhone determines if you can locate your iPhone with Find My iPhone with the app on another iOS device or by logging in with your iCloud account with a browser on your computer.
    If the iPhone is powered off, it can't be located with Find My iPhone.

Maybe you are looking for

  • Why isn't the iMessage working on my 4S?

    My phone recently is not working very well. It keeps on freezing, turning off and randomly restarting by itself. Today morning I tried to message one of my friends and my imessage was not working at all and until now it ceases to work. I dont know wh

  • Expressions and sliders

    Hi all Having trouble trying to stop my wiggle expression so I thought I would use a slider to control it. The wiggle is applied to position but I haven't actually given it any key frames. Basically my problem is that when ever I use the pick whip wi

  • Pcard Statement Processing

    We currently have PCard processing implemented on BBPCRM 4.0.  We are moving to SRM on 5.5 Server.  The present processing of PCard statement is quite cumbersome and we would like to evaluate different options.  Current process… - Manually access PCa

  • PLEASE HELP DEADLINE PHOTOS OLD LAPTOP CRASHED WITH PROPER SOFTWARE ON IT :(

    i need help i installed the CC trial so i can do my photos quickly, however after opening it and clicking on continue trial it then crashed the internet and my software, told me to uninstall then reinstall product but as i am under cloud it says its

  • Doesn't gcc come by default with Solaris 10?

    I am newly exposed to Solaris 10 in connection to my office assignment. To my utter surprise, I couldn't find any gcc installed. Presently I have got around the situation by installing a pre-compiled binary from [http://sunfreeware.com] The system I