Forum: Ruby "rubyscript2exe", cannot put picture in the project???

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
645cd831f3b2eee7ba15fd8256796c57?d=identicon&s=25 Cool Wong (coolwong)
on 2007-07-03 04:21
when i create a .exe file from ruby, the "rubyscript2exe" will occur
error, because the project involve some picture. So how i can put
picture in my project without errors???
Ba116c5b6d7ef0b73fccd9bd7842b5c7?d=identicon&s=25 Pat Kiatchaipipat (blitzer)
on 2007-11-18 20:49
I have the same problem somebody know how to add picture please :(
9bf04a0b77492deed7dd8628a2506005?d=identicon&s=25 Janek Thomaschewski (Guest)
on 2007-11-18 20:54
(Received via mailing list)
Hello,

Pat Kiatchaipipat schrieb:
> I have the same problem somebody know how to add picture please :(

what's the problem? Do you make your script directory to an executable
with rubyscripttoexe? If that's true also the picture in that directory
is now inside the binary. To use it in you script use the
rubyscripttoexe variables.

require 'rubyscripttoexe'
(..)
RUBYSCRIPT2EXE.appdir + '/youpic.jpg'

Janek
Ba116c5b6d7ef0b73fccd9bd7842b5c7?d=identicon&s=25 Pat Kiatchaipipat (blitzer)
on 2007-11-19 09:06
I can't do it, I use

require 'rubyscript2exe'
$pic = RUBYSCRIPT2EXE.appdir + '/t.jpg'
picturebox2_img = Image.new($pic)

where t.jpg is in the same directory with .rb file and when I run with
ruby It works but when I convert to exe, and move to different directory
it doesn't work :'(
66ccd403df6faea723c1b88b1770f79b?d=identicon&s=25 Jari Williamsson (Guest)
on 2007-11-19 10:37
(Received via mailing list)
Pat Kiatchaipipat wrote:
> I can't do it, I use
>
> require 'rubyscript2exe'
> $pic = RUBYSCRIPT2EXE.appdir + '/t.jpg'
> picturebox2_img = Image.new($pic)

Why do you use $ in front of a local variable? AFAIK, that's reserved
for system use.

> where t.jpg is in the same directory with .rb file and when I run with
> ruby It works but when I convert to exe, and move to different directory
> it doesn't work :'(

Try to include the jpg file by setting RUBYSCRIPT2EXE.lib, as explained
by the docs.


Best regards,

Jari Williamsson
Ba116c5b6d7ef0b73fccd9bd7842b5c7?d=identicon&s=25 Pat Kiatchaipipat (blitzer)
on 2007-11-19 13:56
I still struggle with it :'(
here's my code

require 'wx'
require 'rubyscript2exe'

include Wx
include RUBYSCRIPT2EXE

RUBYSCRIPT2EXE.lib = ["t.jpg"]

.....

picturebox2_img = Image.new('t.jpg')

.....

I think when I convert to exe and delete file 't.jpg' application won't
work because picturebox2_img is make from directory and when I restore
't.jpg' from recycle bin it's work

how can I add jpg to lib?? I do something wrong
6b0967f63d03e99b6c07a3f5ed224c77?d=identicon&s=25 Erik Veenstra (Guest)
on 2007-11-19 15:18
(Received via mailing list)
> I can't do it, I use
>
>  require 'rubyscript2exe'
>  $pic = RUBYSCRIPT2EXE.appdir + '/t.jpg'
>  picturebox2_img = Image.new($pic)
>
> where t.jpg is in the same directory with .rb file and when I
> run with ruby It works but when I convert to exe, and move to
> different directory it doesn't work :'(

Which command do you use to "compile" the application?

gegroet,
Erik V. - http://www.erikveen.dds.nl/
Ba116c5b6d7ef0b73fccd9bd7842b5c7?d=identicon&s=25 Pat Kiatchaipipat (blitzer)
on 2007-11-19 16:45
I install rubyscript2exe.gem
and use

rubyscript2exe calculator.rb

in cmd and it create calculator.exe in the same directory
what's wrong :(
9bf04a0b77492deed7dd8628a2506005?d=identicon&s=25 Janek Thomaschewski (Guest)
on 2007-11-19 16:48
(Received via mailing list)
Try to use "rubyscript2exe directorywithcalculator.rb/" instead.
But mention that you main script need the name "init.rb".

Pat Kiatchaipipat schrieb:
6b0967f63d03e99b6c07a3f5ed224c77?d=identicon&s=25 Erik Veenstra (Guest)
on 2007-11-19 16:59
(Received via mailing list)
> I install rubyscript2exe.gem and use
>
> rubyscript2exe calculator.rb
>
> what's wrong :(

Compiling a script, just, uh, compiles your script. It doesn't
include the other application files.

However, compiling a directory does include other files.

Create the directory calculator, move calculator.rb to
calculator/init.rb, move t.jpg to calculator/t.jpg and run the
following command:

 rubyscript2exe calculator/

gegroet,
Erik V. - http://www.erikveen.dds.nl/
Ba116c5b6d7ef0b73fccd9bd7842b5c7?d=identicon&s=25 Pat Kiatchaipipat (blitzer)
on 2007-11-19 18:01
finally I can make .exe with picture!
thank you very much :))
D05d7d067a89654727f33d362336de12?d=identicon&s=25 Devi Web Development (Guest)
on 2007-11-19 23:48
(Received via mailing list)
On Nov 19, 2007 3:36 AM, Jari Williamsson
<jari.williamsson@mailbox.swipnet.se> wrote:
> Pat Kiatchaipipat wrote:
> > I can't do it, I use
> >
> > require 'rubyscript2exe'
> > $pic = RUBYSCRIPT2EXE.appdir + '/t.jpg'
> > picturebox2_img = Image.new($pic)
>
> Why do you use $ in front of a local variable? AFAIK, that's reserved
> for system use.

Variable names that begin with ($) aren't reserved for system use,
they're global variables.

Daniel Brumbaugh Keeney
This topic is locked and can not be replied to.