"rubyscript2exe", cannot put picture in the project???

C

Cool Wong

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???
 
P

Pat Kiatchaipipat

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 :'(
 
J

Jari Williamsson

Pat said:
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
 
P

Pat Kiatchaipipat

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
 
E

Erik Veenstra

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/
 
P

Pat Kiatchaipipat

I install rubyscript2exe.gem
and use

rubyscript2exe calculator.rb

in cmd and it create calculator.exe in the same directory
what's wrong :(
 
E

Erik Veenstra

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/
 
D

Devi Web Development

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top