Array doesn't work...
-
Hallo!
You might laugh because of that post, but I'm not able to find the reason why it doesn't work...I just want to create an infobox and safe the input to some variables...
Here is the code and Sketchup's comment in the debugger:
prompts = ["Bildhöhe", "Bildbreite", "Bilder pro Sekunde", "Filmdauer in Sekunden", "Ausgabename"] default = [ "800", "800", "25", "60", "Ablauf" ] aufnahmebox = UI.inputbox prompts, default, "Ablaufsimulation mit statischer Ansicht" hoehe = aufnahmebox[0].to_i breite= aufnahmebox[1].to_i fps=aufnahmebox[2].to_i dauer = aufnahmebox[3].to_i name = aufnahmebox[4]
load "C:/Users/tim/Desktop/array.rb"
Error: #<SyntaxError: (eval):4:in `load': C:/Users/tim/Desktop/array.rb:1: syntax error, unexpected tCONSTANT, expecting ']'
...pts = ["Bildhöhe", "Bildbreite", "Bilder pro Sekunde", "Film...
^
C:/Users/tim/Desktop/array.rb:1: syntax error, unexpected tCONSTANT, expecting $end
...ldhöhe", "Bildbreite", "Bilder pro Sekunde", "Filmdauer in S...
^>
(eval):4
(eval):4Thanks for your time.
Tim -
Try this
def test prompts = ["Bildhoehe; ", "Bildbreite; ", "Bilder pro Sekunde; ", "Filmdauer in Sekunden; ", "Ausgabename; "] defaults = [800, 800, 25, 60, "Ablauf" ] aufnahmebox = UI.inputbox(prompts, defaults, "Ablaufsimulation mit statischer Ansicht") hoehe = aufnahmebox[0] breite= aufnahmebox[1] fps=aufnahmebox[2] dauer = aufnahmebox[3] name = aufnahmebox[4] end
See how I removed the accented letter 'ö' and used a 'oe'. Ruby/SUp isn't good with some 'accents' in some circumstances.
'Bildhoehe' now works fine...
Also note how I have removed the "" from the values you want as integers and made them integers initially - that way you can't try to use anything that isn't an integer as your input...
I've also put the arguments for inputbox inside () - recommended but not fatal otherwise [yet]... -
@tig said:
See how I removed the accented letter 'ö' and used a 'oe'. Ruby/SUp isn't good with some 'accents' in some circumstances.
'Bildhoehe' now works fine...That'd most likely be because different character encoding in the .rb file from SU. SU uses Unicode, UTF-8 encoded in it's interface. Should be find to pass on UTF-8 data, but it needs to be properly encoded.
(though I'm not sure if you can run .rb files in UTF-8 - so one might need to write the strings in a UTF-8 file and change the encoding (don't convert, just change) in the editor - which should give you some extra funny looking characters.Might be easier to manage and reduce risk if you store them strings in an external UTF-8 encoded text file and load them from there.
-
Works!
Thank you!
Advertisement