Calling a command line script from PB program

Just starting out? Need help? Post your questions and find answers here.
ac667788
User
User
Posts: 10
Joined: Sun May 13, 2007 6:50 am

Calling a command line script from PB program

Post by ac667788 »

Hi All,
I would like to call a command line ruby script from within a PB program, but I am unsure of how to do it. Would you use the console functions or program functions? What would be the best way of passing data back?
Thanks
Thalius
Enthusiast
Enthusiast
Posts: 711
Joined: Thu Jul 17, 2003 4:15 pm
Contact:

Post by Thalius »

The easy way would be to use runprogram() with the commandline ruby interpreter. However passing data back and forth eitehr had to be over a shared memory area or a database ( both ways have their tricky side about synchronization ).

The better way would be to use the ruby.dll (which you also can ship with your program - unaltered or with source ofc since its GPLed ) - the dll can be called from purebasic and basically gives you the functionality to call your own ruby scripts from file / memory from inside pb. Personally i havent done this yet with ruby ( i tried the similar with php - which worked ). Personally i now use Dracscript as scripting language as its written in PB and pretty easy to extend. :)

In case you havent seen that one yet check out: http://www.purebasic.fr/english/viewtopic.php?t=20312

Whats it for btw ? Writing your own webserver ? =)

Thalius
"In 3D there is never enough Time to do Things right,
but there's always enough Time to make them *look* right."
"psssst! i steal signatures... don't tell anyone! ;)"
ac667788
User
User
Posts: 10
Joined: Sun May 13, 2007 6:50 am

Post by ac667788 »

Thalius,
Thanks for the good insight, I will go ahead a check out ruby.dll and let you know how it goes.

I am trying to make a personalized stock analysis system and I want to take advantage of a ruby script that can download stock data from Yahoo Finance.
Thalius
Enthusiast
Enthusiast
Posts: 711
Joined: Thu Jul 17, 2003 4:15 pm
Contact:

Post by Thalius »

ac667788 wrote:Thalius,
... take advantage of a ruby script that can download stock data from Yahoo Finance.
hmmm - depending what format that data is ( some use RSS which is pretty common ) and if or not https then this would be pretty easy also to write in a simple set of PB Procedures ( faster too ) - and if its about pluggability then you could just epxort this as a dll ( much smaller and more compact than distributing the whole ruby incl your script etc =)

Thalius
"In 3D there is never enough Time to do Things right,
but there's always enough Time to make them *look* right."
"psssst! i steal signatures... don't tell anyone! ;)"
Post Reply