Code Monkey home page Code Monkey logo

cocoadialog's Introduction

cocoadialog cocoadialog

Create macOS dialogs from the command line easily!

Status

This project is no longer being actively developed.

Documentation

Visit the cocoadialog.com source repository to find the documentation.

Contributing

If you want to help contribute with the development of this application, please read:

Contribution guidelines for cocoadialog

Credits

cocoadialog was originally created by Mark A. Stratman, then extended and maintained by Mark Carver.

cocoadialog's logo was designed by Mark Carver using the MacOS Icon Template by David Navarrete.

Other contributors include

Please submit a pull request to add your name to the list if it was mistakenly omitted.

Copyright and Licensing

Copyright (c) 2004-2017 Mark A. Stratman and Mark Carver.

All source code is licensed under GPL-2. See LICENSE for details.

The cocoadialog icon and all documentation material is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.

All rights reserved.

cocoadialog's People

Contributors

markhalliwell avatar mstratman avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cocoadialog's Issues

-fsingle-precision-constant build error

I am building on Lion 10.6. Thanks for your help. I tried removing "-fsingle-precision-constant" from the "Extra C Flags", but it still comes back

ProcessPCH /Users/bingalls/Library/Developer/Xcode/DerivedData/cocoaDialog-fwjvqsvxqbjklscirgxyebukxmpw/Build/Intermediates/PrecompiledHeaders/cocoaDialog_Prefix-foaxnsihzfohksfbweyznpfflhny/cocoaDialog_Prefix.pch.pth Source/cocoaDialog_Prefix.pch normal x86_64 objective-c com.apple.compilers.llvm.clang.1_0.compiler
cd /Users/bingalls/Source/cocoadialog
setenv LANG en_US.US-ASCII
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -x objective-c-header -arch x86_64 -fmessage-length=0 -std=c99 -Wno-trigraphs -O0 -Wmissing-field-initializers -Wno-missing-prototypes -Wreturn-type -Wno-implicit-atomic-properties -Wno-receiver-is-weak -Wduplicate-method-match -Wformat -Wmissing-braces -Wparentheses -Wswitch -Wunused-function -Wunused-label -Wno-unused-parameter -Wno-unused-variable -Wunused-value -Wno-empty-body -Wuninitialized -Wunknown-pragmas -Wshadow -Wfour-char-constants -Wno-conversion -Wconstant-conversion -Wint-conversion -Wenum-conversion -Wsign-compare -Wshorten-64-to-32 -Wno-pointer-sign -Wnewline-eof -Wno-selector -Wno-strict-selector-match -Wno-undeclared-selector -Wno-deprecated-implementations -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.6.sdk -fasm-blocks -fstrict-aliasing -Wprotocol -Wdeprecated-declarations -mmacosx-version-min=10.5 -g -fvisibility=hidden -Wno-sign-conversion -I/Users/bingalls/Library/Developer/Xcode/DerivedData/cocoaDialog-fwjvqsvxqbjklscirgxyebukxmpw/Build/Intermediates/cocoaDialog.build/Debug/relaunch.build/relaunch.hmap -I/Users/bingalls/Library/Developer/Xcode/DerivedData/cocoaDialog-fwjvqsvxqbjklscirgxyebukxmpw/Build/Products/Debug/include "-I/Users/bingalls/Source/cocoadialog/Source/*" -I/Users/bingalls/Library/Developer/Xcode/DerivedData/cocoaDialog-fwjvqsvxqbjklscirgxyebukxmpw/Build/Intermediates/cocoaDialog.build/Debug/relaunch.build/DerivedSources/x86_64 -I/Users/bingalls/Library/Developer/Xcode/DerivedData/cocoaDialog-fwjvqsvxqbjklscirgxyebukxmpw/Build/Intermediates/cocoaDialog.build/Debug/relaunch.build/DerivedSources -Wall -Wno-unused-parameter -Werror -Wundef -Wendif-labels -Wpointer-arith -Wcast-align -Wwrite-strings -Wmissing-format-attribute -Wpacked -Wredundant-decls -Winline -Wdisabled-optimization -Wformat=2 -Winvalid-pch -F/Users/bingalls/Library/Developer/Xcode/DerivedData/cocoaDialog-fwjvqsvxqbjklscirgxyebukxmpw/Build/Products/Debug -F/Users/bingalls/Source/cocoadialog/Frameworks -fsingle-precision-constant -DDEBUG --serialize-diagnostics /Users/bingalls/Library/Developer/Xcode/DerivedData/cocoaDialog-fwjvqsvxqbjklscirgxyebukxmpw/Build/Intermediates/PrecompiledHeaders/cocoaDialog_Prefix-foaxnsihzfohksfbweyznpfflhny/cocoaDialog_Prefix.pch.dia -c /Users/bingalls/Source/cocoadialog/Source/cocoaDialog_Prefix.pch -o /Users/bingalls/Library/Developer/Xcode/DerivedData/cocoaDialog-fwjvqsvxqbjklscirgxyebukxmpw/Build/Intermediates/PrecompiledHeaders/cocoaDialog_Prefix-foaxnsihzfohksfbweyznpfflhny/cocoaDialog_Prefix.pch.pth -MMD -MT dependencies -MF /Users/bingalls/Library/Developer/Xcode/DerivedData/cocoaDialog-fwjvqsvxqbjklscirgxyebukxmpw/Build/Intermediates/PrecompiledHeaders/cocoaDialog_Prefix-foaxnsihzfohksfbweyznpfflhny/cocoaDialog_Prefix.pch.d

