 |
|
BaselScript |
Beschreibung
Image herunterladen
download image = name url = #url directory = #directory
Beispiel 1:
#image = “germany.png”
#url = "http://www.baselscript.com/flags_examples/germany.png"
download image = #image url = #url directory = /APPDIR/images/flaggs/
Beispiel 2:
scene=1 name="download flags" bgcolor=gray
section init
file example_countries.csv(#country, #capitel, #code)
// example
// AfghanistanKabulAFG
// AlbaniaTiranaALB
#text="To start press download, at the end of the list you will receive a protocol"
// delete file ptotocol
delete file =_trace directory="/APPDIR/"
// exist directory flags in #directory_images°W°
#e=$exist_subdirectory(#directory_images,"flags")
if #e == 0
create subdirectory= flags directory =#directory_images
endif
read file=example_countries.csv directory= #_directory_files_examples
#counter_array=$counter_of_records(example_countries.csv)
#current_counter=0
array #c[#counter_array]
fill array=#c file=example_countries.csv field=#country
#index=0
#image=""
#text_counter=""
end section
form
tile=property size=35 color=white
tile=text name= #titel1 x=30 y=40 w=740 h=320 text=#text gravity=center
tile=image name= #img x=250 y=240 w=300 h=150 text=#image directory=/APPDIR/images/flags/
tile=text name= #tile3 x=10 y=540 w=790 h=300 text=#text_counter gravity=center
tile =button name=#start x=100 y=650 w=600 h=100 text=download section=start bgcolor=black
tile =button name=#stop x=100 y=800 w=600 h=100 text=stop section=back bgcolor=black
end form
section start
set visible=0 name=#titel1
call section=download_flag
end section
section download_flag
// make right name for image e.g. Bosnia and Herzegovina => bosnia_and_herzegovina.png
#image= #c[#index]
#image=$concat(#image,".png")
#image=$replace(#image," ","_")
#image=$lower(#image)
#url="http://www.baselscript.com/flags_examples/"
#url2= $concat(#url,#image)
#tit=$concat(#image, " ",#index," / ",#counter_array)
download image= #image url= #url2 directory="/APPDIR/images/flags/"
end section
end section
// download is done
section download_done
#current_counter=#current_counter +1
#text_counter =$concat( #current_counter,"/",#counter_array)
// set next index
#index=#index + 1
if #index == #counter_array
call script= 04_0_server_and_web
endif
redraw form
end section
section back
call script= 04_0_server_and_web
end section
end scene 1