[ruby-it] Re: [Codice a Barre] File *.bat
Paolo Guzziii
plex27 a alice.it
Gio 1 Feb 2007 17:34:52 CET
Ho trovato questo pezzo di codice, che fa quello che desidero ma solo in
parte.
In pratica invoco un shell del dos tramite il file run.bat.
Nel file ho quest' istruzione: java -jar "dist/barcode.jar" che mi crea
un file barcode.jpg sul disco C.
Ora se lo lancio da Ruby non me la crea ... se lancio il file a mano
(faccio doppio click) funziona perfettamente.
Qualcuno sa perche?
shellexecute(0, 'open', 'crea-barcode/run.bat', '', '',
SW_SHOWMAXIMIZED)
# ShowWindow() Commands (from winuser.h in the Platform SDK)
SW_HIDE = 0
SW_SHOWNORMAL = 1
SW_NORMAL = 1
SW_SHOWMINIMIZED = 2
SW_SHOWMAXIMIZED = 3
SW_MAXIMIZE = 3
SW_SHOWNOACTIVATE = 4
SW_SHOW = 5
SW_MINIMIZE = 6
SW_SHOWMINNOACTIVE = 7
SW_SHOWNA = 8
SW_RESTORE = 9
SW_SHOWDEFAULT = 10
SW_FORCEMINIMIZE = 11
SW_MAX = 11
# handle = Handle to the owning window (0 = none)
# verb = action to take ("open", "edit", "explore", "find", or
"print")
# file = the file to launch
# folder = default folder for the process
# showCmd = how to show the application (one of the constants listed
above)
# returns a number greater than 32 on success (see msdn.microsoft.com)
def shellexecute(handle, verb, file, params, folder, showCmd)
shell = Win32API.new("shell32","ShellExecute",
['L','P','P','P','P','L'], 'L' )
return shell.call(handle, verb, file, params, folder, showCmd)
end
> Paolo Guzziii wrote:
>> Ciao
>> sono riuscito a generare il codice a barre usando Java (Barcode4J).
>> Ora vorrei riuscire a lanciare il mio file run.bat dalla mia
>> applicazione sviluppata con Ruby on Rails. E' possibile secondo voi?
>
> Direi di si; guarda il codice per integrare un report generato da
> JasperReport (java), e adattalo per il tuo caso
>
> http://wiki.rubyonrails.com/rails/pages/HowtoIntegrateJasperReports
>
> Ciao
> Massimo
--
Posted via http://www.ruby-forum.com/.
Maggiori informazioni sulla lista
Ml