Product Logo

FTPit Pro

Transfer files to and from an FTP server


Coding Considerations

Getting Results

Every time you use an FTPit Pro function, status text is returned back from the plug-in. This information can be very useful like letting you know if an error occurred. Consider the following code:

FTPit_Connect( “MyFTPServer”)

The above code will connect to the FTP Server specified in the “MyFTPServer” account. If it is successful, the plug-in will return:

Connected to Account: MyFTPServer (ftp.mydomain.com)

However, if there was an error connecting to the FTP Server, the plug-in will return something like:

ERROR: Connect: Could not connect: Connect: Could not resolve Host Name to IP Address. WinSock Error: 11004; No Data.

Curly Brackets

Curly brackets indicate that a parameter or parameters are optional. Take the FTPit_GetLocalListCount function for example:

FTPit_GetLocalListCount{( Wildcard )}

This function can be called without any parameters because the “Wildcard” entire parameter section (what is inside the parenthesis) is surrounded by curly brackets indicating that is it optional. Using the function in this manner looks like:

FTPit_GetLocalListCount

The above code returns the number of files and folders in the current local directory. However, if you only wanted to know how many files in the current directory had a “txt” extension, you can specify the optional Wildcard parameter:

FTPit_GetLocalListCount( “*.txt” )

In more complex functions, there may be multiple optional parameters. Note that if there are optional parameters before one that you need to use, you must include any parameters before it. Consider the FTPit_StatusWindow function:

FTPit_StatusWindow( Action {; Left {; Top {; WindowTitle {; WindowText }}}} )

If you want to specify the “WindowTitle” parameter, you must also specify the two optional parameters before it. Following is an incorrect example and a correct example:

INCORRECT: FTPit_StatusWindow( “Show” ; “My Window Title” )
CORRECT: FTPit_StatusWindow( “Show” ; “” ; “” ; “My Window Title” )

FileMaker Version Considerations

When plug-ins were first introduced, the only place you really wanted to use a plug-in function was the Set Field script step. However, since FileMaker 4, many new advancements have taken place. Though the Set Field script step is still a very common place to use plug-in functions, there are now many places that can logically be used. For a list of a few of these places, see the next section titled “Places to use FTPit Pro Functions”.

It is important to keep in mind what versions of FileMaker will be in use when using FTPit Pro and other plug-ins. For example, creating a variable using the Set Variable script step can be very convenient, however, that functionality only exists in FileMaker 8 and greater. If you or your users use FileMaker 7, then your script calls would fall on deaf ears if you used Set Variable script step. In addition, when using functions in a variable you will be less likely to see the results returned from the plug-in (such as error messages), because a variable cannot but put on a layout like a field.

Places to use FTPit Pro Functions

You can use FTPit Pro functions in any calculation engine dialog in FileMaker. Keep in mind that just because you can do something does not mean it is actually useful.

There are several places that fit very well depending on the situation:

  • Calculation field
  • Auto-Enter Calculated value
  • Validation by calculation
  • Set Field Script/Button step
  • Insert Calculated Result Script/Button step
  • Show Custom Dialog
  • Set Variable Script/Button Step
  • Custom Functions
  • and more…