I want to use the DOSFileLookup template to select multiple files from File Explorer, then copy them to a Clarion table. When I check the Multi-Select box, I have an entry field to fill in. What do I place here? What else must be done in various embed points to do this? ChatGPT, while very sure of itself, was not that helpful, and mostly a timewaster.
Something like the following:
add_files(),
Where:
! add_files()
add_files procedure()
CODE
CLEAR( QF )
QF:file_names = loc:file_name
GET( QF, QF:file_names )
IF ERRORCODE() THEN
CLEAR( QF )
QF:file_names = loc:file_name
ADD( QF )
END !* if *
DISPLAY()
!* end *
1 Like
I personally don’t use the template for multi-file select. Here’s an example of declaring a select file class and using it in code.
TheTypes cstring('Images(*.jpg;*.png;*.gif;*.bmp;*.pcx;*.tga;*.tif;*.j2k;*.jp2;*.ps)|*.jpg;*.png;*.gif;*.bmp;*.pcx;*.tga;*.tif;*.j2k;*.jp2;*.ps|Word (.docx;.doc)|*.docx;*.doc|Excel (.xlsx;.xls)|*.xlsx;*.xls|Adobe (.pdf)|*.pdf|All|*.*') !
NewAttachment cstring(FILE:MaxFilePath) !
ReturnValue Long
GetFilesClass Class(SelectFileClass)
End
AttachmentFileQ SelectFileQueue
PathSize LONG
lCnt LONG
CODE
NewAttachment = clip(iniMgr.TryFetch('SavedValues', 'IPM_ProjectAttachmentPath'))
if not NewAttachment or not exists(NewAttachment)
NewAttachment = ds_GetFolderPath(WE::CSIDL_PERSONAL)
end
GetFilesClass.Init()
GetFilesClass.WindowTitle = 'Select document or image to attach'
GetFilesClass.DefaultFile = NewAttachment
GetFilesClass.SetMask(TheTypes)
GetFilesClass.Flags = FILE:KeepDir+FILE:LongName+File:Multi
GetFilesClass.Ask(AttachmentFileQ,false)
If Records(AttachmentFileQ)
Loop lCnt = 1 To Records(AttachmentFileQ)
Get(AttachmentFileQ,lCnt)
NewAttachment = AttachmentFileQ.Name
4 Likes
Thanks for the example code. It’s given me a good start.