external file

View: New views
2 Messages — Rating Filter:   Alert me  

external file

by Marinos Koutsomichalis :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

hi all,
I want to make a small gui with buttons that will launces some of the  
instruments I've made at once, sth like a control center for my lives.
What I actually want is to keep some .rtf files with my classes  
probably at ~/Library/Application Support/Supercollider/
Extensions...etc and on each buttons press I need a way to evaluate  
the right file. I actually want the gui itself to be in that location  
and be evaluate at start up (so as not to fill my startup file with  
all that code)
And furthermore I'd like a way to do so so that I may move the files  
to another location and the still to work, well to be  path  
independed in some way.

I don't have the slighest idea of how sth like that could be done.. I  
am only aware of
"path...".loadPath way that limits me a bit.

Thx
_______________________________________________
sc-users mailing list
sc-users@...
http://lists.create.ucsb.edu/mailman/listinfo/sc-users

Re: external file

by Dan Stowell :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi -

Not sure if I completely understand you, but for example, if you want
to scan a directory for RTF files, and e.g. create one button for each
file, you can do this:

~loc = "/my/desirable/path/*.rtf";
~filelist = ~loc.pathMatch;
~buttons = ~filelist.collect{|path|
  // Now make a button for each one
}

If you want to be path-independent then perhaps you want to decide
~loc dynamically - for example, in a saved document you could write

 ~loc = Document.current.path.dirname +/+ "*.rtf";

Or if you're writing a class file you'd do it slightly differently:

 ~loc = this.class.filenameSymbol.asString.dirname +/+ "*.rtf";


HTH
Dan

2008/5/12 Marinos Koutsomichalis <marinos@...>:

> hi all,
>  I want to make a small gui with buttons that will launces some of the
>  instruments I've made at once, sth like a control center for my lives.
>  What I actually want is to keep some .rtf files with my classes
>  probably at ~/Library/Application Support/Supercollider/
>  Extensions...etc and on each buttons press I need a way to evaluate
>  the right file. I actually want the gui itself to be in that location
>  and be evaluate at start up (so as not to fill my startup file with
>  all that code)
>  And furthermore I'd like a way to do so so that I may move the files
>  to another location and the still to work, well to be  path
>  independed in some way.
>
>  I don't have the slighest idea of how sth like that could be done.. I
>  am only aware of
>  "path...".loadPath way that limits me a bit.
>
>  Thx
>  _______________________________________________
>  sc-users mailing list
>  sc-users@...
>  http://lists.create.ucsb.edu/mailman/listinfo/sc-users
>



--
http://www.mcld.co.uk
_______________________________________________
sc-users mailing list
sc-users@...
http://lists.create.ucsb.edu/mailman/listinfo/sc-users