Scripting AppleScript Studio Applications

Is there a way to create commands in an AppleScript Studio application that could be called by an AppleScript? Ideally, I want to be able to use the command in an AppleScript and have it execute a handler in my Studio Application.
Thanks,
Carl

Won't be a problem with AppleScriptObjC

Similar Messages

  • Localize the name of AppleScript Studio application

    Hi,
    How to localize the name of an AppleScript Studio application (Xcode 2.4.1) ?
    I have found the solution in the developer doc, but nothing...
    - I have added CFBundleName in every InfoPlist.strings file (with and without the CFBundleName property in the Info.plist file)
    - I have added CFBundleExecutable in every InfoPlist.strings file (with and without the CFBundleExecutable property in the Info.plist file)
    - I have tried to make localizable the Info.plist file, modifying the CFBundleName and CFBundleExecutable property of every localization
    Of course, I have run "Clean All" between each operation...
    Thanks by advance, CU

    Solution...
    In Info.plist file:
    - The CFBundleName property must have a unique name
    - Add the LSHasLocalizedDisplayName key with string "YES"
    In every InfoPlist.strings file:
    - Add a CFBundleDisplayName property with localized name
    - Add a CFBundleName property with localized name (for the application menu)

  • Building a stand-alone AppleScript Studio application

    I’m taking a crack at building my first stand-alone application with AppleScript Studio. After many attempts to locate the needed “build” information in the various documentation resources I’m still pretty much poking around in the dark ...
    My application runs fine in the Xcode IDE. No problems. The application that Xcode saves in the project’s Debug folder runs too, (well, on the computer I developed it on) even if I move it out of its folder ...
    However, the app. doesn’t run on other macs. When double-clicked and it sorta fizzles without ever opening — wondering if the debug version relies on some resources within the project. I've installed it on a PowerBook and iBook, both running Mac OS 10.4
    I tried Build/Release. This also produced an application (in the Build/Release folder) which when failing to launch and causes the OS to burp, “You cannot open the application “My First App” because it may be damaged or incomplete.” This app will not run on my development computer or other laptops (PowerBook and iBook.)
    Build/Release also invoked three Xcode compiler error messages that seem to indicate that I need to change the NIB settings:
    /usr/bin/ld: warning /Developer/SDKs/MacOSX10.3.9.sdk/System/Library/Frameworks/Cocoa.framework/Coco a cputype (18, architecture ppc) does not match cputype (7) for specified -arch flag: i386 (file not loaded)
    /usr/bin/ld: warning /Developer/SDKs/MacOSX10.3.9.sdk/System/Library/Frameworks/AppleScriptKit.frame work/AppleScriptKit cputype (18, architecture ppc) does not match cputype (7) for specified -arch flag: i386 (file not loaded)
    /usr/bin/ld: warning fat file: /usr/lib/gcc/i686-apple-darwin8/4.0.1/../../../libSystem.dylib does not contain an architecture that matches the specified -arch flag: i386 (file ignored)
    Also got this warning(?):
    /usr/bin/ld: Undefined symbols:
    __keymgr_dwarf2_registersections
    _cthread_initroutine
    _atexit
    _errno
    _exit
    mach_initroutine
    _ASKInitialize
    _NSApplicationMain
    collect2: ld returned 1 exit status
    Also tried Clean All. Same result.
    I'm sure there's a simple step ... which I will remember well, 'cause I'm learning it the hard way.
    John

    However, the app. doesn’t run on other macs. When
    double-clicked and it sorta fizzles without ever
    opening — wondering if the debug version relies on
    some resources within the project. I've installed it
    on a PowerBook and iBook, both running Mac OS 10.4
    You're right. You can't move a debug version of the app to another computer unless you copy the entire project folder. The debug version of the app requires access to other by-products of the build process in order to run.
    Build/Release also invoked three Xcode compiler error
    messages that seem to indicate that I need to change
    the NIB settings:
    The following errors are not related to your NIB file. They indicate you're trying to link against the 10.3.9 frameworks on an intel CPU. The 10.3.9 frameworks are PPC only.
    /usr/bin/ld: warning
    /Developer/SDKs/MacOSX10.3.9.sdk/System/Library/Framew
    orks/Cocoa.framework/Cocoa cputype (18, architecture
    ppc) does not match cputype (7) for specified -arch
    flag: i386 (file not loaded)
    /usr/bin/ld: warning
    /Developer/SDKs/MacOSX10.3.9.sdk/System/Library/Framew
    orks/AppleScriptKit.framework/AppleScriptKit cputype
    (18, architecture ppc) does not match cputype (7) for
    specified -arch flag: i386 (file not loaded)
    /usr/bin/ld: warning fat file:
    /usr/lib/gcc/i686-apple-darwin8/4.0.1/../../../libSyst
    em.dylib does not contain an architecture that
    matches the specified -arch flag: i386 (file
    ignored)
    [snip]
    Take a look at the suggestions I made in this thread to make sure your project is set up to build a universal binary and to ensure that you're linking against the 10.4 universal frameworks.
    Steve

  • 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 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 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 --

  • AppleScript Studio - Huge .nib file?

    I'm creating my first AppleScript Studio application, and I've noticed that one of the nib files used in the project has grown to a huge size (20MB)... and I'm wondering why, and whether this is normal?
    (One other has grown to ~5MB, the other three are small ~50kB - around what I'd expect.)
    I do have two buttons that show icons - but the files are small ~100kB each... not enough to explain 20MB worth of nib. (Besides, I thought that the icon files are stored separately - they are copied to the resources folder by XCode.)
    It's not a huge concern at the moment, because everything works, and 20MB is not huge... I'm just concerned that such a simple App has an interface file that's 20MB (the entire app builds to 27.2MB, with 26.2MB of nibs... surely that's not normal?
    Any ideas?
    EDIT: Sorry, I should have mentioned that I'm using IB v 3.0 (629) on Leopard 10.5.2.
    Message was edited by: OSXAlex

    Michael,
    I guess you should be able to do this using a shell script and "curl" - the one problem with curl is that it won't honor your system's proxy settings...
    Andreas

  • 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 --

  • Option+Return does not work in applescript studio

    Fresh install of osx 10.4.6 Tiger, newest release of xcode.
    I start an applescript studio application project, when editing in Xcode Option+Return does not insert the continue line character.
    I can open the same .applescript in the Applescript Editor and Option+Return does work.
    Also, Option+Return works in my desktop installation of Xcode. No idea what's different here or how to fix it, but it's really messing with my work flow.

    Moved to .NET SDK forum.
    Search here, lots of post on IIS and setting Printer Access Permissions for your application.
    Also search MSDN on what is required to for IIS to access local Printers.
    Also search for ActiveX Controls and Browser permissions, you'll likely have problems there also since most Browsers will not or do not recommend allowing any ActiveX control.
    Don

  • AppleScript Studio + Sparkle Framework for auto updates

    I have sucessfully added the Sparkle framework to one of my Applescript Studio applications, but I'm having trouble finding out how to call a Cocoa method from within an Applescript. I need to live-update the interval at which Sparkle checks for updates. As of now I have to restart the app for the changes to take place.
    Here is the explanation from their documentation on how to do it...
    http://sparkle.andymatuschak.org/wiki/Documentation/PeriodicChecks
    +You might make a menu in your preferences to let the user specify this interval; just update SUScheduledCheckInterval in the user defaults with the user’s choice—a setting there will override one in Info.plist. You’ll need to let Sparkle know when the interval changes, though: *just call scheduleCheckWithInterval: on your SUUpdater (it’ll cancel the old one).*+
    I just don't know how to do this in Applescript. I'm assuming it's possible through the "call method" command, but I haven't been able to figure it out by myself.
    My best guess was the following...
    +call method "scheduleCheckWithInterval:" of object "SUUpdater"+
    Has anyone got this working before?
    Thanks for any help.

    Won't be a problem with AppleScriptObjC

  • 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

  • Renaming Application in Applescript Studio

    To those who know the answer, this probably seems simple, but for the life of me I cannot figure this out.
    I wrote an application using XCode and Applescript Studio. When I started, I named the project "cm" because it was simple and short. Now the application is getting substantial and I regret the name. I always have to rename it manually after the compile. Where can I change the name generated by the compiler to the longer name I now wish I have invoked when I started? (Obviously without breaking anything.)

    Hi Boberino
    Some suggestions from to threads below
    http://meandmarkpublishing.blogspot.com/2007/09/changing-application-name-for-xc ode.html
    http://homepage.mac.com/kelleherk/iblog/C1216817469/E1454445171/index.html
    Budgie

  • Starting mysql daemon hangs applescript studio app

    hi,
    i am currently writing a small application with applescript studio that starts an apache server and a mysql database.
    Starting apache via a 'do shell' command is no problem at all but starting mysql with this command
    do shell script "/pathto/mysqldsafe --port=2323 --somemoreoptions &"
    hangs my application.
    Executing the command in a shell works well.
    I guess the problem is that firing the command (in the terminal) causes the terminal to return to the command prompt (username:~ username$ ) pretty immediatley. But after one or two seconds there are some more information echoed to the shell ('Starting mysqld daemon with databases from pathto_datadir').
    Maybe this confuses my app and it starts waiting for things that will never end.
    My current workaround is to open the terminal and to execute the command there:
    tell application "Terminal"
      do script "pathto/mysqldsafe --port=3023 --somemoreoptions &"
      delay 1
      if terminalwasopen is equal to false then
        quit
      else
        close window 1
      end if
    end tell
    Any ideas how to get rid off this wokaround and how to manage this with a simple 'do shell script'?
    Thanks in advance.
    i++
    PowerBook Pro 15"   Mac OS X (10.4.7)  

    This issue is discussed in the do shell script technote.
    Specifically, even though you tell the process to background (by appending the &), AppleScript still holds onto the process' stdout and stderr, waiting for the output of the command.
    The solution is to suppress or redirect stdout and stderr, e.g.:
    do shell script "/pathto/mysqldsafe --port=2323 --somemoreoptions > /dev/null 2>&1 &"
    The '> /dev/null' suppresses stdout (which could go to a file if you prefer), and '2>&1' sends stderr to the same place as stdout.
    Incidentally, I assume you have some check to ensure apache and/or mysql aren't already active, right? This would cause a problem if mysql is already running.

  • 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.

  • 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?

Maybe you are looking for

  • Ringing Bt tech support is like hell on earth as i...

    Good morning to all  Well where to start really, guess the begining is a good place joined bt broadband after moving house in oct 2012 this was under the guise that infinity would soon be available at our cabinet. Soon after installation noticed prob

  • Tab button - How to use it in Hyperion IR 9.3.1

    Hi All, I got a requirement from my client. He wants to use the Tab key functionality on the dashboard for the different command buttons. I have used command button for process, export and print report. I am not able to set the Tab key property on th

  • Subquery inside INSERT INTO

    Hi ! I have a problem to put a Subquery inside an INSERT INTO-Statement. I try it this way: (the select-statemnet alone is running fine) (the listing is shortened) INSERT INTO W_CACS_ENTRY location_code ,case_num ,billing_account_id select a.location

  • Problems saving files to network with Adobe CC on Mac OS Yosemite

    Hi there I have just made the change up to Adobe CC on my four Mac computers. This consists of three Mac Minis (new) running OS X 10.10 Yosemite (as installed by Apple) and an iMac running OS X 10.10 Yosemite (upgraded from 10.6 Snow Leopard). The pr

  • Disk Partitioning / Logical Drives vs. One Key Recovery Functionality

    I just purchased a Windows 7 Lenovo H530 and need to know if I can shrink the C: drive and add an extended partition with logical volumes without disabling OKR / Rescue System 3.0 functionality. My 1 TB HDD: 200 MB     SYSTEM_DRV (Primary Partition)