AppleScript Studio and Core Animation?

Is it possible to invoke basic Core Animation events with AppleScript in AppleScript Studio? I'm assuming that Core Animation requires Objective C, but I hope I'm wrong.

Sample code.
Note:
Four (4) menu items were added to the projects' 'File' menu, and titled 'External Script "Eins"' (Command 1), 'External Script "Zwei"' (Command 2), 'External Script "Drei"' (Command 3), and 'External Script "Vier"' (Command 4).
Four (4) script files were created ('Eins.scpt', 'Zwei.scpt', 'Drei.scpt', and 'Vier.scpt') and saved to the 'Desktop'. The 'Drei.scpt' and 'Vier.scpt' files were dragged to the projects 'Groups & Files' list into 'Resources'.
-- Code starts here --
on choose menu item theObject
-- Example of calling scripts - external to the AppleScript Studio application.
if ((name of theObject) is "externalScript01") then run script (((path to desktop from user domain) as string) & "Eins.scpt") as alias
if ((name of theObject) is "externalScript02") then run script (((path to desktop from user domain) as string) & "Zwei.scpt") as alias
-- Example of calling scripts - internal to the AppleScript Studio application.
if ((name of theObject) is "externalScript03") then run script (((path to me) as string) & "Contents:Resources:Scripts:Drei.scpt") as alias
if ((name of theObject) is "externalScript04") then run script (((path to me) as string) & "Contents:Resources:Scripts:Vier.scpt") as alias
end choose menu item
-- Code ends here --

