I would like to run a system command after the page is loaded. Currently I have the code in my view but it is ran and then the page is loaded. The line I am trying to run in my view is as follows: <% system "osascript -e ''say \"text to be spoken\"''" %> Can anyone help with this? -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
that is not going to do what you think. first off, the ruby code embedded in the template is parsed on the server. the results are then sent to the browser/client with the appropriate headers (html, xml, etc). so your call to ''system'' is being processed on the server, the results of which , if any, incorporated into the response which is then sent to the browser. Chris On 5/8/07, Al Messina <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > I would like to run a system command after the page is loaded. > Currently I have the code in my view but it is ran and then the page is > loaded. > The line I am trying to run in my view is as follows: > > <% system "osascript -e ''say \"text to be spoken\"''" %> > > Can anyone help with this? > > -- > Posted via http://www.ruby-forum.com/. > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Currently what happens is the command is executed but the result happens before the page is loaded. Therefore before it loads the page it speaks the text but I want it to speak the text after the page is loaded. Is there any way to have it execute the command after the page loads? Chris Hall wrote:> that is not going to do what you think. > > first off, the ruby code embedded in the template is parsed on the > server. the results are then sent to the browser/client with the > appropriate headers (html, xml, etc). so your call to ''system'' is > being processed on the server, the results of which , if any, > incorporated into the response which is then sent to the browser. > > Chris-- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Al Messina wrote:> Is there any way to have it execute the command after the page loads?Sure. Put some Javascript in the rendered page, so that it generates an XHR request back to the server. (You could hook that to an event, or just put it near the end of your page source.) Use an action written just for this purpose. Include the speech call in that action. Then, soon after the page loads in the client (browser), the speech command will be processed on the server. Does that help? Thank you so much, Guest -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
just so i understand this, what is the purpose of running a speech command on the server? On 5/8/07, Guest <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > Al Messina wrote: > > Is there any way to have it execute the command after the page loads? > > Sure. Put some Javascript in the rendered page, so that it generates an > XHR request back to the server. (You could hook that to an event, or > just put it near the end of your page source.) Use an action written > just for this purpose. Include the speech call in that action. > > Then, soon after the page loads in the client (browser), the speech > command will be processed on the server. Does that help? > > Thank you so much, > Guest > > -- > Posted via http://www.ruby-forum.com/. > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
I am creating a system that askes questions to the user. The User has the option to view all the questions or have them spoken to them one at a time. Some of our user''s have very limited reading skills if any. The application being created is available on the web in in our network. Our platform is OSX -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Thanks for your help. Your solution seems very reasonable but unfourtnetly my javascript skills are very limited to some RJS so I am not familiar with how to generate an XHR request and hook it to an event. Do you know of any resources that could help give me the knowledege I need to do this? Thanks Guest wrote:> Al Messina wrote: >> Is there any way to have it execute the command after the page loads? > > Sure. Put some Javascript in the rendered page, so that it generates an > XHR request back to the server. (You could hook that to an event, or > just put it near the end of your page source.) Use an action written > just for this purpose. Include the speech call in that action. > > Then, soon after the page loads in the client (browser), the speech > command will be processed on the server. Does that help? > > Thank you so much, > Guest-- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On May 8, 2007, at 19:07 , Al Messina wrote:> I am creating a system that askes questions to the user. The User has > the option to view all the questions or have them spoken to them > one at > a time. Some of our user''s have very limited reading skills if any. > The application being created is available on the web in in our > network. > Our platform is OSXYou seem to have missed it the first times it was mentioned, but your code will cause the questions to be spoken on the server. That is not on the local machine of the user. For the user to hear the stuff that''s spoken, they''d have to get up and walk to the server room. Probably not what you''re looking for. -- Jakob Skjerning - http://mentalized.net --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
bramski-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2007-May-08 17:22 UTC
Re: Execute System command after page loads
http://www.onlamp.com/pub/a/onlamp/2005/06/09/rails_ajax.html Has a decent enough into into doing ajax calls with rails. But, I''m kind of curious about something kind of fundamental here, you''re using a system command on the server to speak the text? Is the user ALWAYS sitting at the server, or within earshot of it''s speakers? Otherwise, I don''t think you''ll be getting what you intended, and the solution to speaking dynamic text to the user from a web-page will be significantly more complicated than executing osascript. On May 8, 10:15 am, Al Messina <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> Thanks for your help. Your solution seems very reasonable but > unfourtnetly my javascript skills are very limited to some RJS so I am > not familiar with how to generate an XHR request and hook it to an > event. Do you know of any resources that could help give me the > knowledege I need to do this? > Thanks > > Guest wrote: > > Al Messina wrote: > >> Is there any way to have it execute the command after the page loads? > > > Sure. Put some Javascript in the rendered page, so that it generates an > > XHR request back to the server. (You could hook that to an event, or > > just put it near the end of your page source.) Use an action written > > just for this purpose. Include the speech call in that action. > > > Then, soon after the page loads in the client (browser), the speech > > command will be processed on the server. Does that help? > > > Thank you so much, > > Guest > > -- > Posted viahttp://www.ruby-forum.com/.--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Ah, I see the problem here. Thank you. I guess back to the drawing board. Bram Whillock wrote:> http://www.onlamp.com/pub/a/onlamp/2005/06/09/rails_ajax.html > > Has a decent enough into into doing ajax calls with rails. But, I''m > kind of curious about something kind of fundamental here, you''re using > a system command on the server to speak the text? Is the user ALWAYS > sitting at the server, or within earshot of it''s speakers? Otherwise, > I don''t think you''ll be getting what you intended, and the solution to > speaking dynamic text to the user from a web-page will be > significantly more complicated than executing osascript. > > On May 8, 10:15 am, Al Messina <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>-- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Other posters have mentioned (and I agree) that you probably don''t want to do what you are saying you want to do. You''re probably going to have to look into the different ways of delivering audio to the client, that you want the user to hear. I think this would be out of the scope of your original request; you''ll probably want to investigate Flash, Java, or something similar to do your audio presentations on the client. Instead of trying to help you further on this list, I would simply suggest that you enlist the help of someone who is used to architecting this kind of hybrid system. It''s tricky. Thank you for your continued support, Guest Al Messina wrote:> > Thanks for your help. Your solution seems very reasonable but > unfourtnetly my javascript skills are very limited to some RJS so I am > not familiar with how to generate an XHR request and hook it to an > event. Do you know of any resources that could help give me the > knowledege I need to do this? > Thanks-- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Unless I am missing something, and I admint this may not be the most elegant code but I think I can do it if grab the ip of the machine the user is at and then in the system call I have it ssh into that ip using keygens and then run the osascript . Once I get that far I am still unclear as how to use the technique mentioned above with regards to the javascript. Guest wrote:> Other posters have mentioned (and I agree) that you probably don''t want > to do what you are saying you want to do. > > You''re probably going to have to look into the different ways of > delivering audio to the client, that you want the user to hear. I think > this would be out of the scope of your original request; you''ll probably > want to investigate Flash, Java, or something similar to do your audio > presentations on the client. > > Instead of trying to help you further on this list, I would simply > suggest that you enlist the help of someone who is used to architecting > this kind of hybrid system. It''s tricky. > > Thank you for your continued support, > Guest > > > Al Messina wrote: >> >> Thanks for your help. Your solution seems very reasonable but >> unfourtnetly my javascript skills are very limited to some RJS so I am >> not familiar with how to generate an XHR request and hook it to an >> event. Do you know of any resources that could help give me the >> knowledege I need to do this? >> Thanks-- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Yes. Perhaps you just need to rethink your approach. Why not use the phone? http://www.alphaworks.ibm.com/tech/voicexml Regards, Dave _______________________________ Information and Educational Technology Kwantlen University College - 604-599-2120 "So powerful is the light of unity that it can illuminate the whole earth." --Bahá''u''lláh Al Messina <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> Sent by: rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org 08-05-2007 10:50 AM Please respond to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org cc Subject [Rails] Re: Execute System command after page loads Ah, I see the problem here. Thank you. I guess back to the drawing board. Bram Whillock wrote:> http://www.onlamp.com/pub/a/onlamp/2005/06/09/rails_ajax.html > > Has a decent enough into into doing ajax calls with rails. But, I''m > kind of curious about something kind of fundamental here, you''re using > a system command on the server to speak the text? Is the user ALWAYS > sitting at the server, or within earshot of it''s speakers? Otherwise, > I don''t think you''ll be getting what you intended, and the solution to > speaking dynamic text to the user from a web-page will be > significantly more complicated than executing osascript. > > On May 8, 10:15 am, Al Messina <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>-- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
bramski-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2007-May-08 21:08 UTC
Re: Execute System command after page loads
Elegant is all up to the beholder, I think a lot of rube goldberg machines are very elegant. But I would have a lot of fun stealing your passwords by hitting your webserver with my machine configured with a promiscuous ssh server. Not to mention watching you squirm as your hairs turn grey while you troubleshoot your ssh connectivity for the next [insert how long you think you will work at your current job here] years. On May 8, 11:19 am, Al Messina <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> Unless I am missing something, and I admint this may not be the most > elegant code but I think I can do it if grab the ip of the machine the > user is at and then in the system call I have it ssh into that ip using > keygens and then run the osascript .--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
HA! Yes I see your point. Fortunately this application would ONLY be accesiable to those in our very small network. Bram Whillock wrote:> Elegant is all up to the beholder, I think a lot of rube goldberg > machines are very elegant. But I would have a lot of fun stealing > your passwords by hitting your webserver with my machine configured > with a promiscuous ssh server. Not to mention watching you squirm as > your hairs turn grey while you troubleshoot your ssh connectivity for > the next [insert how long you think you will work at your current job > here] years. > > On May 8, 11:19 am, Al Messina <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>-- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Javascript after the page loads: I used the html body onload tag to load remote_function() Thanks all for your suggestions! -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---