clang: error: argument unused during compilation: '-fsingle-precision-constant'
Command /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang failed with exit code 1

Allow text labels to be formatted using Markdown

Would it be possible to add the option to format the text in message boxes?

In particular, it would be useful to be able to change the dimension of the font (it is very small, imho), to emphasize some parts of the text (underlining or bold should suffice), to insert hyperlinks, and to have separators between sections of text.

Growl Integration (with bubble fallback)

~~* Intelligent resizing of bubbles. If anyone wants to work on this you'll have my gratitude. ;) Newer versions of Growl do this, but it makes it considerably more complicated than the drawing routines cocoadialog uses.

  • Mouseover highlighting for bubbles. Either change color, or maybe make alpha=1~~

Todo

  • Fully implement CDNotifyControl
  • Fully implement CDGrowlControl
  • Rework CDBubbleControl to utilize new CDNotifyControl
  • Utilize new getIconFromFile: and getIconWithName: methods in CDControl

List of globalOptions for CDNotifyControl

  • --help
  • --debug
  • --title
  • --description
  • --width
  • --height
  • --icon
  • --icon-bundle
  • --icon-file
  • --icon-size
  • --icon-width
  • --icon-height
  • --string-output
  • --no-newline

A ruby progressbar example

#! /usr/bin/ruby

# the open4 rubygem makes using the progressbar extremely simple... get it here
# http://rubygems.org/gems/open4
# This can be spruced up in all sorts of ways, but here's the simplest case    


require "rubygems"
require "open4"

# Initial invocation of you progressbar
cocoaProgressString = '/Applications/CocoaDialog.app/Contents/MacOS/CocoaDialog progressbar --title "Your Title" --text "Initial Message text"'

pid, stdin, stdout, stderr = Open4::popen4 cocoaProgressString 
sleep 2

stdin.puts '10 update 1'
sleep 2

stdin.puts '20 update 2'
sleep 2

(3..10).each {|i| stdin.puts "#{i}0 update #{i}"; sleep 2; i+1}

