electro-music.org   Dedicated to experimental electro-acoustic
and electronic music
 
 Front Page  |  Radio  |  Forum  |  Media  |  Playlists  |  Wiki
Forum with support of Syndicator RSS
 FAQFAQ   CalendarCalendar   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   LinksLinks
 RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in  Chat RoomChat Room 
 Forum index » DIY Hardware and Software » ChucK programming language
Command line arguments to the VM
Post new topic   Reply to topic Moderators: Kassen
Page 1 of 1 [3 Posts]
View unread posts
View new posts in the last week
Mark the topic unread :: View previous topic :: View next topic
Author Message
Antimon



Joined: Jan 18, 2005
Posts: 4145
Location: Sweden
Audio files: 373
G2 patch files: 100

PostPosted: Thu May 21, 2009 2:39 am    Post subject:  Command line arguments to the VM Reply with quote  Mark this post and the followings unread

I feel kind of stupid here, but if you don't ask you'll never know...

A lot of the examples (e.g. gomidi.ck) have lines like this:

Code:
if( me.args() ) me.arg(0) => Std.atoi => device;


which I interpret as reading an argument that the user provides when running the VM. Thinking I should make a hack a bit more user friendly before submitting to the monome forum, I wanted the user to be able to add such an argument when running my chuck program. And sure, I can add a line like the one above, but I have no idea how I am supposed to set this argument when running the chuck program!

I have browsed the ChucK docs up and down, and searched around a bit here, but I'm damned if I can find example where someone runs chuck with application arguments. Is this only supported in the MiniAudicle? Is there a text here right under my nose that says how it works?

and, just to be clear, this doesn't work:

Code:
chuck test.ck hej


this will output:

Code:
[hej]: no such file or directory


because chuck assumes that hej is a chuck source file that I want to run.

I'm running on OSX, can that be the issue?

/Stefan

_________________
Antimon's Window
@soundcloud @Flattr home - you can't explain music
Back to top
View user's profile Send private message Visit poster's website
Kassen
Janitor
Janitor


Joined: Jul 06, 2004
Posts: 7678
Location: The Hague, NL
G2 patch files: 3

PostPosted: Thu May 21, 2009 3:06 am    Post subject: Re: Command line arguments to the VM Reply with quote  Mark this post and the followings unread

Antimon wrote:
I'm wise enough to ask questions; if you don't ask you'll never know...


Fixed a typo there. :¬p

Quote:

I have browsed the ChucK docs up and down, and searched around a bit here, but I'm damned if I can find example where someone runs chuck with application arguments.


Oh, yes, that's underdocumented and should be in the VM commandline options reference, I feel. Right now I think it might only be documented in the VERSIONS text and maybe a example. Let me quote from VERSIONS;

Quote:

1.2.0.8
- (added) command line argument support
e.g. %> chuck foo.ck:1:hello bar:2.5:"with space"
also works with OTF commands
e.g. %> chuck + foo:1:yo
also works with Machine.add( ... )
e.g. // code
Machine.add( "foo:1:2:yo" );
(see examples/basic/args.ck for accessing from code)


Does that clarify?

_________________
Kassen
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Antimon



Joined: Jan 18, 2005
Posts: 4145
Location: Sweden
Audio files: 373
G2 patch files: 100

PostPosted: Thu May 21, 2009 3:27 am    Post subject: Reply with quote  Mark this post and the followings unread

He he Smile Perfect, thanks! That syntax makes sense, so it can be used with Machine.add() also.

I think this info would fit in the VM options page, or in the "Running ChucK" section in the language spec.

/Stefan

_________________
Antimon's Window
@soundcloud @Flattr home - you can't explain music
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic Moderators: Kassen
Page 1 of 1 [3 Posts]
View unread posts
View new posts in the last week
Mark the topic unread :: View previous topic :: View next topic
 Forum index » DIY Hardware and Software » ChucK programming language
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum
Log in
Username:     Password:      Log me on automatically each visit    


Forum with support of Syndicator RSS
Powered by phpBB © 2001, 2005 phpBB Group
Copyright © 2003 through 2026 by electro-music.org