christian.scalese

Q: Question about Applescript display dialog

hello to everyone, can i do a question?

i would know if anyone know how i can set the size of the dialog display in this code :

set listaNomi to {"ACERBI", "AGOSTINI", "ALBERTAZZI"}
repeat (count of listaNomi) times
     set nomeEstratto to some item of listaNomi
     display dialog nomeEstratto
     set listaNomi to removeFromList(nomeEstratto, listaNomi)
end repeat

on removeFromList(theItem, aList)
     set newList to {}
     repeat with x in aList
          if x as string is not equal to theItem as string then
               set newList to newList & x    
          end if
     end repeat
     return newList
end removeFromList

Well i want set the height and weight of the dialog display, and make it much big

anyone help me? please

MacBook (13-inch Mid 2010), OS X Yosemite (10.10.4)

Posted on Jul 29, 2015 10:30 AM

Close

Q: Question about Applescript display dialog

  • All replies
  • Helpful answers

first Previous Page 3 of 3
  • by Hiroto,

    Hiroto Hiroto Jan 20, 2016 6:11 AM in response to christian.scalese
    Level 5 (7,276 points)
    Jan 20, 2016 6:11 AM in response to christian.scalese

    Hello

     

    I have to say I cannot like python... Anyhow here's a pyobjc version of the original cocoa_dialogue() handler. You should be able to use it without any additional installation.

     

    It is noticeably slower than rubycocoa script as far as I have tested with pyobjc 2.2b3 and python 2.6.1 under OS X 10.6.8.

     

    Good luck,

    H

     

     

    --APPLESCRIPT
    --set image to "/Library/Desktop Pictures/Nature/Pond Reeds.jpg"
    --set image to "/Library/Desktop Pictures/Nature/Iceberg.jpg"
    --set image to "/Library/Desktop Pictures/Plants/Fall Leaves.jpg"
    set image to "/Library/Desktop Pictures/Plants/Petals.jpg"
    set colour to {0.9, 1, 1, 0.7} -- {red, green, blue, alpha}
    --set colour to {1, 0, 0, 1} -- {red, green, blue, alpha}
    
    set listaNomi to {"ACERBI", "AGOSTINI", "ALBERTAZZI"}
    repeat (count of listaNomi) times
        set nomeEstratto to some item of listaNomi
        --display dialog nomeEstratto
        cocoa_dialogue(nomeEstratto, {|:size|:{1200, 800}, |:title|:"", |:background_image|:image, |:text_colour|:colour, |:text_size|:160})
        if result = "Cancel" then error number -128
        set listaNomi to removeFromList(nomeEstratto, listaNomi)
    end repeat
    
    on removeFromList(theItem, aList)
        set newList to {}
        repeat with x in aList
            set x to x's contents
            if x ≠ theItem then
                set newList's end to x
            end if
        end repeat
        return newList
    end removeFromList
    
    on cocoa_dialogue(t, opts)
        (*
            string t : text to display
            record opts : {|:size|:sz, |:title|:ti, |:background_image|:bg, |:text_size|:tz, |:text_colour|:tc}
                list sz   : {width, height} of dialogue window, measured in points; default = {600, 300}
                string ti : title of window; default = ""
                string bg : POSIX path of background image file; default is none
                number tz : text font size [point]; default = 24
                list tc   : text colour specified by {r, g, b, a} where r, g, b, a in [0, 1]; default = {0, 0, 0, 1} (black)
            return string : name of button pressed (OK or Cancel)
        *)
        set opts to opts & {|:size|:{600, 300}, |:title|:"", |:text_size|:24, |:text_colour|:{0, 0, 0, 1}, |:background_image|:false}
        set {{w, h}, ti, tz, {r, g, b, a}, bg} to opts's {|:size|, |:title|, |:text_size|, |:text_colour|, |:background_image|}
        
        (* convert decimal separator in "w;h" and "r;g;b;a" to period and semicolon to space so as to
            guarantee "w h" and "r g b a" arguments are space-separated numbers with period as decimal separator. *)
        set nn to {"" & w & ";" & h, "" & r & ";" & g & ";" & b & ";" & a}
        repeat with n in nn
            set n's contents to do shell script "sed 's/,/./g; s/;/ /g' <<< " & n's quoted form
        end repeat
        set {sz, tc} to nn
        
        -- build arguments string
        set args to ""
        repeat with a in {{"-s", sz}, {"-c", tc}}
            set {k, v} to a's contents
            set args to args & k & space & v & space
        end repeat
        repeat with a in {{"-t", ti}, {"-p", tz}, {"-e", t}}
            set {k, v} to a's contents
            set args to args & k & space & ("" & v)'s quoted form & space
        end repeat
        if bg ≠ false then set args to args & "-g " & bg's quoted form & space
        
        do shell script "/usr/bin/python <<'EOF' - " & args & "
    # coding: utf-8
    # 
    #   file:
    #       cocoa_dialogue.py
    # 
    #   function:
    #       present dialogue window using cocoa methods
    # 
    #   usage:
    #       ./cocoa_dialogue.py [options]
    # 
    #       options:
    #         -h, --help                            show help message and exit
    #         -t TITLE, --title=TITLE               window title
    #         -s W H, --size=W H                    window size (Width, Height) [point]
    #         -e TEXT, --text=TEXT                  text to be displayed
    #         -c R G B A, --text-colour=R G B A     text colour (Red, Green, Blue, Alpha)
    #         -p POINT, --text-size=POINT           text font size [point]
    #         -g IMAGE, --background-image=IMAGE    background image file
    # 
    #   version:
    #       v0.12s
    # 
    #   special note:
    #       It requires OS X 10.6 or later when run as script in shell in order for the dialogue to accept keyboard input.
    # 
    #   written by Hiroto, 2016-01
    # 
    import sys
    from Foundation import *
    from AppKit import *
    
    MARGIN_B = 15.0
    MARGIN_R = 15.0
    BUTTON_MIN_H = 30.0
    BUTTON_MIN_W = 90.0
    BUTTON_TITLE_H_MARGIN = 16.0
    BUTTON_TITLE_SIZE = 14.0
    BUTTON_TITLE_OK = 'OK'
    BUTTON_TITLE_CANCEL = 'Cancel'
    
    class AppDelegate (NSObject):
        def initWithArguments_(self, args):
            self = super(AppDelegate, self).init()
    
            self.size = list(args.size)
            self.title = args.title
            self.text = args.text
            self.text_colour = list(args.text_colour)
            self.text_size = args.text_size
            self.background_image = args.background_image
    
            self.win = NSWindow.alloc().initWithContentRect_styleMask_backing_defer_(
                NSMakeRect(0, 0, *self.size),
                NSTitledWindowMask | NSMiniaturizableWindowMask, #| NSClosableWindowMask | NSResizableWindowMask,
                NSBackingStoreBuffered,
                False)
            self.win.setLevel_(NSStatusWindowLevel)
            self.win.setTitle_(self.title)
            self.win.center()
    
            # OK button
            self.bt1 = NSButton.alloc().initWithFrame_(NSZeroRect)
            self.bt1.setTitle_(BUTTON_TITLE_OK)
            self.bt1.setFont_(NSFont.systemFontOfSize_(BUTTON_TITLE_SIZE))
            self.bt1.setKeyEquivalent_('\\r')                   # U+000D CARRIAGE RETURN
            self.bt1.setButtonType_(NSMomentaryLightButton)
            self.bt1.setTarget_(self)
            self.bt1.setAction_(self.bttnPressed_)
            self.bt1.setBezelStyle_(NSRoundedBezelStyle)
            self.bt1.setFrameSize_(
                NSMakeSize(
                    max(self.bt1.attributedTitle().size().width + BUTTON_TITLE_H_MARGIN * 2, BUTTON_MIN_W),
                    BUTTON_MIN_H
                )
            )
            self.bt1.setFrameOrigin_(
                NSMakePoint(
                    self.win.contentView().frame().size.width - self.bt1.frame().size.width - MARGIN_R,
                    MARGIN_B
                )
            )
    
            # Cancel button
            self.bt2 = NSButton.alloc().initWithFrame_(NSZeroRect)
            self.bt2.setTitle_(BUTTON_TITLE_CANCEL)
            self.bt2.setFont_(NSFont.systemFontOfSize_(BUTTON_TITLE_SIZE))
            self.bt2.setKeyEquivalent_('\\x1b')                 # U+001B ESCAPE
            self.bt1.setButtonType_(NSMomentaryLightButton)
            self.bt2.setTarget_(self)
            self.bt2.setAction_(self.bttnPressed_)
            self.bt2.setBezelStyle_(NSRoundedBezelStyle)
            self.bt2.setFrameSize_(
                NSMakeSize(
                    max(self.bt2.attributedTitle().size().width + BUTTON_TITLE_H_MARGIN * 2, BUTTON_MIN_W),
                    BUTTON_MIN_H
                )
            )
            self.bt2.setFrameOrigin_(
                NSMakePoint(
                    self.win.contentView().frame().size.width - self.bt2.frame().size.width - MARGIN_R - self.bt1.frame().size.width,
                    MARGIN_B
                )
            )
    
            # text field
            self.tf = NSTextField.alloc().initWithFrame_(NSZeroRect)
            self.tf.setBordered_(False)
            self.tf.setDrawsBackground_(False)
            self.tf.setSelectable_(False)
            self.tf.setStringValue_(self.text.rstrip('\\n'))
            self.tf.setFont_(NSFont.systemFontOfSize_(self.text_size))
            self.tf.setTextColor_(NSColor.colorWithDeviceRed_green_blue_alpha_(*self.text_colour))
            self.tf.sizeToFit()
            self.tf.setFrameOrigin_(
                NSMakePoint(
                    (self.win.contentView().frameSize().width - self.tf.frameSize().width) / 2.0,
                    (self.win.contentView().frameSize().height - self.tf.frameSize().height + self.bt1.frameSize().height + MARGIN_B) / 2.0
                )
            )
    
            if self.background_image:
                image = NSImage.alloc().initWithContentsOfURL_(NSURL.fileURLWithPath_(self.background_image))
                if image:
                    self.iv = NSImageView.alloc().initWithFrame_(self.win.contentView().frame())
                    self.iv.setImage_(image)
                    self.iv.setImageAlignment_(NSImageAlignCenter)  # NSImageAlignment [1]
                    self.iv.setImageScaling_(NSScaleToFit)          # NSImageScaling [2]
                    self.win.contentView().addSubview_(self.iv)
                # [1] NSImageAlignment
                #   NSImageAlignLeft
                #   NSImageAlignRight
                #   NSImageAlignCenter
                #   NSImageAlignTop
                #   NSImageAlignBottom
                #   NSImageAlignTopLeft
                #   NSImageAlignTopRight
                #   NSImageAlignBottomLeft
                #   NSImageAlignBottomRight
                # [2] NSImageScaling
                #   NSScaleProportionally
                #   NSScaleToFit
                #   NSScaleNone
    
            self.win.contentView().addSubview_(self.tf)
            self.win.contentView().addSubview_(self.bt1)
            self.win.contentView().addSubview_(self.bt2)
            self.win.makeFirstResponder_(self.bt1)
            return self
    
        def applicationDidFinishLaunching_(self, notif):
            try:
                if NSApp.respondsToSelector_('setActivationPolicy_'):
                    NSApp.setActivationPolicy_(NSApplicationActivationPolicyRegular)    # OS X 10.6 or later
                NSApp.activateIgnoringOtherApps_(True)
                self.win.orderFrontRegardless()
                self.win.displayIfNeeded()
            except:
                NSApp.terminate_(self)
                raise
    
        def applicationShouldTerminateAfterLastWindowClosed_(self, app):
            return True
    
        def applicationShouldTerminate_(self, sender):
            return NSTerminateNow
    
        def bttnPressed_(self, sender):
            print sender.title()
            NSApp.terminate_(self)
    
    def parse_options(argv):
        import optparse, sys
        op = optparse.OptionParser()
        op.add_option('-t', '--title', 
            action='store', dest='title', type='string',
            default='',
            help='window title'
        )
        op.add_option('-s', '--size',
            action='store', dest='size', type='float', nargs=2, metavar='W H',
            default=(600.0, 300.0),
            help='window size (Width, Height) [point]'
        )
        op.add_option('-e', '--text',
            action='store', dest='text', type='string',
            default='',
            help='text to be displayed'
        )
        op.add_option('-c', '--text-colour',
            action='store', dest='text_colour', type='float', nargs=4, metavar='R G B A',
            default=(0.0, 0.0, 0.0, 1.0),
            help='text colour (Red, Green, Blue, Alpha)'
        )
        op.add_option('-p', '--text-size',
            action='store', dest='text_size', type='float', metavar='POINT',
            default=24.0,
            help='text font size [point]'
        )
        op.add_option('-g', '--background-image',
            action='store', dest='background_image', type='string', metavar='IMAGE',
            default=None,
            help='background image file'
        )
        try:
            opts, args = op.parse_args(argv)
        except SystemExit as e:
            if e.args != (0,): op.print_help()
            raise
        if len(args) > 0:
            sys.stderr.write('Extra arguments are ignored : %s\\n' % [a.encode('utf-8') for a in args])
        return opts
    
    def main(argv):
        args = parse_options([ a.decode('utf-8') for a in argv])
        app = NSApplication.sharedApplication()
        delegate = AppDelegate.alloc().initWithArguments_(args)
        app.setDelegate_(delegate)
        app.run()
    
    main(sys.argv[1:])
    EOF"
    end cocoa_dialogue
    --END OF APPLESCRIPT
    
  • by VikingOSX,

    VikingOSX VikingOSX Jan 20, 2016 6:50 AM in response to Hiroto
    Level 7 (20,544 points)
    Mac OS X
    Jan 20, 2016 6:50 AM in response to Hiroto

    Hiroto,

     

    Works fine, though slowly, on OS X 10.11.3 with default Python 2.7.10. The missing Plants image folder causes the application to display default gray dialog background. Made following change, and dialogs have nice lake background with the colored text as intended.

     

    set image to "/Library/Desktop Pictures/Lake.jpg"

     

    I think AppleScript sees Python code and intentionally slows down.

  • by christian.scalese,

    christian.scalese christian.scalese Sep 3, 2016 5:40 AM in response to christian.scalese
    Level 1 (0 points)
    Sep 3, 2016 5:40 AM in response to christian.scalese

    hi dirotto and every one, i have installed the beta of macSierra and now the program that you have created doesn't work.

     

    i have installed cocoadialog 2.1.1.

    and the code is:

    --APPLESCRIPT

    set colour to {1, 0, 0, 1} -- {red, green, blue, alpha}

    --set colour to {1, 0, 0, 1} -- {red, green, blue, alpha}

     

    set listaNomi to {"ALDEGANI", "ALISSON", "AUDERO"}

    repeat (count of listaNomi) times

      set nomeEstratto to some item of listaNomi

      --display dialog nomeEstratto

      cocoa_dialogue(nomeEstratto, {|:size|:{900, 700}, |:title|:"", |:text_colour|:colour, |:text_size|:120})

      if result = "Cancel" then error number -128

      set listaNomi to removeFromList(nomeEstratto, listaNomi)

    end repeat

     

    on removeFromList(theItem, aList)

      set newList to {}

      repeat with x in aList

      set x to x's contents

      if xtheItem then

      set newList's end to x

      end if

      end repeat

      return newList

    end removeFromList

     

    on cocoa_dialogue(t, opts)

      (*

            string t : text to display

            record opts : {|:size|:sz, |:title|:ti, |:text_size|:tz, |:text_colour|:tc}

                list sz   : {width, height} of dialogue window, measured in points, default = {600, 300}

                string ti : title of window, default = ""

                number tz : text font size [point], default = 24

                list tc   : text colour specified by {r, g, b, a} where r, g, b, a in [0, 1], default = {0, 0, 0, 1} (black)

            return string : name of button pressed (OK or Cancel)

        *)

      set opts to opts & {|:size|:{600, 300}, |:title|:"", |:text_size|:24, |:text_colour|:{0, 0, 0, 1}, |:background_image|:false}

      set {{w, h}, ti, tz, {r, g, b, a}, bg} to opts's {|:size|, |:title|, |:text_size|, |:text_colour|, |:background_image|}

     

      (* convert decimal separator in "w,h" and "r,g,b,a" to period and semicolon to space so as to

            guarantee "w h" and "r g b a" arguments are space-separated numbers with period as decimal separator. *)

      set nn to {"" & w & "," & h, "" & r & "," & g & "," & b & "," & a}

      repeat with n in nn

      set n's contents to do shell script "sed 's/,/./g, s/,/ /g' <<< " & n's quoted form

      end repeat

      set {sz, tc} to nn

     

      -- build arguments string

      set args to ""

      repeat with a in {{"-s", sz}, {"-c", tc}}

      set {k, v} to a's contents

      set args to args & k & space & v & space

      end repeat

      repeat with a in {{"-t", ti}, {"-p", tz}, {"-e", t}}

      set {k, v} to a's contents

      set args to args & k & space & ("" & v)'s quoted form & space

      end repeat

      if bgfalse then set args to args & "-g " & bg's quoted form & space

     

      do shell script "/usr/bin/python <<'EOF' - " & args & "

    # coding: utf-8

    #

    #   file:

    #       cocoa_dialogue.py

    #

    #   function:

    #       present dialogue window using cocoa methods

    #

    #   usage:

    #       ./cocoa_dialogue.py [options]

    #

    #       options:

    #         -h, --help                            show help message and exit

    #         -t TITLE, --title=TITLE               window title

    #         -s W H, --size=W H                    window size (Width, Height) [point]

    #         -e TEXT, --text=TEXT                  text to be displayed

    #         -c R G B A, --text-colour=R G B A     text colour (Red, Green, Blue, Alpha)

    #         -p POINT, --text-size=POINT           text font size [point]

    #         -g IMAGE, --background-image=IMAGE    background image file

    #

    #   version:

    #       v0.12s

    #

    #   special note:

    #       It requires OS X 10.6 or later when run as script in shell in order for the dialogue to accept keyboard input.

    #

    #   written by Hiroto, 2016-01

    #

    import sys

    from Foundation import *

    from AppKit import *

     

    MARGIN_B = 15.0

    MARGIN_R = 15.0

    BUTTON_MIN_H = 30.0

    BUTTON_MIN_W = 90.0

    BUTTON_TITLE_H_MARGIN = 16.0

    BUTTON_TITLE_SIZE = 14.0

    BUTTON_TITLE_OK = 'OK'

    BUTTON_TITLE_CANCEL = 'Cancel'

     

    class AppDelegate (NSObject):

        def initWithArguments_(self, args):

            self = super(AppDelegate, self).init()

     

            self.size = list(args.size)

            self.title = args.title

            self.text = args.text

            self.text_colour = list(args.text_colour)

            self.text_size = args.text_size

            self.background_image = args.background_image

     

            self.win = NSWindow.alloc().initWithContentRect_styleMask_backing_defer_(

                NSMakeRect(0, 0, *self.size),

                NSTitledWindowMask | NSMiniaturizableWindowMask, #| NSClosableWindowMask | NSResizableWindowMask,

                NSBackingStoreBuffered,

                False)

            self.win.setLevel_(NSStatusWindowLevel)

            self.win.setTitle_(self.title)

            self.win.center()

     

            # OK button

            self.bt1 = NSButton.alloc().initWithFrame_(NSZeroRect)

            self.bt1.setTitle_(BUTTON_TITLE_OK)

            self.bt1.setFont_(NSFont.systemFontOfSize_(BUTTON_TITLE_SIZE))

            self.bt1.setKeyEquivalent_('\\r')                   # U+000D CARRIAGE RETURN

            self.bt1.setButtonType_(NSMomentaryLightButton)

            self.bt1.setTarget_(self)

            self.bt1.setAction_(self.bttnPressed_)

            self.bt1.setBezelStyle_(NSRoundedBezelStyle)

            self.bt1.setFrameSize_(

                NSMakeSize(

                    max(self.bt1.attributedTitle().size().width + BUTTON_TITLE_H_MARGIN * 2, BUTTON_MIN_W),

                    BUTTON_MIN_H

                )

            )

            self.bt1.setFrameOrigin_(

                NSMakePoint(

                    self.win.contentView().frame().size.width - self.bt1.frame().size.width - MARGIN_R,

                    MARGIN_B

                )

            )

     

            # Cancel button

            self.bt2 = NSButton.alloc().initWithFrame_(NSZeroRect)

            self.bt2.setTitle_(BUTTON_TITLE_CANCEL)

            self.bt2.setFont_(NSFont.systemFontOfSize_(BUTTON_TITLE_SIZE))

            self.bt2.setKeyEquivalent_('\\x1b')                 # U+001B ESCAPE

            self.bt1.setButtonType_(NSMomentaryLightButton)

            self.bt2.setTarget_(self)

            self.bt2.setAction_(self.bttnPressed_)

            self.bt2.setBezelStyle_(NSRoundedBezelStyle)

            self.bt2.setFrameSize_(

                NSMakeSize(

                    max(self.bt2.attributedTitle().size().width + BUTTON_TITLE_H_MARGIN * 2, BUTTON_MIN_W),

                    BUTTON_MIN_H

                )

            )

            self.bt2.setFrameOrigin_(

                NSMakePoint(

                    self.win.contentView().frame().size.width - self.bt2.frame().size.width - MARGIN_R - self.bt1.frame().size.width,

                    MARGIN_B

                )

            )

     

            # text field

            self.tf = NSTextField.alloc().initWithFrame_(NSZeroRect)

            self.tf.setBordered_(False)

            self.tf.setDrawsBackground_(False)

            self.tf.setSelectable_(False)

            self.tf.setStringValue_(self.text.rstrip('\\n'))

            self.tf.setFont_(NSFont.systemFontOfSize_(self.text_size))

            self.tf.setTextColor_(NSColor.colorWithDeviceRed_green_blue_alpha_(*self.text_c olour))

            self.tf.sizeToFit()

            self.tf.setFrameOrigin_(

                NSMakePoint(

                    (self.win.contentView().frameSize().width - self.tf.frameSize().width) / 2.0,

                    (self.win.contentView().frameSize().height - self.tf.frameSize().height + self.bt1.frameSize().height + MARGIN_B) / 2.0

                )

            )

     

            if self.background_image:

                image = NSImage.alloc().initWithContentsOfURL_(NSURL.fileURLWithPath_(self.background_i mage))

                if image:

                    self.iv = NSImageView.alloc().initWithFrame_(self.win.contentView().frame())

                    self.iv.setImage_(image)

                    self.iv.setImageAlignment_(NSImageAlignCenter)  # NSImageAlignment [1]

                    self.iv.setImageScaling_(NSScaleToFit)          # NSImageScaling [2]

                    self.win.contentView().addSubview_(self.iv)

                # [1] NSImageAlignment

                #   NSImageAlignLeft

                #   NSImageAlignRight

                #   NSImageAlignCenter

                #   NSImageAlignTop

                #   NSImageAlignBottom

                #   NSImageAlignTopLeft

                #   NSImageAlignTopRight

                #   NSImageAlignBottomLeft

                #   NSImageAlignBottomRight

                # [2] NSImageScaling

                #   NSScaleProportionally

                #   NSScaleToFit

                #   NSScaleNone

     

            self.win.contentView().addSubview_(self.tf)

            self.win.contentView().addSubview_(self.bt1)

            self.win.contentView().addSubview_(self.bt2)

            self.win.makeFirstResponder_(self.bt1)

            return self

     

        def applicationDidFinishLaunching_(self, notif):

            try:

                if NSApp.respondsToSelector_('setActivationPolicy_'):

                    NSApp.setActivationPolicy_(NSApplicationActivationPolicyRegular)    # OS X 10.6 or later

                NSApp.activateIgnoringOtherApps_(True)

                self.win.orderFrontRegardless()

                self.win.displayIfNeeded()

            except:

                NSApp.terminate_(self)

                raise

     

        def applicationShouldTerminateAfterLastWindowClosed_(self, app):

            return True

     

        def applicationShouldTerminate_(self, sender):

            return NSTerminateNow

     

        def bttnPressed_(self, sender):

            print sender.title()

            NSApp.terminate_(self)

     

    def parse_options(argv):

        import optparse, sys

        op = optparse.OptionParser()

        op.add_option('-t', '--title',

            action='store', dest='title', type='string',

            default='',

            help='window title'

        )

        op.add_option('-s', '--size',

            action='store', dest='size', type='float', nargs=2, metavar='W H',

            default=(600.0, 300.0),

            help='window size (Width, Height) [point]'

        )

        op.add_option('-e', '--text',

            action='store', dest='text', type='string',

            default='',

            help='text to be displayed'

        )

        op.add_option('-c', '--text-colour',

            action='store', dest='text_colour', type='float', nargs=4, metavar='R G B A',

            default=(0.0, 0.0, 0.0, 1.0),

            help='text colour (Red, Green, Blue, Alpha)'

        )

        op.add_option('-p', '--text-size',

            action='store', dest='text_size', type='float', metavar='POINT',

            default=24.0,

            help='text font size [point]'

        )

        op.add_option('-g', '--background-image',

            action='store', dest='background_image', type='string', metavar='IMAGE',

            default=None,

            help='background image file'

        )

        try:

            opts, args = op.parse_args(argv)

        except SystemExit as e:

            if e.args != (0,): op.print_help()

            raise

        if len(args) > 0:

            sys.stderr.write('Extra arguments are ignored : %s\\n' % [a.encode('utf-8') for a in args])

        return opts

     

    def main(argv):

        args = parse_options([ a.decode('utf-8') for a in argv])

        app = NSApplication.sharedApplication()

        delegate = AppDelegate.alloc().initWithArguments_(args)

        app.setDelegate_(delegate)

        app.run()

     

    main(sys.argv[1:])

    EOF"

    end cocoa_dialogue

    --END OF APPLESCRIPT

     

    can you help me please?

  • by VikingOSX,

    VikingOSX VikingOSX Sep 3, 2016 5:57 AM in response to christian.scalese
    Level 7 (20,544 points)
    Mac OS X
    Sep 3, 2016 5:57 AM in response to christian.scalese

    Unfortunately, we cannot help you with script languages on macOS Sierra as it is a beta product, and this site's terms of use exclude beta product discussion or support. Once macOS Sierra is publicly available from the OS X App Store, and one or more of us have the finished release installed, then we can resume assistance.

first Previous Page 3 of 3