Help with Applescript

Hi there, thanks in advance for any help on this ...
I have an excel spreadsheet export from our back-office that exports product information from our shop. I want this to be reformatted slightly using AppleScript
An example of our workbook is as follows
A1     B1     C1     D1     E1     F1     G1     H1     I1
                                                               text   text
So essentially columns A1 to G1 are blank.
What I would like is Applescript to add a row to the top of this workbook and pre-fill each column with a column heading. These are always the same regardless.
Then I would like Applescript to pre-fill each blank row with pre-set information. For example (now) A2 until the last row would read "New". Each one of the blank columns has different data but its always text, never a formula. Ideally it should only fill the rows where H1 contains text, so it does not continue filling those empty columns with data when the rest of the sheet is blank.
Then (if possible) it should save this as a comma delimited CSV.
I know this is pretty harsh, but it would save me hours and hours and work.
Thanks!

applescript forum is under OS X technologies.
http://discussions.apple.com/forum.jspa?forumID=724
btw, was it you I had a long thread with about moving pictures around using applescript? I lost track of that...

Similar Messages

  • Help with applescript to quit certain processes by name?

    Hey, for anyone who knows how to program applescripts well, I could use some help with the script below.
    I'm very new to applescripting and I'm trying to write a script that would automatically quit up to 100 instances of the Google Chrome Renderer process.
    Thanks to google, I found a script similar to what I wanted, and after some tinkering I thought I had it just right. The thing is, if I only set the app_name to Google Chrome, it quits Chrome just fine, but when I try it like this, it doesn't receive any data from grep or awk.
    If anyone can help I'd really appreciate it.
    repeat 100 times
              set app_name to "Google Chrome Renderer"
              set the_pid to (do shell script "ps ax | grep " & (quoted form of app_name) & " | grep -v grep | awk '{print $1}'")
              set new_pid to first word of the_pid
              try
                        if new_pid is not "0" or "1" then do shell script ("kill -9 " & new_pid)
              end try
    end repeat

    try this:
    tell application "System Events"
              set procs to (every process whose name is "Google Chrome Renderer")
              if (count of procs) > 100 then
                        set max to 100
              else
                        set max to count of procs
              end if
              repeat with i from 1 to max
                        tell (item i of procs) to quit
              end repeat
    end tell

  • Help with Applescript - filenames

    Hi!
    I hope there is someone who can help me. I have very little experience with Applescript, and have spent a couple of days scouring these forums amongst others without any luck...
    I have a folder (titled XLS) with about 1000 excel files in it. They are numbered basen on some parametric calculations (1111.xls, 1112.xls, 1113.xls, etc). I have constructed an Automator rutine which, one at a time, can open each excel file, copy some cells and then paste the data into an empty xml-file in TextWrangler. The empty xml-file is also in the XLS folder.
    What I am looking for is an applescript which can rename the open xml-file with the same filename as the xls-file. So, when 1111.xls is open, the xml-file gets renamed 1111-xml; when 1112.xls is open, the xml-file gets renamed 1112-xml, etc. Each new xlm-file is to be saved into a folder XLM, whivh is also in the XLS folder.
    Thanks in advance....
    Rob

    Se below; there are two folders on the desktop; "xls" (with xls-files in) and "xml", as well as the empty Template.xml file. Here it is!:
      --3 XLS to XML
              tell application "Finder"
                        set fileList to every file of entire contents of ("YourHD:Users:You:Desktop:xls" as alias)
              end tell
              repeat with i from 1 to number of items in fileList
                        set currentFile to (item i of fileList)
                        tell application "Microsoft Excel"
                                  set screen updating to false
      open currentFile
      activate currentFile
      activate object worksheet 1
                                  copy range range ("YourRange")
                        end tell
                        tell application "Finder"
                                  copy file "YourHD:Users:You:Desktop:Template.xml" to folder "YourHD:Users:You:Desktop:xml"
                        end tell
                        tell application "Microsoft Excel"
                                  set docName to name of window 1
                        end tell
                        tell application "Finder"
                                  set docName2 to text 1 thru ((offset of "." in docName) - 1) of docName
                                  set theFile to "YourHD:Users:You:Desktop:xml:Template.xml" as alias
                                  set the name of theFile to docName2 & ".xml"
      open file theFile
                        end tell
                        tell application "TextWrangler"
      activate
      paste
      close text document 1 saving yes
                        end tell
                        tell application "Microsoft Excel"
      activate
      close active workbook saving no
                        end tell
              end repeat
              tell application "Microsoft Excel"
                        set screen updating to true
      quit
              end tell
              tell application "TextWrangler"
      quit
              end tell

  • Help with Applescript and Admin Privelages

    I just started using Applestript a few months ago and I can't figure out how to give my script Admin rights. Basically, it turns on and off my internet sharing and file sharing through dialog boxes. I copied and pasted the whole code below if you want to test it, but this is the part that is giving me trouble. There are 4 lines similar to this, the actions that turn on or off the services.
    do shell script "/bin/launchctl load -w /System/Library/LaunchDaemons/com.apple.InternetSharing.plist" with administrator privileges
    I've tried adding "with password _____" and "password_____" but neither worked. Can anyone help me make this script authenticate itself so I don't need to keep typine in my password? I could easily make a keystroke in system events to type it in but it doesn't always ask for it so I don't know how I'd make the script know when it needs to enter the password. any help is much appreciated!
    Some things to clarify: The first shell script is there to invoke the "authentication" dialog so I can sign in once I launch the app and get right into the settings. However, I'd like to make it so the script doesn't even need admin permission to run, or make it somehow have my password built in to it. Security is not an issue, its my personal computer that nobody else has access to so I really don't care if my password is written in the code. Also, if you have any tips on how to streamline the Quit/Hide/Resume dialog I'd appreciate that too. Resume is there because there's a chance I won't have to sign in again if the app does not quit, however more often than not I have to sign in anyways. Thanks again in advance, sorry this post is so long but like I said, I'm pretty new to all this so I don't know exactly what you need to be able to help me.
    The Whole Script:
    -- Variables and Authentication
    set done to "n"
    set quitapp to "no"
    display dialog "Please enter your password to allow Sharing Manager to make changes to your settings." with icon caution
    do shell script "/bin/launchctl unload -w /System/Library/LaunchDaemons/com.apple.AppleFileServer.plist" with administrator privileges
    delay 0.2
    -- Repeats
    repeat while quitapp is "no"
              repeat while done is "n"
      -- Choose Setting
                        display dialog "Choose Setting to Edit" buttons {"Internet", "File Sharing", "Exit"} default button 3
                        set the button_pressed to the button returned of the result
                        if the button_pressed is "Internet" then
      -- Commands for Internet Settings
                                  display dialog "Internet Sharing" buttons {"On", "Off", "Cancel"} default button 3
                                  set the button_pressed to the button returned of the result
                                  if the button_pressed is "On" then
                                            do shell script "/bin/launchctl load -w /System/Library/LaunchDaemons/com.apple.InternetSharing.plist" with administrator privileges
                                  else if the button_pressed is "Off" then
                                            do shell script "/bin/launchctl unload -w /System/Library/LaunchDaemons/com.apple.InternetSharing.plist" with administrator privileges
                                  end if
                        else if the button_pressed is "File Sharing" then
      -- Commands for Sharing Settings
                                  display dialog "File Sharing" buttons {"On", "Off", "Cancel"} default button 3
                                  set the button_pressed to the button returned of the result
                                  if the button_pressed is "On" then
                                            do shell script "/bin/launchctl load -w /System/Library/LaunchDaemons/com.apple.AppleFileServer.plist" with administrator privileges
                                  else if the button_pressed is "Off" then
                                            do shell script "/bin/launchctl unload -w /System/Library/LaunchDaemons/com.apple.AppleFileServer.plist" with administrator privileges
                                  end if
                        else
                                  set done to ""
                        end if
              end repeat
      -- Confirm Quit/Hide
              display dialog "Really quit? You will have to reenter admin info next time." buttons {"Quit", "Hide", "Resume"} default button 1
              if the button returned of the result is "Quit" then
                        set quitapp to ""
              else if the button returned of the result is "Hide" then
                        tell application "System Events"
      keystroke "h" using command down
                        end tell
              else
                        set done to "n"
                        set quitapp to "no"
              end if
    end repeat

    with respect to general improvements, a couple of points:
    If I'm reading this script correctly, it looks like you're putting up an applescript alert and leaving it hanging until it's dismissed.  This is an atypical approach (applescripts aren't really meant to hang around indefinitely waiting for a respons).  If I were doing this I would either go whole-hog and create an applescript application in XCode with a proper interface, or remove the hanging dialog and create a set of toggle scripts that I could use from the script menu.  if you really want to keep the hanging dialog, though, you can streamline it by absorbing the secondary dialogs into the main dialog.  that's like so:
    set netSharingStatus to checkService("com.apple.InternetSharing")
    set fileSharingStatus to checkService("com.apple.AppleFileServer")
    display alert "Current Settings" message "Click to change settings" buttons {"Internet " & netSharingStatus, "File Sharing " & fileSharingStatus, "Exit"} default button 3
    -- choose next action based on the button clicked and the status vairable
    on checkService(service)
              do shell script "launchctl list"
              if the result contains service then
                        return "On"
              else
                        return "Off"
              end if
    end checkService
    using handlers like the above can also streamline the rest of your script.  the following construction means you only have to write the do shell script line once, rather than the four times you currently do, and makes for much cleaner reading.
    if the button_pressed starts with "Internet" then
              toggleService("com.apple.InternetSharing", netSharingStatus)
    else if the button_pressed starts with "File Sharing" then
              toggleService("com.apple.AppleFileServer", fileSharingStatus)
    else
      --exit routine
    end if
    on toggleService(service, currentState)
              if currentState in "On" then
                        set action to "unload"
              else
                        set action to "load"
              end if
              set command to "/bin/launchctl " & action & " -w /System/Library/LaunchDaemons/" & service & ".plist"
              do shell script command user name "adminusername" password "password" with administrator privileges
    end toggleService

  • Help with applescript...newbie...no idea what I'm doing...

    Apple Script: I got this applescript off of a forum for RapidCart for Rapidweaver.  It allows the user to upload multiple thumbnails to each e-commerce page with the code...I don't know how to make this work for my files tho...can anyone help...this is what the person said to put into applescript and then run it...please help...
    display dialog "Item número" default answer "" buttons {"OK"} default button 1
    set numitem to text returned of the result
    display dialog "Número de fotos" default answer "2" buttons {"OK"} default button 1
    set contador to text returned of the result
    tell application "TextEdit"
        activate
        make new document
        repeat with counter from 1 to contador
            if counter = 1 then
                make new word at end of text of document 1 with data "<a href=%resource(Labe/L" & numitem & ".jpg)% rel=\"remooz\" title=\"Ref. L" & numitem & " foto " & counter & "\"><img class=\"imageStyle\" alt=\"\" src=%resource(Labe/L" & numitem & ".jpg)% width=\"40\" height=\"40\"></a>" & return
            else
                make new word at end of text of document 1 with data "<a href=%resource(Labe/L" & numitem & "_0" & counter & ".jpg)% rel=\"remooz\" title=\"Ref. L" & numitem & " foto " & counter & "\"><img class=\"imageStyle\" alt=\"\" src=%resource(Labe/L" & numitem & "_0" & counter & ".jpg)% width=\"40\" height=\"40\"></a>" & return
            end if
            set counter to counter + 1
        end repeat
    end tell

    First of all, I know nothing about RapidCart, RapidWeaver
    I've cut and pasted the script into the Applescript editor, compiled it and ran it
    the first dialog prompts for "Item number" - so I typed "5"
    the second dialog prompts for "Number of Photos" - so I typed "2"
    Here's the output
    <a href=%resource(Labe/L5.jpg)% rel="remooz" title="Ref. L5 foto 1"><img class="imageStyle" alt="" src=%resource(Labe/L5.jpg)% width="40" height="40"></a>
    <a href=%resource(Labe/L5_02.jpg)% rel="remooz" title="Ref. L5 foto 2"><img class="imageStyle" alt="" src=%resource(Labe/L5_02.jpg)% width="40" height="40"></a>
    the generated HTML is meaningful to RapidCart.
    Now, the author should have explained that this script is specific to his needs and MUST be customized for your use.
    I don't know how familiar you are with HTML but the "resource" tag refers to a file - a jpg file in this case.

  • Help with AppleScript for Numbers - please!

    I posted a question on the AppleScript section, if anyone can help...
    https://discussions.apple.com/thread/3451760
    Thanks!
    (I'm trying to get an array into what I know of in Excel as a "range". How can this be done with numbers?)

    Does this help?  This would work if tagValues in your script is a single value.
    tell application "Numbers" to tell document 1 to tell sheet 1 to tell table 1
              set selection range to range "B2:D5"
              set tagvalues to 1
              set value of cell in selection range to tagvalues
    end tell
    If tagValues is a list, you may have to set each cell separately, indexing through each value in tagValues.

  • Help with AppleScript/ Automator Code

    I am an intern at an architecture firm, and I would like to know if there is any way to code a program (using AppleScript or Automator) to complete this task:
    Combine files that have similar file names into a folder and rename the file as the first file automatically. There are hundreds of files, and an expedient and efficient way of completing this task would be greatly appreciated.
    For example:
    I have files:
    07-480-1.jpg
    07-480-2.jpg
    07-480-3.jpg
    07-480-4.jpg
    07-481-1.jpg
    07-481-2.jpg
    07-481-3.jpg
    07-481-4.jpg
    07-481-5.jpg
    I want to select files names with similar characters (07-480 and 07-481) and place them into respective folders.
    So the folders would be called
    07-480-1
    07-481-1
    Any advice would be helpful.
    Thank You!
    OSX 10.9.5

    Almost anything is possible... the issue is the work-effort required to achieve the desired result.
    In this case there are a lot of variables that you haven't covered, which may make the job easier or harder.
    For example, you give a series of example file names, and appear to want to group them by the same initial 6 characters (although your example seems to create folder names based on the first 8 characters of the first match... is that true? Without knowing the background, I would expect '07-480-1.jpg' to go into the  '07-480' folder, not the '07-481-1' folder). Those kinds of details will make a difference.
    So if my theory is correct ('07-480' should be the folder name), do you want to create a folder every time? or only when there are two or more files (e.g. do you want an '07-490' folder when there's only one relevant file?
    Here's a starting point. I'm assuming that you want the '07-480' form of the folder. When the script runs it will ask for the folder to check, then (blindly) iterate through the files in that folder, moving them into folders based on the first 6 characters of the file name, making new folders as needed:
    tell application "Finder"
      set theFolder to (choose folder)
      repeat with eachfile in (get files of theFolder)
      -- assume the standard filename format
      -- may need error checking here to make sure the name matches what we expect
      -- for now we just skip over any errors through the use of a try statement
      try
      -- get the first 6 characters of the file name
      set basename to characters 1 through 6 of (get name of eachfile) as text
      -- check if we already have a folder of the desired name
      if (not (exists folder basename of theFolder)) then
      -- we don't, so make one
      make new folder at theFolder with properties {name:basename}
      end if
      -- now move the file into the folder
      move eachfile to folder basename of theFolder
      end try
      end repeat
    end tell

  • Hi i need help with applescript to stop downloads when vpn fails

    I am an apple script novice, I would like to be able to have a script run all the time to detect vpn failures and close transmission when this happens:
    so far:
    on idle
              do shell script "ifconfig -lu"
              if "ifconfig -lu" contains "tun0" then
              else if "ifconfig -lu" does not contain "tun0" then
                        tell application "System Events"
                                  tell application "Transmission"
                                            quit
                                  end tell
                        end tell
              end if
    end idle
    it closes transmission and nothing else.  tun0 is my vpn interface and seemed the most fireproof way of understanding the state of the vpn connect.  When VPN is down tun0 doesnt exist.  Please help.
    many thanks

    There are several things wrong with your script.
    First, the glaring one:
              if "ifconfig -lu" contains "tun0" then
    This will never, ever, ever be true. What you're asking AppleScript is whether the string "ifconfig -lu" contains the string "tun0". Never going to happen. Not even close.
    What you really mean is whether the output of the shell command 'ifconfig -lu' contains 'tun0'. The easiest way to do that is to capture the output of the do shell script command in a variable and then test the variable, not the literal string:
    set activeInterfaces to do shell script "ifconfig -lu"
    if activeInterfaces does not contain "tun0" then
      -- stuff goes here
    end if
    Now AppleScript runs the shell script and puts the result in activeInterfaces which you then test to see if it contains (or, in this case, does not contain) the string you're looking for.
    Note that I've also reworked your if statement.. there's no need to have an empty 'if' clause followed by an else if that checks the opposite... by definition if the first one fails the second one will be true.
    Also note that there's no need to tell System Events to tell another application to quit - you can just do that directly.
    Next up is that you don't exit your own script after you quit Transmission. So now you have the scenario where the VPN drops, your script detects it and tells transmission to quit. However, your script keeps running so it then rechecks whether the tunnel is up... since it presumably isn't, it then relaunches Transmission in order to tell it to quit again. Then it rechecks whether the tunnel is up, if it isn't, it relaunches Transmission to tell it to quit... then it rechecks... you get the idea.
    Ideally you should tell your own script to quit after Transmission has exited so that you're not stuck in this loop.
    Lastly you don't include a return value in your idle handler. This means that your idle handler will run every 30 seconds. That might be good enough, or you might want to check more or less frequently. Just return a value indicating the number of seconds to pause between iterations -  realise that the more frequently you check, of course, the more load you put on your system
    Adding that all up you'll end up with something like:
    on idle
              set activeInterfaces to do shell script "ifconfig -lu"
              if activeInterfaces does not contain "tun0" then
                        tell application "Transmission" to quit
                        tell me to quit
              end if
              return 30 -- 30 is default value, but it doesn't hurt to include it here
    end idle

  • Help with AppleScript for outlook 2011

    I wonder if anyone can help me with what I think should be a simply script.
    I simply want to sweep(move) all of my incoming mail in Outlook to a specified IMAP folder.
    Is this possible - it seems like it should be an easy script - if you get me started with the outline (for select all in incoming box and the move to an imap folder command) I think I can sort it.
    Many thanks!
    Gordon    

    I wrote a script to perform email-merges using Outlook or Mail/Address Book: https://github.com/craibuc/applescript-email-merge.  Perhaps you will find it useful.

  • Help with Applescript: very basic functions

    Hi guys, my first post. I'd very much like to switch from Excel to Numbers but not until I find an Applescript replacement for my stuff.
    I wrote basic Excel Applescript just fine but I'm tearing my hair out just to perform simple scripts in Numbers!!!
    Basically I need to do:
    PART 1: Import External Data
    - I think I got this covered, using a GUI copy script via the "System Events" application
    - but since you guys are the experts: how do I make this process 'invisible'? i.e. each time the script runs, a Safari window appears. I don't want that to happen.
    tell application "Safari"
    activate
    open location "http://www.whatever.htm"
    end tell
    tell application "System Events"
    tell process "Safari"
    keystroke "a" using command down
    keystroke "c" using command down
    end tell
    end tell
    PART 2: Paste It Into Numbers
    - How hard can it be, right? Apparently I have the mental IQ of Gump I need Numbers to:
    - clear data from an existing pre-defined/named table
    - paste the data (from clipboard) onto this table (paste starting on cell A1), using the "Paste and Match Style" function
    - hide certain columns <-- I realize if Numbers paste onto a table with hidden columns, it treats them as non-existent i.e. won't paste the same. Therefore I suppose before the paste script I'd need an unhide script
    ... and that's it!!
    Help please I really hate Excel but can't move on till I figure this out... it's crucial to my livelihood.
    Thank you all in advance!

    There is no paste function in the Numbers AppleScript's dictionary.
    We may mimic it as I did during one year and a half with Numbers '08.
    Go to my iDisk:
    <http://idisk.me.com/koenigyvan-Public?view=web>
    open the folder "For_iWork:iWork '08:for_Numbers:"
    and download one of the items whose name starts with "paste".
    This use of GUI scripting is interesting because it creates automatically rows/columns when required.
    One draw back is the resulting font.
    Yvan KOENIG (from FRANCE samedi 17 janvier 2009 21:12:52)

  • Help with applescript/workflow/rule that would unflag mail when read (...)

    Here's my scenario:
    I have quite many mail.app rules that automatically filter and file incoming mails from newsletters, SNS, work, friends etc. and they all go in specific mailboxes (200+)
    I also have some rules that I trigger using MailActOn.
    Since with Lion theres now 6 different flags (and that you can rename them) I've included them in the rules actions and set them up to the following categories:
    - To Do
    - To Do Later
    - To File
    - News
    - Personal
    This actually allows me to have these smart mailboxes to appear only when they are flags active.
    Now for the first three I want to keep the flags permanently until I'm actully done with them.
    But for the "news" and "personal" ones I want to have them "unflag" once I read them.
    So to recap, is there a way to systematicall/periodically unflag messages when they are read from specific mailboxes or if they are flagged with a particular flag?
    I'd really appreciate if someone would help me out figure out an adequate solution to what I'd like to achieve.
    I'm not sure if a kind of a combination of either applescript/workflow/rule would actually make it work...

    Here's my scenario:
    I have quite many mail.app rules that automatically filter and file incoming mails from newsletters, SNS, work, friends etc. and they all go in specific mailboxes (200+)
    I also have some rules that I trigger using MailActOn.
    Since with Lion theres now 6 different flags (and that you can rename them) I've included them in the rules actions and set them up to the following categories:
    - To Do
    - To Do Later
    - To File
    - News
    - Personal
    This actually allows me to have these smart mailboxes to appear only when they are flags active.
    Now for the first three I want to keep the flags permanently until I'm actully done with them.
    But for the "news" and "personal" ones I want to have them "unflag" once I read them.
    So to recap, is there a way to systematicall/periodically unflag messages when they are read from specific mailboxes or if they are flagged with a particular flag?
    I'd really appreciate if someone would help me out figure out an adequate solution to what I'd like to achieve.
    I'm not sure if a kind of a combination of either applescript/workflow/rule would actually make it work...

  • Help with AppleScript as Export Action

    I've been trying to get an AppleScript working as an Export Action in Lightroom 3 on OS X (10.5) without success.
    The script (modified from one I found):
    on open theObjects
        repeat with theObject in theObjects
            do shell script "/opt/local/bin/mogrify -colorspace Gray " & "'" & (POSIX path of theObject as string) & "'"
        end repeat
    end open
    I've also tried it as:
    do shell script "/opt/local/bin/mogrify -colorspace Gray " & (POSIX path of theObject as string)
    I've also tried some simpler things just to check if the script is getting called at all, and it doesn't appear to be.  Is there something special I need to do to use an AppleScript as an Export Action?  It's in the correct folder, and the script name comes up as a selection in the drop-down menu when using a custom Post-Processing option.
    Any help or insights appreciated!

    banacheq wrote:
    ... It didn't even occur to me to look in "File Format" for converting a script to an application.
    Apple sometimes makes things "too" easy. Its like trying to find the salt shaker when its right by your plate...
    (I had done it before but had forgotten how)
    Glad you got it working.
    Rob

  • Help with applescript to unmount disk when putting laptop to sleep

    Could some kind soul please help me a bit with some applescript?
    I would need two things in applescript:
    1. A way to check whether a certain external (firewire) disk is mounted
    (so that I can unount, er, eject it, if it is there)
    2. A way to make an applescript being executed whenever the laptop goes to sleep.
    For the interested reader:
    what I want to do is to write an applescript that would automatically unmount my external backup disk whenever the laptop goes to sleep.
    Oftentimes I forget to do that myself, then, when the computer is asleep and I want to unplug everything to take it home, I remember that I haven't properly ejected the backup disk ...
    Any hints, pointers, tips will be appreciated!
    Best regards,
    Gabriel.

    Thanks a lot for your response
    It's easy to check disks by name:
    but it's not as easy to determine if the named disk is really the FireWire drive you're looking for, or just some other disk named the same.
    Ah, that's OK for me, because I will always give the disks unique names.
    2. A way to make an applescript being executed whenever the laptop goes to sleep.
    This is harder to do. There is no hook in the system to call a script on sleep (like there is on login or logout),
    That's what I was hoping for ...
    therefore I don't see any easy way to do what you're asking.
    Someone suggested to make a script that does nothing, and which has a handler for the event that the system goes to sleep, and put the eject command there.
    But I have no idea how to write such a handler, and how to make the script so that it does not appear in the dock or in the "tab bar", and so that it does not consume CPU power ...
    That said, I'm often in the same situation, however, I just pull the FireWire drive anyway, once it's finished going to sleep. Since no data is being read or written there is little or no chance of corruption.
    I'd rather be certain
    Any ideas?
    Regards,
    Gabriel.

  • Need help with applescript and Xcode 4.3.2

    I'm trying to write my first application that will involve a GUI. I can code applescript using script editor with a bit of effort, but I'm want to have users input more than one piece of information in the pop up. So, I download xcode, create my first applescript cocoa project go to MainMenu.xib and add a bunch of labels, text fields and buttons. Looks fairly nice... Go to start it and... nothing (well the window pops up, but it doesn't do anything). Unfortunately, I haven't figured out how to link the window to the applescript... So, how do I...
    * Have the applescript prepopulate data in the text fields and pulldowns
    * Once the user changes the data in the fields tell the applescript
    * Tell the window to close and pass the control back to the applescript once either the cancel or submit button is pressed.
    More detailed...
    * What's an outlet and how do I use it here? Which of the 18 outlet(s) do i use for this?
    * What's a property (referenced on one of the web pages I saw around applescript and cocoa) and do I need them here?
    Looking at the documentation with xcode, there isn't a lot about xcode and applescipt. Looking at the web, the top links are a few years old. So, links to good relevent documentation would be very nice as well as direct answers to the questions
    Thanks,
    Scott

    I'm not sure why you are closing it, but the NSApplication class is what keeps track of the windows.  If you don't want to connect the window to an outlet from the interface editor, you can use something like
    set theWindow to current application's NSApplication's sharedApplication's mainWindow()
    ...and from there you can use whatever NSWindow methods, for example
    theWindow's performClose_(me)

  • Help with Applescript to find cell

    I'm attempting to convert some Excel Applescripts over to Numbers and can't find a method to "find".
    In Excel for example, I have:
    set foundCell to (find keyColumn what searchSymbol look at whole look in values search order by rows after (get last cell of keyColumn) search direction search previous without match case)
    The applescript dictionary seems feature rich but no find? Unimaginable, so there must be something I'm over-thinking.

    I'm guessing you're looking for something like this...
    Working with a table something like this:
    Symbol
    ABC
    DEF
    JKL
    DEF
    XYZ
    Then a script like this should do what you what you want:
    property keyColumn : "A"
    property searchSymbol : "DEF"
    property targSht : "Sheet 1"
    property targTbl : "Table 1"
    tell application "Numbers"
      set foundCell to my findLastVal(targSht, targTbl, keyColumn, searchSymbol)'s properties
      --in line above, depending on what you want, substitute name, row, etc for properties
    end tell
    to findLastVal(tSht, tTbl, kCol, sVal)
      tell application "Numbers" to tell front document's sheet tSht's table tTbl
      repeat with i from row count to 1 by -1
      tell column kCol's cell i
      if its value is sVal then return it
      end tell
      end repeat
      end tell
    end findLastVal
    To find the first match in a column you would simply remove the negative decrement, something like this:
    repeat with i from 1 to row count
    If you're working with very long columns it can be more efficient to first read the values into an AppleScript list and look for a match in the list rather than asking Numbers to read a cell and look for a match on each iteration. But the above approach should work well with moderately sized data sets.
    SG

Maybe you are looking for

  • Itunes get "Send Error Report" message

    Alright so when I try and open itunes I get a send error report message. I've tried updating it and that doesnt work and I've already tried reinstalling it. I thought quicktime was the error so I went to try and remove it from my computer. As it was

  • Embed images in one MovieClip, use in another?

    I apologize if you've already read this message. My question isn't only AS, not only Flash, not only Flex. It's in the mysterious area where the three come together. I posted this in the AS discussion, but think it might be better off here. Is it pos

  • Upgrading from OX 10.3.9 to OX 10.5.4 for FCP Studio 2

    I hope this isn't a dumb question, but here goes. I have G5 running OX 10.3.9 and Final Cut Pro 4. Recently purchased Mac Box with OX 10.5.4 and Final Cut Express. I like the Leopard OX and decided to take the plunge and upgrade my G5 to the latest s

  • DVI monitor out under windows

    hello i am trying to have a presentation in windows, and outputting my screen to a projector. is this feature supported under boot camp? how do i view my macbook pro on a projector, under windows? pls advise. thank you for your time

  • IOS 5 update failed Error 1. How do I fix this?!

    I've tried to restore my phone at least ten times and get error 1 every time. I've googled ways to get around it but none of them work. Anybody else have this problem?