Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 3619 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

FILEMAKER PRO 11 - I need to find if a a video file exist before proceeding to the next step. I did not find such a function. However, I think I am about to find a work around.

I have too many video files which are to big to be imported within FileMaker Pro. Instead, I store there reference to the file in the container.

When I browse the table, the following message "The file cannot be found:" followed by the name of the file is inserted in the cell instead of a thumbnail. I've added a get(LastError) statement after the commit. It does not work. Is there a get function within FIleMaker Pro which would returned the value "The file cannot be found:". I would then add an if statement to perform the proper action.

With regards!

Daniel

Posted

You could do a send events to the cmd  and create a text file with a list of that directory like this..  

 

cmd  /c dir *.* > test1.txt

 

then open in web viewer and check for your file name

Posted

Thanks for the information, however I need to stay within the FileMaker Pro script.

Posted

What "no_access" describes would all work within one FM script...

 

You can also use the "insert file" script step to insert into a global container.  If it errors out, the file is not there.

Posted

Thanks Wim for the information.

Unfortunately, I cannot insert the file within FileMaker Pro. Importing video file takes way too long, as I, often, have situation within a day, where 20 video files (600mb each) needs to be ready within a minute the script is executed.

At the beginning those video files are transferred for a SDHC card to a specific folder on a server. The next step is to execute script which scan dedicated folders to store the reference in a table.

The solution I have to implement must be VERY quick to proceed and not increase physical space of the DBMS. Time and space is something I absolutely have to control. The video files are not use within an inventory system but are copied and burn on DVD using Toast titanium.

If FileMaker Pro display the error message "The file cannot be found", why I would not be able to make a

Set Variable [$abcd; Value: get (something)]

where something is a function which would return the value "The file cannot be found...". I would hope there is such a command within FileMaker Pro.

With regards!

Daniel

Posted

Again, my comment should do very well for you as you do not need to load anything, just a text file in the webviewer., of course you need the mac version of  cmd  /c dir *.* > test1.txt  I think the mac version is ls > test1.txt  and I think terminal is the equivalent to CMD on windows. and this should be very fast, I tested on my machine, it was simply a blink and it was done.

 

 

Posted

Time and space is something I absolutely have to control. 

 

Don't let that be heard in the wrong circles …  :frantics:

 

Kidding aside, AFAICT there is no native command to check on the existence of a referenced file in a container. I recommend the excellent (and free) BE plugin from Goya, which has FileExists(). Feed it a file path and you'll get a true or false result.

Posted

I think the mac version is ls > test1.txt  and I think terminal is the equivalent to CMD on windows

 

Actually, on a Mac you would use AppleScript and get the result directly without having to import anything.

 

 

If FileMaker Pro display the error message "The file cannot be found", why I would not be able to make a

Set Variable [$abcd; Value: get (something)]

where something is a function which would return the value "The file cannot be found...". I would hope there is such a command within FileMaker Pro.

 

Yes, that makes sense - unfortunately, that's not enough to make it true.... So you are left using either a plugin or OS-level scripting.

Posted

Thanks everybody for your help, this is REALLY appreciated.

 

At this moment, I've done the following and seems to work. There is only one problem.  When a file is not found a file browser dialog box appear and ask me to select one. Is there a way not to have to file browser dialog box to appear? 

 

 

Freeze Window

Set Variable [ $VideoPathName; Value:"/Data/ZVinformatique/CompétitionCourante/" ]

Go to Layout [ “@Produits” (Produits) ]

Show All Records

Perform Find [ Specified Find Requests: Find Records; Criteria: Produits::Status: “="Charger"” ][ Restore ]

If [ not Get(LastError) ]

  Go to Record/Request/Page [ First ]

  Loop

    Go to Field [ Produits::_Image ]

    Set Variable [ $FileToVerify; Value:$VideoPathName & Left ( Produits::PictNo ; 2 ) & "/M2U0" & Produits::PictNo & ".MPG" ]

    Set Error Capture [ On ]

    Insert File [ “$FileToVerify” ][ Reference ]

    If [ Get(LastError)>0 ]

       Show Custom Dialog [ Message: $FileToVerify & " not found"; Buttons: “OK”, “Cancel” ]

    End If

  Go to Record/Request/Page[ Next; Exit after last ]

  End Loop

