FileAddToFilebox(fileboxName As String, filePath As String) As String

 

Adds a file to a filebox.

 

This function copies a file to a temporary folder, saves it to the database and then lists it in a filebox.

 

A file can only be added to a filebox while in linkmode (i.e. the user has started to create or edit a registration).

If the user cancels the edit, then the newly added file will be removed from database and listbox.

 

Parameters:

 

Name

Type

Description

fileboxName

String

The name of the filebox control where the file will be added to.

Example: "imFB_lnk_p04_Files"

filePath

String

The full path to the file to be added to filebox.

The FileNew script function of Seminar Pro returns such a string which can be used by FileAddToFilebox. See example below

 

Returns:

 

Type

Value

Description

String

filepath

If a file exists at filePath, then it will be added to the database and copied to a temporary local folder and then listed in filebox  fileboxName.

The path to the file in the temporary folder is returned by the function. If any error occurred, then an empty string is returned.

 

Available in:

 

WindowMain

WindowLink

YES

YES

 

 Used in:

 

XojoScript Name

GUID

Create Seminar Invoice with Word

31EB5A79-78E5-4A8C-9101-5B118F113AB4

Create Seminar Reminder Invoice

A3DD8BD9-6141-44A1-AA82-5A2C78042209

 

Hint: You can find references to XojoScripts which make use of this function by sending the following SQL statement to the database:

Select id,GUID, ScriptName,ScriptCode from im_scripts where ScriptCode Like '%FileAddToFilebox%'

 

Example XojoScript:

 

// Start Word and create a new template based document

Dim template As String = "imSeminarInvoice.doc"

 

Dim p1 As String = FileNew(template, "newinvoice.doc")

If p1 <> "" Then

Dim p2 As String

p2 = FileAddToFilebox("imFB_lnk_p04_Files",p1)

If p2 <> "" Then

Call FileLaunch(p2)  // Open File in Word

Else

MsgBox("Invoice file could not be added to Filebox!")

Return

End If

Else

MsgBox("Copy of template file failed!")

Return

End If