I am trying to add many pictures.
The process takes a long time adding one at a time.
I need to select a picture, but 1 out of a bunch of them.
Now It requires to many clicks to reach the folder and change from bmp to jpg.
Db name is Boxes.dbf
The location is c:\box
Pictures are in c:\box\images
I saw this thread http://msgboard.alphasoftware.com/al...dding+pictures
I tried both of scripts but I got errors:
=================================
This Script 1 : give expected value error
tbl=table.open(A_DB_CURRENT_PATH+"Box.DBF")
path1 = ui_get_path ("Enter Path","", "c:")
list = filefind.get(path1+chr(92)+"*.jpg",35,"N|c|L")
format = "name|creation|size"
dim pp[2000] as p
count = w_count(list,crlf())
' lines=count
trace.writeln(str(count))
pp.initialize_properties(format,list)
dim indx as n
indx = 1
dim a_files[count] as p
for i = 1 to count
f=file.open(path1+pp[i].name,file_ro_shared)
temp = ui_bitmap_load("temp",f.readb(val(pp[i].size)))
f.close()
results = ui_dlg_box(pp[i].name,
%dlg%)
ui_bitmap_drop("temp")
if results = "Next" then
goto nexti
else if results = "Cancel" then
tbl.close()
end
else if results = "Add" then
end if
if count = 0 then
goto allend
else
trace.writeln(path1+pp[i].name+" "+pp[i].creation+" " +pp[i].size)
tbl=table.current(2)
if tbl.mode_get()
========================================================
Script 2 gives : extra character at end of expression error
and refers to line 4
a5_get_jpeg(jpeg1.this)
function a5_get_jpeg as v(obj as p)
result = ui_get_image_filename("")
if result "" "" then
dim data as b
f = file.open(result,FILE_RO_SHARED)
data = f.readb(f.bytes_get())
f.close()
if right(result,4) = ".BMP" then
data = bitmap_to_jpeg(data)
end if
fld = obj.field_get()
tbl = fld.table_get()
if tbl.mode_get() = 0 then
tbl.change_begin()
fld.value_put(data)
tbl.change_end(.t.)
obj.parent.Resynch()
else
fld.value_put(data)
obj.parent.commit()
obj.parent.Resynch()
end if
end if
end function
Similarly, here is the code to insert a Bitmap image.
function a5_get_bitmap as
v(obj as p)
result = ui_get_image_filename("")
if result "" "" then
dim
data as b
f = file.open(result,FILE_RO_SHARED)
data = f.readb(f.bytes_get())
f.close()
if right(result,4) "" ".BMP" then
data = jpeg_to_bitmap(data)
end if
fld = obj.field_get()
tbl = fld.table_get()
if tbl.mode_get() = 0 then
tbl.change_begin()
fld.value_put(data)
tbl.change_end(.t.)
obj.parent.Resynch()
else
fld.value_put(data)
obj.parent.commit()
obj.parent.Resynch()
end if
end if
end function
==================================================
The process takes a long time adding one at a time.
I need to select a picture, but 1 out of a bunch of them.
Now It requires to many clicks to reach the folder and change from bmp to jpg.
Db name is Boxes.dbf
The location is c:\box
Pictures are in c:\box\images
I saw this thread http://msgboard.alphasoftware.com/al...dding+pictures
I tried both of scripts but I got errors:
=================================
This Script 1 : give expected value error
tbl=table.open(A_DB_CURRENT_PATH+"Box.DBF")
path1 = ui_get_path ("Enter Path","", "c:")
list = filefind.get(path1+chr(92)+"*.jpg",35,"N|c|L")
format = "name|creation|size"
dim pp[2000] as p
count = w_count(list,crlf())
' lines=count
trace.writeln(str(count))
pp.initialize_properties(format,list)
dim indx as n
indx = 1
dim a_files[count] as p
for i = 1 to count
f=file.open(path1+pp[i].name,file_ro_shared)
temp = ui_bitmap_load("temp",f.readb(val(pp[i].size)))
f.close()
results = ui_dlg_box(pp[i].name,
%dlg%)
ui_bitmap_drop("temp")
if results = "Next" then
goto nexti
else if results = "Cancel" then
tbl.close()
end
else if results = "Add" then
end if
if count = 0 then
goto allend
else
trace.writeln(path1+pp[i].name+" "+pp[i].creation+" " +pp[i].size)
tbl=table.current(2)
if tbl.mode_get()
========================================================
Script 2 gives : extra character at end of expression error
and refers to line 4
a5_get_jpeg(jpeg1.this)
function a5_get_jpeg as v(obj as p)
result = ui_get_image_filename("")
if result "" "" then
dim data as b
f = file.open(result,FILE_RO_SHARED)
data = f.readb(f.bytes_get())
f.close()
if right(result,4) = ".BMP" then
data = bitmap_to_jpeg(data)
end if
fld = obj.field_get()
tbl = fld.table_get()
if tbl.mode_get() = 0 then
tbl.change_begin()
fld.value_put(data)
tbl.change_end(.t.)
obj.parent.Resynch()
else
fld.value_put(data)
obj.parent.commit()
obj.parent.Resynch()
end if
end if
end function
Similarly, here is the code to insert a Bitmap image.
function a5_get_bitmap as
v(obj as p)
result = ui_get_image_filename("")
if result "" "" then
dim
data as b
f = file.open(result,FILE_RO_SHARED)
data = f.readb(f.bytes_get())
f.close()
if right(result,4) "" ".BMP" then
data = jpeg_to_bitmap(data)
end if
fld = obj.field_get()
tbl = fld.table_get()
if tbl.mode_get() = 0 then
tbl.change_begin()
fld.value_put(data)
tbl.change_end(.t.)
obj.parent.Resynch()
else
fld.value_put(data)
obj.parent.commit()
obj.parent.Resynch()
end if
end if
end function
==================================================
Comment