Similar Messages

  • Applescript Studio and Menus

    I am using Applescript Studio and Leopard.
    I have created an application that has menus in it. I can call the menus fine.
    For example, this works:
    on choose menu item theObject
    if (name of theObject is "Test Menu 1") then
    display dialog "You chose Test Menu 1"
    end if
    end choose menu item
    All I want to do is have the user make a choice from the menu, and based on that choice, call an external script. I'm stumped. Any help with this?
    on choose menu item theObject
    if (name of theObject is "Test Menu 1") then
    -- What goes here?
    end if
    end choose menu item

    Sample code.
    Note:
    Four (4) menu items were added to the projects' 'File' menu, and titled 'External Script "Eins"' (Command 1), 'External Script "Zwei"' (Command 2), 'External Script "Drei"' (Command 3), and 'External Script "Vier"' (Command 4).
    Four (4) script files were created ('Eins.scpt', 'Zwei.scpt', 'Drei.scpt', and 'Vier.scpt') and saved to the 'Desktop'. The 'Drei.scpt' and 'Vier.scpt' files were dragged to the projects 'Groups & Files' list into 'Resources'.
    -- Code starts here --
    on choose menu item theObject
    -- Example of calling scripts - external to the AppleScript Studio application.
    if ((name of theObject) is "externalScript01") then run script (((path to desktop from user domain) as string) & "Eins.scpt") as alias
    if ((name of theObject) is "externalScript02") then run script (((path to desktop from user domain) as string) & "Zwei.scpt") as alias
    -- Example of calling scripts - internal to the AppleScript Studio application.
    if ((name of theObject) is "externalScript03") then run script (((path to me) as string) & "Contents:Resources:Scripts:Drei.scpt") as alias
    if ((name of theObject) is "externalScript04") then run script (((path to me) as string) & "Contents:Resources:Scripts:Vier.scpt") as alias
    end choose menu item
    -- Code ends here --

  • AppleScript Studio and First Responder

    I am trying to move the cursor from one text field to another based on checking the results of a field, basically to get the user to re-enter the value if my program decides the input is invalid. This is in an AppleScript Studio application under Mac OS X 10.4.11.
    As far as I can see this should be done using the 'First Responder' command, and accordingly I am trying something like the following.
    on end editing theObject
    tell window "mainWindow"
    try
    set myvariable1 to contents of text field "field1"
    on error
    log "field bad"
    end try
    if myvariable1 contains "." then
    set the first responder to text field "field1"
    log "field should not contain a fullstop"
    else
    set myvariable2 to contents of text field "field2"
    end if
    end tell
    end
    By using log commands, I can see that the branch that should call the "set the first responder" command is being executed, but the curser stubbornly refuses to move back to field1 and instead stays in field2 (the field entered after tabbing out of field1).
    Any suggestions?
    Thanks.

    Sample code.
    Note:
    Four (4) menu items were added to the projects' 'File' menu, and titled 'External Script "Eins"' (Command 1), 'External Script "Zwei"' (Command 2), 'External Script "Drei"' (Command 3), and 'External Script "Vier"' (Command 4).
    Four (4) script files were created ('Eins.scpt', 'Zwei.scpt', 'Drei.scpt', and 'Vier.scpt') and saved to the 'Desktop'. The 'Drei.scpt' and 'Vier.scpt' files were dragged to the projects 'Groups & Files' list into 'Resources'.
    -- Code starts here --
    on choose menu item theObject
    -- Example of calling scripts - external to the AppleScript Studio application.
    if ((name of theObject) is "externalScript01") then run script (((path to desktop from user domain) as string) & "Eins.scpt") as alias
    if ((name of theObject) is "externalScript02") then run script (((path to desktop from user domain) as string) & "Zwei.scpt") as alias
    -- Example of calling scripts - internal to the AppleScript Studio application.
    if ((name of theObject) is "externalScript03") then run script (((path to me) as string) & "Contents:Resources:Scripts:Drei.scpt") as alias
    if ((name of theObject) is "externalScript04") then run script (((path to me) as string) & "Contents:Resources:Scripts:Vier.scpt") as alias
    end choose menu item
    -- Code ends here --

  • Macbook and Core Image

    Will GMA950 handle Core Image?

    According to this Apple page "Core Animation takes advantage of the multiple cores in most new Intel-based Macs. When developers use the framework for an application, the process runs in its own thread. On a multi-core Mac, this means the application runs on one core, and Core Animation on the other. Core Animation runs on any Core Image-capable Mac (including most Macs shipped in the past two years)."

  • Applescript Studio - Dynamically named button title

    Can anyone tell me if it is possible to retrieve the title of a button in an Applescript Studio application?
    I have no problem if the title of the button is set in the Attributes Inspector.
    EXAMPLE:
    If I set the title of a button to "test" in the attributes inspector and attach a script to a button like:
    *display dialog (get title of button "btnName" of window 1)*
    the result will be a dialog containing the text "test"
    However, if I set the title of a button through a script like
    *set title of button "btnName" of window 1 to "test"*
    and then try to retrieve it the same way
    *display dialog (get title of button "btnName" of window 1)*
    the dialog is empty
    Does anyone know if it is possible to retrieve these dynamically set button titles?

    The name of the button has an applescript name, which is how I reference it from the script. But, the actual project uses a series of buttons which all have their titles set dynamically from a script. Also the mode of the buttons are set to "On Off" (not that I think that should make a difference) I am running leopard 10.5 with xcode 3.0.
    I'm rather new to Applescript Studio and xcode. I don't know what would be wrong with the set-up. And why I would have no problem setting the button titles from a script but not be able to retrieve them.
    I have come up with a work around, keeping track of the button titles in a separate array. I seems stupid to have to do that rather than access the existing button property, but it does work.
    I will have to set up a simple test to explore what may be going wrong.

  • Applescript Studio: Lion

    Before you tell me, I realize that Applescript Studio is not longer supported in xcode 4.0 (which *****).   But I was wondering if it would be possible to download an earlier version of xcode, that still has applescript studio, and if that would work.  That would be really great if that is possible.
    Alternatively, if anyone has any alternatives to Applescript Studio that would also be nice.  I know that ASOC (applescript objc) is an alternative, but from what I've seen, it looks really different from applescript. 
    Thanks in advanced, Boboonski

    Xcode 3.2.6 (some people still prefer it) can be installed on Lion with a little trickery - a Google search comes up with several solutions.  AppleScriptObjC is way superior to AppleScript Studio though, with the main difference being in the way that Cocoa is used.  Figuring out the appropriate Cocoa classes and methods is the biggest pain in either one, but the AppleScript parts are still AppleScript.

  • Handling of bundle in Applescript studio

    Hi,
    I'm creating an action for Automator using Applescript, Applescript Studio and command line.
    One of the command line I'm using is a perl script that I want to embeb into the .action bundle. I added it in XCode into the script folder, while when compile it appear in the Ressources folder.
    The Automator giude from Apple suggest to use in Cocoa the [self bundle] command, but I cannot find a way of doing similarly from Applescript.
    I've ben searching most of the day for a solution to get the path of the perlscript.command into the bundle of my action, but I always get message error back.
    Any idea?
    Thanks

    Hi just found my mistake.
    My code is:
    set bundleID to call method "bundleWithIdentifier:" of class "NSBundle" with parameter "mysoftware ID"
    tell bundleID
    set temp to (path for bundleID resource "ressource" extension "perl") as text
    end tell
    That work.
    What was not working is that I started my tell block by "tell bundle bundleID, but there is no need for the bundle keywork there.

  • Applescript & Core Animation

    Hey All
    I am working on a script that in part of its function resizes a browser window in safari. Initially I used a repeat loop to animated the window resize but this is not fluid. Is there a way to execute core animation scripts to resize the browser window?
    Can you execute core animation from applescript at all. My general inclination is that this is possible but via the use of AppleScript Studio.
    Any help or advice is very welcome.
    Thanks
    D

    Note: for this forum, format your code like this:
    // code here
    You don't have to deal with layers and CA objects directly to animate views. This is an easy way to do it:
    // use class methods of UIView to setup an animation
    [UIView beginAnimations:nil context:NULL];
    // set duration in seconds
    [UIView setAnimationDuration:0.5];
    // assuming the view is currently taking up the whole screen,
    // this will slide it off-screen to the left
    viewToBeAnimated.frame = CGRectMake(-320.0, 0.0, 320.0, 480.0);
    // start the animation (executed asynchronously)
    [UIView commitAnimations];
    Just use this code in the function that gets called when the button is pressed.

  • I have a Mac Pro 4,1 quad core intel Xeon running mac OSX 10.6.8 and I have just moved studios and now need to use the Internet wirelessly but there's no airport facilities on this model can anyone tell me what model of airport card I would need for this

    I have a Mac Pro 4,1 quad core intel Xeon running mac OSX 10.6.8 and I have just moved studios and now need to use the Internet wirelessly but there's no airport facilities on this model can anyone tell me what model of airport card I would need for this mac

    Instead of getting a wireless card for the Mac Pro, you might want to consider getting an 802.11ac wireless bridge device that would enable you to connect more than one device to it by Ethernet cable and to eventually take advantage of the faster 802.11ac wireless standard.

  • AppleScript Studio: status bar and panel window

    My problem is that the panel won't open, and so I don't see the progress bar.
    All I am looking for is the panel to come down, show the progress bar turning, then for the panel to go away when iCal is done adding the event. This is the entire script, but I'm not sure I have everything right in Interface builder. The Documentation for display mentioned clicking panel ended, but then further down it looked like you didn't need it.
    I'm confused.
    -- +Event.applescript
    -- +Event
    -- Created by Michael Ewald on 6/26/06.
    -- Copyright 2006 Michael Ewald. All rights reserved.
    load panel "statusPanel" from nib "statusPanel"
    on clicked theObject
    -- Get & Format form items
    set eventTitle to contents of text field "eventTitle" of window "main" as string
    set eventLocation to contents of text field "eventLocation" of window "main" as string
    set EventNotes to contents of text view "eventNotesText" of scroll view "eventNotesScroll" of window "main"
    set allDay to state of button "allDay" of window "main"
    set startDate to current date
    set startDate to content of control "startDate" of window "main"
    set endDate to content of control "endDate" of window "main"
    -- Make Event
    start progress indicator "statusBar" of window "statusPanel"
    try
    start progress indicator "statusBar" of window "statusPanel"
    display "statusPanel" attached to window "main"
    tell application "iCal"
    set theCalName to "AppleScript Test"
    set theCal to calendar theCalName
    if allDay is equal to 1 then
    make new event at end of calendar theCalName with properties {summary:eventTitle, location:eventLocation, allday event:true, description:EventNotes}
    else if allDay is equal to 0 then
    make new event at end of calendar theCalName with properties {summary:eventTitle, location:eventLocation, start date:startDate, end date:endDate, description:EventNotes}
    end if
    end tell
    -- reset form
    set the contents of text field "eventTitle" of window "main" to ""
    set the contents of text field "eventLocation" of window "main" to ""
    set contents of text view "eventNotesText" of scroll view "eventNotesScroll" of window "main" to ""
    set state of button "allDay" of window "main" to 0
    set currentDate to current date
    set currentDatePlus to (current date) + 1 * hours
    -- Update Times
    set content of control "startDate" of window "main" to currentDate
    set content of control "endDate" of window "main" to currentDatePlus
    on error
    display alert "There was a problem!"
    end try
    close panel "statusPanel"
    end clicked
    ----

    Thanks for the response,
    right now the window is in a seperate nib file. I was
    trying to follow the applescript studio example
    "Display Panel"
    Then you need to load it, look at the example, you see panelWIndow is declared as property:
    property panelWIndow : missing value
    then inside on click handler:
    if panelWIndow is equal to missing value then
    load nib "statusPanel" -- if your nib is statusPanel.nib
    set panelWIndow to window "statusPanel" --> that's AppleScript window name
    end if
    then you can use:
    display panel panelWIndow attached to window "main"
    What is the advantage / disadvantage of having more
    than one nib file?
    Not a whole lot in simple app, because you have to load it to use it.
    But in more complex apps, the advantage is that you don't commit run time memory, if the users don't use it.

  • Applescript studio app and plist???

    Hi everyone!
    If I have an Applescript studio app and I don't write anything to a plist is it still possible the app will make it's own plist for any reason? Seems to be but I can't tell for sure because seems not to be consistent. Any help would be great!
    Thanks,
    Reg

    On second thought, the plist file might be created if
    you display something. I just did a clean install so
    everything's new. Let me check with one of the apps
    that displays a an open dialog or something.
    Yes there are certain things in AS Studio that will write to a plist file. One example I know of is if you give any of your windows an "Auto Save Name" (in the "Attribute" pane of IB's inspector pane). The "Auto Save Name" will be used as the key to a plist entry that auto-saves the window's size and position on screen. When you re-run your app the window will be opened with the size and location stored in the plist.
    I believe kel may also be correct that if your app displays an open or save dialog then some state information about those dialogs will be saved to your plist.
    You can always use "plutil" to convert the plist file from binary to xml and then display the contents to see what's in there...
    <pre>
    plutil -convert xml1 /path/to/file.plist
    cat /path/to/file.plist
    </pre>
    Steve

  • Applescript Studio Beginner - Run a script and display a window

    Hi,
    I am new to applescript studio ; I found out how to make an application displaying a window with a progress bar.
    How can I start running a script without displaying any window, and at some time in the script, run the "awake from nib" handler that will call the display of the progress bar ?
    Thanks,
    Nicolas

    Nicolas Silvestre wrote:
    How can I start running a script without displaying any window, and at some time in the script, run the "awake from nib" handler that will call the display of the progress bar ?
    The "awake from nib" handler is called automatically when your nib file gets loaded, you don't call it yourself. I suppose you could go thru the pain of putting your window into a separate nib file and then have your script load the nib file when you're ready... but that's not the easiest way to do it and you probably don't need to do this for your situation.
    All you really need to do is go into Interface Builder, select your window object and uncheck the checkbox in the "Window Attributes" pane that says "Visible At Launch". The "awake from nib" will still be called at it's normal time and your window will be loaded but it will not be displayed.
    Then you can do whatever other scripting you need to do... and when you're ready to display your window you simply call:
    show window "yourWindowsAppleScriptName"
    You can do your initial scripting at the beginning of "awake from nib" and then call "show window" at the tail end of "awake from nib" if that works for you. But you don't have to have the "show window" call in your "awake from nib"... you can call it later on in some other handler if you need to.
    Steve

  • Create a tab view item in obj-c for use in applescript studio

    I'm making an application with applescript studio. I want to be able to add tab view items to a tab view at the press of a button. The problem I have is applescript studio doesn't allow me to create a new tab view item. So I'm thinking I can create the tab view item using objective-c, pass that to my applescript, then add it to my tab view.
    In applescript I plan to use the following call methods to first create the tab view item object, and then add it to my tab view. The objective-c code which is called from the first line in the applescript code is below that. When I run my code I'm getting an error saying newTVI is not defined... so maybe you can see my error! Be kind to me because I'm new to objective-c and I'm sure that's where my problem lies. Anyway, I'd appreciate any help.
    ==Applescript calls to create and add a new tab view item
    set newTVI to call method "returnNewTabViewItem" of class "makeNewTabViewItem"
    call method "addTabViewItem:" of objMainTV with parameter newTVI
    ==Objective-c code to create the tab view item
    ==makeNewTabViewItem.h==
    #import <Cocoa/Cocoa.h>
    @interface makeNewTabViewItem : NSTabViewItem
    NSTabViewItem *newTVI;
    -(NSTabViewItem *)returnNewTabViewItem;
    @end
    == makeNewTabViewItem.m==
    #import "makeNewTabViewItem.h"
    @implementation makeNewTabViewItem
    -(NSTabViewItem *)returnNewTabViewItem
    newTVI = [[[NSTabViewItem alloc] initWithIdentifier:nil] autorelease];
    return newTVI;
    @end

    Please, any ideas?

  • AppleScript Studio/Xcode problem - Problem with text entries! Please help!

    Hey, I've been up for hours each night looking for solutions to this but still have had no luck.
    I am creating an app in Xcode/Applescript studio that will ask you to enter how many times you would like system events to repeat a certain keystroke. First of all, the code would look something like this:
    on click theObject
    If the name of theObject is equal to "myApplication" then
    (Right here would be where the variables representing text in an input in the app's window would be, which I have absolutely no clue what to type.)
    tell application "text edit"
    activate
    tell application "system events"
    keystroke x (x representing a variable)
    end tell
    end tell
    end clicked
    and that's about as far as I can get. I want a variable representing the text in the main text entry box, but I have no clue how to access that text, or even know if it's submitted or detected when I hit a button. Hopefully you're following, as I am way to confused to fully explain it, but please try and help me out if you can.

    Hi Kamprath445,
    Though this mentions iTunes, I think it has good examples you can use...
    http://dougscripts.com/itunes/itinfo/keycodes.php
    More in depth...
    http://developer.apple.com/documentation/applescript/conceptual/applescriptlangg uide/conceptual/ASLR_variables.html

  • How to optimize macbook pro for video editing and 3d animation

    Hello Everybody - I've had a macbook pro for about 5 years now. It works great, havn't had any issues with it yet, but I've started doing more video editing and 3D animation work on it with FCP7 and Blender (usually using photoshop at the same time). Even when I quit all other programs, it's not really able to handle many things I try to do in Blender (for example cloth simulation) and I end up waiting a while with the wheel of death and then having to force quit. I'm not in the position to buy an entirely new macbook pro right now - so I'm wondering if there are any ways I can modify my current macbook to render it more able to handle the heavy processing load?
    Here are its specs:
    Processor - 2.53 GHz Intel Core 2 Duo
    Memory - 4 GB 1067 MHz DDR3
    Graphics - NVIDIA GeForce 9400M 256 MB
    Startup Disk Macintosh HD 320 GB
    Software - Mac OS X Lion 10.7.5 (11G63b)
    Greatful for any advise, thanks!

    so I'm wondering if there are any ways I can modify my current macbook to render it more able to handle the heavy processing load?
    Honestly, IMO, no. Even if you were to upgrade your HDD to a SSD, and increase your RAM, your CPU and GPU just aren't equipped for the tasks you ask of it (and there is no way to upgrade either your CPU or GPU). It would improve performance to upgrade these parts on your machine, no question, but ultimately, the processors would act as a bottleneck for performance/
    The latest high end 15'' Macbook Pro vs your model:
    The CPU is 7X faster in Geekbench 3 64bit multicore benchmarks
    8X the dedicated VRAM as your GPU
    Almost 2X the RAM speed for compatible DIMMS.
    PCIe storage = 7X the RW speed of your HDD
    From Geekbench:

Maybe you are looking for

  • Internet access using the 3G net in Sweden

    Hi! Swedish users hopefully understands what I meen if my English is poor. Thinking about buying a iTouch, my question is if it is possible to get online using a 3G modem? My provider in Sweden is Telenor and I have one of theirs modem. Thanks! /u

  • Dynamically binding CachedRowSet and page navigation exception

    I create one page and drop a table, then create one xxxDataProvider and two rowsets from one database table, rowSet1 is set to have a criteria with the key (xxx) and default to bind with the table, rowSet2 doesn't. In the prerender(), get the session

  • Firefox 11 Crashing Regularly on OS X Snow Leopard

    After upgrading to FF 11, the browser crashes regularly. It usually happens on pages with some sort of flash on it, whether it be a video page or even a page with flash ads. I have tried turning off the hardware option in flash. I tried turning any v

  • Object Data Source and oracle connections.-Help please!!

    I have a detailsview with objectdatasource as a Data source. Every time, i Edit and save a row in the detailsview, upto 10 connections are created to Oracle. And because of this maximum no of connections is reached quickly. I am closing/disposing the

  • How to install Java3d into netbeans 6.5

    I recently downloaded the Java 3D file : j3d-1_5_2-xxxxxx but I don't really know how to "install" it. I looked and found a thing on how to insall it on netbeans but the place they are telling me to go to doesn't exist. I am using netbeans 6.5 and su