PDA

View Full Version : Make an app where scripting controls everything




Chirone
Apr 3, 2013, 04:27 PM
Hi,

I want to make an app like Maya where the interface is made with objective c but all actions are runnable with scripts.
So if you want to open a window you could always type in python or ruby a command that will open the window.
Or if you want to open a picture and display it on screen then you hit a button which runs the script command that somehow tells the app to open a file and display it on screen.
I'm aware that there is apple scripting, but I'd rather not use that.



Sonnestah
Apr 4, 2013, 02:18 AM
great idea!

.
.
.
.

:confused:

Red Menace
Apr 4, 2013, 04:29 AM
Since you don't want to use AppleScript (I am guessing that also means Apple Events), how do you plan on sending commands to your application? What have you done so far?

Chirone
Apr 4, 2013, 06:45 AM
That's kind of why I was asking, to see if anyone had any ideas.

What I've thought of so far is to make some sort of parser that takes in a scripting language and determines what to do with it from there.

do you know of some way that I can take in ruby script and and make something happen from it?

chown33
Apr 4, 2013, 12:16 PM
Sockets. Could be Unix domain sockets or TCP/IP sockets.
http://en.wikipedia.org/wiki/Unix_domain_socket

If you use IP sockets, you have to figure out a way to publish or advertise what port number you're using. mDNS (Bonjour) could do that, but it's not the only approach.


Python is embeddable (google it). So connect the embedded Python interpreter to the socket, manage the possibility of multiple connections, and you don't have any parser to write, because Python already has one.

Chirone
Apr 4, 2013, 03:11 PM
interesting... I will look into that.

Hans Kamp
Apr 4, 2013, 03:34 PM
That's kind of why I was asking, to see if anyone had any ideas.

What I've thought of so far is to make some sort of parser that takes in a scripting language and determines what to do with it from there.

do you know of some way that I can take in ruby script and and make something happen from it?

Reading this, I actually wonder the following.

When I go to the prompt I notice that the command interpreter is very similar to UNIX. Even yacc and lex exist. These are programs for building a compiler, an interpreter or any other software that parses text, especially written in a programming language.

Yacc (whereis yacc gives: /usr/bin/yacc) and lex (whereis lex gives: /usr/bin/lex) are two programs to help you with that. Yacc wants a language definition and lex wants a definition list of tokens, the smallest part of language.

I didn't expect an Apple to have it, but I am more and more convinced that Mac OS X is a dialect of UNIX (Xenix or Linux) with a GUI (the windowing system) on top of it.

Maybe this information may give you a hint to the solution to this matter.

Red Menace
Apr 4, 2013, 04:57 PM
When I go to the prompt I notice that the command interpreter is very similar to UNIX.

OS X is an Open Brand UNIX 03 registered product that is based on FreeBSD, sitting on top of a Mach kernel, so many of the UNIX tools are in there - see the OS X Manual Pages (https://developer.apple.com/library/mac/#documentation/Darwin/Reference/ManPages/index.html).

chown33
Apr 4, 2013, 06:53 PM
I didn't expect an Apple to have it, but I am more and more convinced that Mac OS X is a dialect of UNIX (Xenix or Linux) with a GUI (the windowing system) on top of it.

OS X is POSIX compliant:
http://en.wikipedia.org/wiki/POSIX#Fully_POSIX-compliant

As RedMenace noted, it's also Open Brand UNIX 03 compliant, i.e. it complies with SUS:
http://en.wikipedia.org/wiki/Single_UNIX_Specification#OS_X