Can this code be modified or is there another solution?
Code: Select all
;Fred's file hand-off
ImportC ""
PB_Gadget_SetOpenFinderFiles(Callback)
EndImport
IsGadget(0) ; Ensures the gadget lib is linked as this command is in it
; if you put a MessageRequester before this the .app will not intercept incoming file!
ProcedureC OpenFinderFilesCallback(*Utf8Files)
Protected cnt,filecnt,filesin$,filename$
filesin$ = PeekS(*Utf8Files, -1, #PB_UTF8) ; Each file is separated by a 'tab'
MessageRequester("Raw Load...",filesin$+" filecount="+Str(CountString(filesin$,Chr(9)))) ; Use StringField() to iterate easily
If Len(filesin$) ; Here you have the filename to open
For filecnt=1 To CountString(filesin$,Chr(9))+1
filename$=StringField(filesin$,filecnt,Chr(9))
MFilePath=GetPathPart(filename$)
filename$=GetFilePart(filename$)
MessageRequester("Loading file...",filename$+" filecnt="+Str(filecnt))
; remove code
EndIf
Next
EndIf
EndProcedure
PB_Gadget_SetOpenFinderFiles(@OpenFinderFilesCallback()) ; should be put very early in the code, before any event loop
; end Fred's hand-off