Dropdown has wrong width (doesn't auto scale)

On mountain lion running the latest cocoaDialog (beta7) the dropdown dialog displays the wrong width, it's extremely width no matter the side of the text or dropdown items.

Even forcing the width using the --width option doesn't make a difference.

I am running the following command:
dropdown --items one two three --button1 "Go" --button2 "Exit" --text "Please select a dropdown item" ‑‑string‑output

Add a color control

I would like to be able to utilize the NSMatrix that's in TBC, bhis will need to be some sort of custom implementation as there is no NSColorWellCell.

Allow TBCs to display an empty value alert sheet

Allow TBCs to display an alert sheet in the dialog if the return value is empty (currently validated by the control).

New options:

--empty-text gives you the ability to override what is displayed if the control determines if it is about to return an empty value. If this option is not provided, cocoaDialog will use appropriate language for the given control.
--value-required lets the control know that you would like a value returned and to not let the dialog close with out one.

Place a CocoaDialog window somewhere else

I have the need to create two cocoa windows in the same program. Unofrtunately, one goes over (or beyond) the other, and the result is not nice.
Rather than having a --width and --height parameter, I'd like to be able to use a '--posx and --posy value so to place the window wherever I want but I haven't been able to see this feature so far.

Any help or suggestions or program improvements would be appreciated.
Thanks

Minimize option with msgbox

Hi,

With latest version of cocoaDialog, there is no way to have a minimize option of the msgbox. Do you believe this is something which could happen in the near futur ? I need it for a small OpenVPN application, where the msgbox is used to inform the user he is connected, and to click a Disconnect button. Some of them are complaining about the fact that the window stay on top.

Jean-Marie

Bubble notifications steal focus from the current window

Hey Mark,

Thank you so much for CocoaDialog! You have literally saved me days and days of coding. However, I would like to point out an issue with your "bubble" notifications. When they appear, they "steal" the focus from the current window (in effect they deactivate the current window). This is a problem because you could be in the middle of typing text, and if a bubble notification appears, you are suddenly unable to type until you wait for the bubble to disappear, or click back onto your window.

Is there a way to make your bubble notifications appear without stealing focus from the current active window, but still appear above all windows like they do now? (This is how Growl notifications work).

Anyway, thanks again for a great library!

  • Joe

notify not working in cocoaDialog beta 3.0.0 beta6

I can't seem to get notify (formerly known as bubbles) working in latest beta.

cocoaDialog.app/Contents/MacOS/cocoaDialog --help

Usage: cocoaDialog [options]
Available run-modes:
checkbox, dropdown, filesave, fileselect, inputbox, msgbox,
notify, ok-msgbox, progressbar, radio, secure-inputbox, secure-standard-inputbox,
slider, standard-dropdown, standard-inputbox, textbox, yesno-msgbox
Global Options:
--help, --debug, --title, --width, --height,
--string-output, --no-newline

Lists the notify feature.

Running

cocoaDialog.app/Contents/MacOS/cocoaDialog notify --help

or

cocoaDialog.app/Contents/MacOS/cocoaDialog notify --debug

Produces no output to stdout/stderr.

Running

cocoaDialog.app/Contents/MacOS/cocoaDialog beer --debug

Produces expected errors and help output.

Using growl or direct not giving any errors or results on screen

I can't get any of these examples to work..

#24

And none of the prior 'bubble' commands error or work, or provide feedback (I'm assuming they are aliased to notify for legacy support)

sw_vers

ProductName: Mac OS X
ProductVersion: 10.6.8
BuildVersion: 10K549

Why Growl instead of Bubble

I use exmaple script for bubble and get growl notifications instead of bubble. Same script with older version displays bubbles. turning off growl for Cocoadialog will display nothing. My computer is Mac book pro with mac 10.6

Controls should float by default

Seeing that cD is a menuless and dockless app, shouldn't this be the default style? Then allowing a person to specify --no-float if they really need it? There's been many times where I go "Hey what happened to my dialog?" only to finally find it after I exposé all my windows. It's rather annoying.

Fileselect doesn't float

There seems to be no option for Fileselect to float on other windows. I've set my prgress bar to float but fileselect always pops up behind it.

Fix should be to add a --float option to fileselect or make it float by default as expected.

Can't update a --indeterminate progressbar window

I am using this simple script to generate an indeteminate progressbar window:

mkfifo /tmp/hpipe2
/usr/bin/CocoaDialog.app/Contents/MacOS/CocoaDialog progressbar
--indeterminate --float --title "Rotazione video"
--posX "center" --posY 300 --text "Attendere..." < /tmp/hpipe2 &
exec 4<> /tmp/hpipe2

Now, whenever I type

echo "something" >&4
echo something >&4
echo -n something >&4

nothing will happen. The messages still stays the same, "Attendere", which is the initial text.

If I use the --percent feature instead of the --progressbar and type

echo "28 the percentage is 28%" >&4

everything will work fine immediately.
Any idea on how to fix this?

i am using 3.0.0beta5

CDBubbleControl does not respond to --click-path or --click-arg

cD can now display Growl notifications! However if Growl isn't installed or the user specifies --no-growl then CDBubbleControl is used to display the notification. Currently the click functionality does not work for CDBubbleControl.

The following are two of the new options for the runMode notify:

(each require a single argument, both are optional)
--click-path - The absolute path to your app, binary or script. (you can alternately supply cocoaDialog and it will use the current running path)
--click-arg - A string of arguments to pass . If the Growl notification is clicked, cD will launch the application (app or binary) or give focus to it is already open.

#!/bin/bash

cocoaDialog notify --debug \
  --no-growl \
  --title "cocoaDialog" \
  --description "New Growl notifcation support!";

cocoaDialog notify --debug \
  --title "This is the --title" \
  --description "$(printf "This is the --description\n\nClick here to show the callback!")" \
  --sticky \
  --icon notice \
  --click-path "cocoaDialog" \
  --click-arg "msgbox --title cocoaDialog --alert \"I'm a callback\" --label \"This dialog was created when you clicked on the Growl notification!\"  --button1 Close --icon info";

cocoaDialog notify --debug \
  --title "Incoming Call" \
  --description "Click here to answer!" \
  --sticky \
  --icon SkypeBlue \
  --icon-bundle com.skype.skype \
  --click-path "/Applications/Skype.app";

cocoaDialog notify --debug \
  --title "cocoaDialog" \
  --description "New Growl notifcation support!";

Create and select folders

It would be useful to be able to create folders, and then select them in a single operation. With version 2.1.1, you can select existing folders with fileselect --select-only-directories, or you can allow the user to create new folders with filesave, but you can't both create a new folder and then select it to return. This would be useful for example for custom iPhoto export scripts, creating and returning a new folder to target the export.

Fix FileSelect and FileOpen dialogs

Need to give --with-extensions the ability to specify files with no extensions by passing only . as an option.
Also need to add --allowed-files option to FileOpen's logic for cases where the user needs to locate a specific file or files.

Click back for bubble notifications (request)

It would be fantastic to be able to define a "clickback" action for bubble notifications, or clickback inactions.

This would make it possible to launch a subsequent script based on a user's acknowledgement of the bubble notification, or even launch a script if they did not click the bubble.

Update/Create documentation for 3.0

  • Add new Checkbox and Radio controls
  • Update and add screenshots
  • Simplify (shorten) documentation and examples pages with collapsible divs and popups

Using standard-dropdown without specifying button1?

standard-dropdown should display a dropdown list with the "Cancel" and "Okay" buttons.

However the --button1 options seems to be required although it doesn't change the button's label.

Working:
~/bin/CocoaDialog standard-dropdown --text "Favorite OS?" --items "GNU/Linux" "OS X" Windows Amiga "TI 89" --button1 "foobar"

Not working (fails with error 255):
~/bin/CocoaDialog standard-dropdown --text "Favorite OS?" --items "GNU/Linux" "OS X" Windows Amiga "TI 89"

fileselect returns paths with unescaped spaces

The fileselect (and possibly filesave) control returns the path selected, but does not escape spaces that may be in the path.

For example,
/Users/myusername/Desktop/Test folder
should be
/Users/myusername/Desktop/Test\ folder

Proper exit status and run loop restructuring

@mstratman and @technocoreai,

Just thinking out loud here. Typically, the return value includes an "exit status" for an event such as a timeout or a button press as the first line. Shouldn't this really be returned as a true exit code?

Instead of using [NSApp terminate:nil], shouldn't we use something like the following since this is a CLI?

int exitCode = 0;
if (returnTimedOut) {
    exitCode = -4
}
else if (returnCanceled) {
    exitCode = -1
}
else if (returnButton) {
    exitCode = buttonPressed; // 1,2, or 3
}
exit(exitCode);

Only reason I'm asking because I don't know how other scripting languages would handle this. In bash, it would rather be better to implement it this way because bash can use the variable $? to return the exit code.

What, if any, would the ramifications be if this were to happen?

Thanks

I want to thank you for this excellent piece of software!

Parse JSON files to provide dialogs

For scripts that rely heavily on cocoaDialog and with the expanding available options, it would be nice to give the ability to parse a file that contains something like JSON objects. This would be useful in instances where servers could provide dialogs or being able to setup multiple dialogs all in one file so scripts could condense source code:

cocoaDilaog parse "/data.json" "confirm"

cocoaDilaog parse <($(curl -sL http:// example.com/data.json)) "confirm"

data.json:

{
  "confirm": {
    "control": "msgbox",
    "title": "Empty Folder",
    "alert": "Do you wish to delete these files?",
    "label": "Warning: this action cannot be undone. Please proceed with caution!",
    "icon": "caution",
    "buttons": ["Confirm", "Cancel"]
  }
}

CDOptions to allow quotes

  • CDOptions has the limitation that a key's value cannot be the same as another key. For example, --title --width will not set the title to "--width". Is this even a problem? I can't imagine it being one for anybody, but you never know.

Backwards compatible option names

Give controls the ability to specify depreciated keys for backwards compatibility. This is needed when renaming control options to something that makes a little more sense.

For example in cocoaDialog 2.1.1:
cocoaDialog InputBox --title "Input Box" --informative-text "Label of textbox" --text "Value of textbox" --button1 "Button 1"

In cocoaDialog 3.0
cocoaDialog InputBox --title "Input Box" --label "Label of textbox" --value "Value of textbox" --button1 "Button 1"

In 3.0, either will work.

Custom NIBs?

First- thank you, Mark, for this awesome software. it's awesome.
I've made some custom NIBs that i'd like to use with cocoa dialog- I can use them successfully if I replace one of the existing NIBs in the CD resource bundle, but I can't get CD to use them if I give them a unique name. Since I don't really want to replace the default NIBs, I'm wondering if there's anyway to get CD to use them.
thanks!

Create slider control

Just a thought, any ideas? This could easily be integrated into utilizing the controlMatrix in TBC.

fileselect --select-multiple only returns one file

!/bin/bash

cocoaDialog="/Applications/cocoaDialog.app/Contents/MacOS/cocoaDialog"

rv=$cocoaDialog fileselect \ --select-multiple \ --title "Select files" \ --text "Please select files"

echo $rv

returns the first selected file - I have tried this with perl and bash, and with the example code.

I'm using OS X Lion.

TY
John

inputbox doesn't capture stdin

I can't get input box (or variants) to capture stdin. The entered text just goes to the shell that CocoaDialog was called from. All the other runmodes work well.

I'm using the following wrapper:

#!/usr/bin/perl
use strict;
use warnings;

my $path = "/Applications"; 
my $cd = "$path/cocoaDialog.app/Contents/MacOS/cocoaDialog";

system($cd, @ARGV);

but have also tried running binary directly.

I have tried v2.1.1 as well as 3.0.0-beta7. I have also tried cloning and building myself in case it was OS-X 10.8.2 related but no luck.

Am I doing something wrong?

Thanks for any pointers.
Peter

timeout w/ ok-msgbox

Untested, unverified. From Cocoadialog-users list:

i am struggling with cocoadialog (version 2.x and 3.x). I am trying to use the
timeout option while using the msgbox runmode but it doesn't works, e.g.:

rv=$CD ok-msgbox --string-output --no-newline --text "This is a simple first example" \ --informative-text "We're just going to echo the string output" ‑‑timeout 2
echo "User pressed the $rv button"

The dialog shows up but waits indefinitely for user input (tested with version 2.x and 3.x).

Refactor the automatic panel/layout handling of controls

Provide support for --close (behavior should be the same as cancel), --resize and --minimize. Perhaps even --fullscreen for the textbox control?

Provide support for --min-width, --max-width, --min-height and --max-height. Useful if the --resize option is provided.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.