End If

#

Go to Layout [ “@Produits” (Produits) ]

Show All Records

Posted

Ahm... OK. I didn't think this would work with "Store only a reference", but I was wrong - so here goes:

What you need here is a default file that would be used as an alternative when your real file is not found. Say you have a Default.png file located in the same folder as your .fp7 solution file. Then make your script like:

...
Set Variable [ $filePath; Value: << the path to the real file >> ]
Set Variable [ $altPath; Value:"file:Default.png" ]
Insert File [ YourTable::gContainer; “$filePath” OR “$altPath” ] [ Reference ]
If [ GetValue ( YourTable::gContainer ; 1 ) = $altPath ]
    Show Custom Dialog [ ... ]
End If
...

To get the OR, enter:

$filePath
$altPath

as the File Path List In the Insert File step.

 

 

---

Note that the default file could be anything you're certain exists at a known location - even the solution file itself.

Posted

Thanks again, I am unable to do this test at the moment. I will let you how it went.

 

with regards!

Posted

I am almost there. The Insert works perfectly.

 

The _image field contains the proper name file when it exist, and it contains "INTRO.PNG" when it does not.

 
For some reason which I cannot explain the If (get(value...) statement does not work. There must be something that I am missing with the syntax.
 
Thanks again for your help!

 

 

Freeze Window

Set Error Capture [ On ]

Set Variable [ $VideoPathName; Value:"/Data/ZVinformatique/CompétitionCourante/" ]

Set Variable [ $altPath; Value:"INTRO.PNG" ]

Go to Layout [ “@Produits” (Produits) ]

Show All Records

Perform Find [ Specified Find Requests: Find Records; Criteria: Produits::Status: “="Charger"” ][ Restore ]

If [ not Get(LastError) ]

   Go to Record/Request/Page [ First ]

   Loop

     Go to Field [ Produits::_Image ]

     Set Variable [ $filePath; Value:$VideoPathName & Left ( Produits::PictNo ; 2 ) & "/M2U0" & Produits::PictNo & ".MPG" ]

     Insert File [ Produits::_Image; “$filePath” OR “$altPath” ][ Reference ]

     If [ GetValue ( Produits::_Image ; 1) = $altPath ]

        Show Custom Dialog [ Message: $filePath & " not found"; Buttons: “OK”, “Cancel” ]

     Else

        Show Custom Dialog [ Message: $filePath & " found"; Buttons: “OK”, “Cancel” ]

     End If

    Go to Record/Request/Page [ Next; Exit after last ]

  End Loop

End If

#

Go to Layout [ “@Produits” (Produits) ]

Show All Records

Posted (edited)

The _image field contains the proper name file when it exist, and it contains "INTRO.PNG" when it does not.

 

Are you sure about this? Because when inserting a file "as reference", the container field should contain (as text) =

 

file:INTRO.png

filemac:/Macintosh HD/Users/YourUserName/Whatever/Folder/Structure/You/Have/INTRO.png

 

 

 

EDIT:

I also see that your $altPath value is missing the "file:" prefix - so that would explain why the comparison is never true.

Edited by comment
Posted

Thanks Comment.

 

"YOUPPI"

 

You are absolutely correct. The "file:" statement made the difference. It does now work perfectly.

 

With regards!

Daniel

Posted

To get the OR, enter:

$filePath
$altPath
as the File Path List In the Insert File step.

 

I seem to remember that you could obtain the same thing using the List function, something like:

Set Variable [ $filePath; Value: List ( << the path to the real file >> ; "file:Default.png" ) ]

but your code is more comprensible and clean.

  • 7 months later...
  • Newbies
Posted

Hi,

don't no about FM11 but in FM13 this test will return true for missing files:

GetContainerAttribute (<<the Path>> ; "fileSize") = "?"

  • 7 months later...
Posted

I am trying to use the Goya FileExists function to produce a boolean result.

I use my database on 2 machines and they are synced using sugarsync.

The point of the boolean calculation is to permit a button to be appear if a PDF file with a given name exists.

I am using the Get(DocumentsPath) to provide the first half of the path.

I get the feeling that the goya function is not recognising the syntax of the result of the Get(DocumentsPath) calculation.

Any ideas?

This topic is 3619 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.