Autowatch?

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

Autowatch?

by jml-6 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi there,

Is there any way to put SC into "autowatch mode", where I can edit a  
file from another place and see the changes reflected?

Thanks,
jml

_______________________________________________
sc-users mailing list

info (subscription, etc.): http://www.beast.bham.ac.uk/research/sc_mailing_lists.shtml
archive: http://www.listarc.bham.ac.uk/marchives/sc-users/
search: http://www.listarc.bham.ac.uk/lists/sc-users/search/

Re: Autowatch?

by Stefan Nussbaumer (SC list) :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

hi,

there's no such thing as "autowatch" as far as i know but the following
works for me (could be turned into an instance-method, presumably of
File, i guess):

d = Document.new; // open a new test-window
// could be your post-window as well
// d = Document.listener;

p = "~/Desktop/test.scd".standardizePath;
// for convenience store the path to your file in a variable

(
r = Routine({
    loop({
        1.0.wait; // wait 1 second between every update
        ("now getting content from"+p).postln;
        f = File(p, "r"); // open your file
        d.string_(f.readAllString.asString); // read its content as a string
        f.close; // close the file again
    })
}).play(AppClock);
)



r.reset.stop;

... maybe a bit clunky but working

stefan


jml schrieb:

> Hi there,
>
> Is there any way to put SC into "autowatch mode", where I can edit a
> file from another place and see the changes reflected?
>
> Thanks,
> jml
>
> _______________________________________________
> sc-users mailing list
>
> info (subscription, etc.):
> http://www.beast.bham.ac.uk/research/sc_mailing_lists.shtml
> archive: http://www.listarc.bham.ac.uk/marchives/sc-users/
> search: http://www.listarc.bham.ac.uk/lists/sc-users/search/
>


--
=+=+=+=+=+=+=+=+=+=+=+=+=
Stefan Nussbaumer
Johnstrasse 18/2a
A-1150 Vienna
Austria
-------------------------
T:     +43 (0)1 956 20 35
M: +43 (0)699 11 33 41 79


_______________________________________________
sc-users mailing list

info (subscription, etc.): http://www.beast.bham.ac.uk/research/sc_mailing_lists.shtml
archive: http://www.listarc.bham.ac.uk/marchives/sc-users/
search: http://www.listarc.bham.ac.uk/lists/sc-users/search/

Re: Autowatch?

by jml-6 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Sweet.
Better than none.
I was also thinking that any sort of refresh key-combo would work for
me.
I don't need a polling-watcher  :)

I might try to dig into the depths of default key commands.

jml

On Apr 17, 2009, at 5:14 AM, Stefan Nussbaumer wrote:
> there's no such thing as "autowatch" as far as i know but the  
> following works for me

_______________________________________________
sc-users mailing list

info (subscription, etc.): http://www.beast.bham.ac.uk/research/sc_mailing_lists.shtml
archive: http://www.listarc.bham.ac.uk/marchives/sc-users/
search: http://www.listarc.bham.ac.uk/lists/sc-users/search/

Re: Autowatch?

by Michael G. Cox :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

IMO SkipJack is better for this sort of thing
since it doesn't need to be reset after cmd-.

d = Document.new; 
p = "~/Desktop/test.rtf".standardizePath;

(
r = SkipJack ({
       f = File(p, "r"); // open your file
       d.string_(f.readAllString.asString.stripRTF); // read its content as a string
       f.close; // close the file again
  }, 1.0 )

)

-mgc


On Apr 17, 2009, at 5:14 AM, Stefan Nussbaumer wrote:

hi,

there's no such thing as "autowatch" as far as i know but the following works for me (could be turned into an instance-method, presumably of File, i guess):

d = Document.new; // open a new test-window
// could be your post-window as well
// d = Document.listener;

p = "~/Desktop/test.scd".standardizePath;
// for convenience store the path to your file in a variable

(
r = Routine({
  loop({
      1.0.wait; // wait 1 second between every update
      ("now getting content from"+p).postln;
      f = File(p, "r"); // open your file
      d.string_(f.readAllString.asString); // read its content as a string
      f.close; // close the file again
  })
}).play(AppClock);
)



r.reset.stop;

... maybe a bit clunky but working

stefan


Re: Autowatch?

by Michael G. Cox :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

You could do something like this.

(
d = Document.new; 
p = "~/Desktop/test.rtf".standardizePath;
a = SCMenuGroup(nil, "jml", 10);
b = SCMenuItem(a, "AutoUpdate");
b.action = {
 f = File(p, "r");
      d.string_(f.readAllString.asString.stripRTF);
      f.close;
};
b.setShortCut("o", true, false);//cmd-opt-o
)

This will add a menu entry and global key command, cmd-opt-'o'.

-mgc
 
On Apr 17, 2009, at 8:49 PM, jml wrote:

Sweet.
Better than none.
I was also thinking that any sort of refresh key-combo would work for
me.
I don't need a polling-watcher  :)

I might try to dig into the depths of default key commands.

jml

On Apr 17, 2009, at 5:14 AM, Stefan Nussbaumer wrote:
there's no such thing as "autowatch" as far as i know but the following works for me

_______________________________________________
sc-users mailing list

info (subscription, etc.): http://www.beast.bham.ac.uk/research/sc_mailing_lists.shtml
archive: http://www.listarc.bham.ac.uk/marchives/sc-users/
search: http://www.listarc.bham.ac.uk/lists/sc-users/search/


Re: Autowatch?

by jml-6 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Ornamental wonderment.
Thanks mgc!

jml

On Apr 17, 2009, at 9:34 PM, Michael Cox wrote:

You could do something like this.

(
d = Document.new; 
p = "~/Desktop/test.rtf".standardizePath;
a = SCMenuGroup(nil, "jml", 10);
b = SCMenuItem(a, "AutoUpdate");
b.action = {
 f = File(p, "r");
      d.string_(f.readAllString.asString.stripRTF);
      f.close;
};
b.setShortCut("o", true, false);//cmd-opt-o
)

This will add a menu entry and global key command, cmd-opt-'o'.

-mgc