Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

i have two fields

field 1 = image ( this is a container that holds a jpg )

field 2 = imagename ( this is a field that holders the name of the image )

when i insert an image into field 1 i would like it to automatically add the file name into field 2.

is this possible?

i tried to mess around with Get(fileName) - but i am super new with FMP

thanks

mix

Use the File:Import Records:Folder... command. This will allow you to specify filenames, etc. when importing images, movies or other media files.

  • Author

that doesn't work for me because i already have the records in the database. that would be great if i was starting the database from scratch. I want to be able to go through the database that i have set up and drop the images in and then get the file name to go into another field. Exactly what i said in my first post. Does anyone know how to do this. I am sure there is an easy way.

thanks,

mix

  • Author

i guess not many people visit this forum.

please i need help. seems like a simple problem.

is there a more popular forum for fmp?

I don't know if there's a way to do it quickly but you could try to work around by writing a script to export the field content to a dir, then import it in again w/.

You do not say what platform you're on. On a Mac you can use AppleScript to get this info, if the image was inserted as a reference only. On a PC I believe the ImageScan plug-in can get do it.

If it is embedded, not as a reference, I don't believe there is any way to get the "name," because it no longer has a file name. It's just a picture in a container field; like a picture on the clipboard, the picture's there, but it has no name.

If you're on a Mac, look at this thread:

http://www.fmforums.com/threads/showflat.php/Cat/0/Number/105161/Main/105161

In FM7, AppleScript isn't required, if the file is a reference:

GetAsText(container)

will provide all info about it. This could be helpful if you're using Windows, as their AppleScript support sucks. wink.gif

Sorry, didn't catch the FileMaker 7 in the profile of mixtus' first post.

  • Author

ok i used GetAsText(container)

that works but it gives me this......

"

size:75,75

image:client_images/quick.jpg

imagemac:/Macintosh HD/Users/me/Desktop/client_images/quick.jpg

"

this is really cool but all i want is the name quick.jpg

is there a way to do it without using apple script.

I am on osx // but it seems like something that could be solved in fmp7

thank you all for responding // I am evaluating the

trial version of fmp7 and this is something that will help

me decide if i want to use it.

The calculation:

RightWords( MiddleValues( GetAsText(container); 2; 1 ); 1 )

will pick out just the filename.

If the container field is named "Image":

Right ( GetAsText(Image);

Length ( GetAsText(Image) ) -

Position ( GetAsText(Image) ; "/" ; 1 ;

PatternCount ( GetAsText(Image); "/" )

)

)

One more thing, I just noticed... the calculation:

Length(container)

returns:

- empty, if the container is empty

- 0, if its a reference

- the image's size (in bytes?) if its stored internally.

So that also provides an easy way to tell when asking for the filename isn't going to work, since they image is stored inside the database.

If you decide to go with a < 7 version, here is an applescript that will give you the file name and a few other bits of info. Of course, you'll need to adjust the field names...

tell application "FileMaker Pro"

try

set TheImage to cell "Container" of current record

on error errMes

set cell "File Path" of current record to errMes

end try

try

set cell "File Path" of current record to TheImage as text

on error

set cell "File Path" of current record to "Image not stored as a reference"

set cell "File Size" of current record to ""

set cell "File Type" of current record to ""

return

end try

end tell

set FileInfo to (info for TheImage)

set theSize to (size of FileInfo) / 1048.567

tell application "FileMaker Pro"

set cell "File Name" of current record to name of FileInfo

set cell "File Type" of current record to file type of FileInfo

if theSize > 1000 then

set cell "File Size" of current record to ((((round (theSize / 10)) / 100)) as string & " MB") as string

else

set cell "File Size" of current record to ((round (theSize)) & " K") as string

end if

end tell

  • Author

shadow - thank you ---- thank you.

RightWords( MiddleValues( GetAsText(container); 2; 1 ); 1 )

very very

mixtus,

There's an "Execute SQL" script step that can talk to an ODBC data source. I've never actually tried it, but that seems like it should do the trick.

  • Author

i have been using RightWords( MiddleValues( GetAsText(image); 2; 1 ); 1 )

it seems that it is working sometimes yes - sometimes no.

sometimes if i import an image like "image08.jpg" all i get is "jpg".

other times it works correctly. i am not sure why this is happening.

any ideas?

Bother, the word break rule for "." - it is considered NOT to be a word break when between letters ("fm.com") or numbers (3.4), but it is when they're mixed.

Try this instead:


Let( imgName = RightWords( MiddleValues( GetAsText(con); 2; 1 ); 1 );

  If ( Position( imgName; "."; 1; 1 ); imgName;

       RightWords( MiddleValues( GetAsText(con); 2; 1 ); 2 )

  )

)

  • Author

hey shadow,

that works great- thanks for taking the time to write that.

is there any resources out there

for learning how to write these scripts.

I am pretty good at actionscripting and php, so i think i could pick it up.

thanks again

-mix

ok... so i take it, short of a plugin, there is no way to grab the filename in FM6 on a PC?!?!?

I got around checking the "store only a reference to the file", but i need to find a way to get the filename of the file... i mean, it has to be stored somewhere.. lol

Well, the FileMaker help is okay, and explains what all the functions do. I'm not really sure where I picked up my "how-to" knowledge anymore, since that was a while ago...

I think "Scriptology" is supposed to be pretty good, but I would wait until the FM7 version is released to buy it. Perhaps others might have some better ideas.

  • 2 weeks later...

Not if the file name contains a space or other word separator. I suggest:

RightValues(Substitute(MiddleValues(GetAsText(container); 2; 1); "/"; "[par]"); 1)

"[par]" should be the paragraph caracter par.gif. I guess it doesn't work within quotes (which seems silly because that's the only place it should be)

BTW, FM7 no longer requires the quotes for a single paragraph mark. True and False now exist as named constants also.

if u stick into a "quote"it will work smile.gif

RightValues(Substitute(MiddleValues(GetAsText(container); 2; 1); "/"; " par.gif"); 1)

Good Call on filenames and spaces....but for "reference security" I make my users imageName = unique,ItemID or something.

that way u have eg:

ImageName | ItemID

--------------------

ABC.jpg | ABC

vs.

my house.jpg | ABC

this iway I can also estimate the name of the image_file.jpg and compund it...warn users that they have not "Uploaded/added" the "right" image.

Anyhow, thanx for more input!

Take care

  • 1 month later...

This GetAsText function sounds really useful. Would it be possible to use GetAsText if the file that is put in the containerfield is not a picture but something else, let's say un unknown file type?

Yep. It will return the paths for any file inserted, if it's inserted as a reference (which kind of makes sense, 'cause it has to store the paths to know where it is). But not for totally embedded files.

  • 3 weeks later...

This is just what I needed, but it is cutting the file name short at an underscore character. Any advice on how to accomodate that?

Bother, the word break rule for "." - it is considered NOT to be a word break when between letters ("fm.com") or numbers (3.4), but it is when they're mixed.

Try this instead:


Let( imgName = RightWords( MiddleValues( GetAsText(con); 2; 1 ); 1 );

  If ( Position( imgName; "."; 1; 1 ); imgName;

       RightWords( MiddleValues( GetAsText(con); 2; 1 ); 2 )

  )

)

I would not use RightWords. Try this:

Let ( info = GetAsText(PictAsRef);

Right ( info; Length(info) - Position ( info ; "/" ; 1 ; PatternCount(info; "/") ))

)

That did it, thanks Fenton!

I have a different but similar inquiry... I am running FMPro7 on XP. I have a database that we have the images. Instead of saving all the images (DOH!)I have ~ 1500 images embedded as images in container fields. Now I can copy and paste into like Fireworks or something no problem. I am trying to export all the images... export them both as text (eg. productimage01.jpg) and to have Filemaker save the corresponding image file and in a certain specified folder (eg. images/productimage01.jpg).

HELP PLEASE smile.gif

Fenton & Shadow-

I see this thing you made... I have a similar need. My Field name is Image Large...

So, please, forgive me... but is this what we do...

1) Define a new field called save... 'imagename'

2) Set 'imagename' field to CALCULATION

3) define the calculation as:

Right ( GetAsText(Image Large);

Length ( GetAsText(Image Large) ) -

Position ( GetAsText(Image Large) ; "/" ; 1 ;

PatternCount ( GetAsText(Image Large); "/" )

)

)

And then Close... add field to my layout... and let it do it's thing??? That is what I did.. and I just get a '?'

If the container field is named "Image":

Right ( GetAsText(Image);

Length ( GetAsText(Image) ) -

Position ( GetAsText(Image) ; "/" ; 1 ;

PatternCount ( GetAsText(Image); "/" )

)

)

i also tried 'Image' for field and still it doesn't work... ack

The calculation only gets the "name" for an image which as been inserted "as a reference only." Such an image is still a file on the disk, hence has a name. A completed embedded image is just that, an image, no file on disk, hence no name, hence "?" is all you get.

Possibly Troi File plug-in can do this. I know ImageScan can:

http://www.powersolutions.it/en/insidescan.html

I haven't used it however, because on a Mac we can do with AppleScript (not that it's something you'd want to do often).

ah... so that stuff is MAC... ok... thanks... I'll give that Troi and ImageScan stuff a look...

I have FMP7 on a MAC too... would it simply work if I opened this XP file in there do you think? and if it were to... would I use that stuff as a calculation :

respects-

eric

omg... the manual for ImageScan is 116 pages... I didn't realize this can be such a difficult task...

Access to files

I still don't know if Troi can do it. Anyone? ImageScan explicitly says it can. And it has added features for renaming and moving files, so you would not need Troi also, for this task anyway.

Here's a quick example using AppleScript. It does however require a free Scripting Addition, GraphicsImporter, found at:

http://www.macscripter.net

It could probably also be done with just the Mac OS X built-in app Image Events. But life is too short to try it right now. GI can do it all in one step, though it seems to only be happy outputting JPEGs. This was done in FileMaker 6, but should work in 7:

tell application "FileMaker Pro"

activate

tell current record of document 1

set txtPath to cell "thePath"

set thePath to txtPath as file specification

set imageCell to cell "theImage"

set theImage to giconvert imageCell type "JPEG" image thePath

-- requires GraphicsImporter OSAX

-- set theImage to giconvert imageCell image thePath -- creates PICT file, huge

-- doesn't seem to work for "GIFf" or "PDF ", but will do them as JPEG

end tell

end tell

i'll try and load this up on the MAC and give it a try... thanks, man

Do you mean this???

Graphic Converter updates to 5.2

GraphicConverter is an excellent all-purpose image editing program that can import 175 different graphic-based formats, edit the image, and export it out of 75 file available file formats. The high-end editing tools are perfect for graphic manipulation as well as the ability to use Photoshop-compatible plug-ins. It offers batch-conversion capabilities, a slide show window, and so much more. A System 7.5 version is also available. Note: Version 4.5 was a paid upgrade for owners of previous versions. Once upgraded, you won't have to pay for another upgrade for the next 10 years, according to Lemke Software.

http://macscripter.net/news.php?id=4949_0_5_0_C

never mind... I found it.... http://osaxen.com/graphicsimporter.html

Remember that a regular Mac file path (as opposed to UNIX POSIX path) looks like this:

Macintosh HD:Users:fej:Documents:Documents_ll:Downloads:Candidate.zip

Where "fej" is the short user name. You can also get the Desktop for any user with:

set theDesk to (path to desktop) as string

In my case: "Macintosh HD:Users:fej:Desktop:"

And do go get the GraphicsImporter OSAX, Scripting Addition. It won't work without it.

Put it in a Scripting Additions folder in your user folder Library folder. Or put it in the System/Library/Scripting Additions.

i got the GI Scripting Addition al loaded and about to start tryin this thing... here goes somethin'...

Hi Fenton,

Help educate me once again.

frown.gif

I downloaded the upgrade of Graphic Converter and the AS Edition as you posted. However, when I insert your script my Sample file and Use the Script Step "Perform AppleScript" I'm getting this error

FileMaker Pro got an error: Object not found.

(Error -1728).

I know that it's something I'm not understanding. Maybe you can describe in simple terms what I need to do.

I have two fields.

Name (text)

Image (container)

I have the FM file on my Finder Level.

frown.gif

TIA

Lee

I would not use RightWords. Try this:

Let ( info = GetAsText(PictAsRef);

Right ( info; Length(info) - Position ( info ; "/" ; 1 ; PatternCount(info; "/") ))

)

Can you guys be so kind and walk me thru this???

I loaded this XP file onto my MAC w/ OS X and FMP7. i loaded the scripting addition... but, uh... now what? do I go into the Scripts menu and type this stuff... like NEW SCRIPT and then one of your scripts... but what happens with a scripts output then : It takes an awful long time. the file is ~ 250mb with ~ 1500 records.

You wrote this... I was wondering if you can lend a little insight. I see you are in SJ. i am local.

My drive and FMP seem like they are doing something but it's been nearly 2 hours now, which I think is probably ridiculous. This is an iMac (500mhz) w/ I think 512 RAM. not a dream machine, i know. I have 2 3ghz PCs. ACK... help

Thanks-

Eric

RightWords( MiddleValues( GetAsText(container); 2; 1 ); 1 )

http://www.fmforums.com/threads/showflat.php?Cat=0&Number=107071&an=0&page=0#107071

You are entering the "programming zone." It can be ugly (right now I'm trying to send/display CSS formatted HTML email with SMTPit, and can't get Eudora to display it how it should; and it has to work perfectly with MS Outlook; we all have our little problems).

First, for Lee. I never said Graphic Converter. I said GraphicsImporter OSAX, Scripting Addition, at:

http://osaxen.com/graphicsimporter.html

It is available the same for OS 9.

The big problem with getting images out of container fields is that they have to exist in "limbo," after coming out, before becoming a file. Only some programs can deal with this; the above GI OSAX, and the OS X app Image Events; perhaps others. Many graphic apps would let you transfer via the clipboard; copy in FileMaker, then get the clipboard. But that's indirect and a bit clunky.

"FileMaker Pro got an error: Object not found.

(Error -1728)"

This usually means just what it says. Either the field is not on the layout, or you're not on the layout, or there's no records, or some such glitch.

It's often best to test by pasting AppleScript into Script Editor first, surrounding it with:

tell application "FileMaker Pro"

script stuff

end tell

It's slower, but it will highlight the place where the error occurred. FileMaker just tells you the error, but not where it happened.

Then, when it works, copy/paste the inner script into FileMaker Perform AppleScript step, where it will run mucho faster.

Remix: I'm afraid you're "barking up the wrong tree." You CAN'T get the name of the FILE from an embedded container, 'cause there is no file; that's the nature of embedding that way.

You'll have to get the name (for the file you're going to create I assume from another FileMaker field. In my example AppleScript "thePath" would be the entire file path for the new file; which would have the new unique name at the end, but the rest would be a common folder path.

You might want to try this first on a test file, with just a few records. And, as I told Lee, run the AppleScript from Script Editor, until you're sure it works. It takes me a few tries (at least) to get these things to work. It's crazy to try on a large file. It's going to be slow even when it works right. It will run much faster in an AppleScript step; but wait 'til you're sure it works first. Look carefully at your filepaths, that's the mostly likely error point, once you have the GI OSAX in place.

Hmmm... I thought it could pull out the original file name... it doesn't need to be tho.

I am down to have anything. each record has a unique ID # and most also have model #s.

Again, what I need are the images exported w/ a unique filename and that name in text so I can link to it...

Remix: I'm afraid you're "barking up the wrong tree." You CAN'T get the name of the FILE from an embedded container, 'cause there is no file; that's the nature of embedding that way.

You'll have to get the name (for the file you're going to create I assume from another FileMaker field. In my example AppleScript "thePath" would be the entire file path for the new file; which would have the new unique name at the end, but the rest would be a common folder path.

You might want to try this first on a test file, with just a few records. And, as I told Lee, run the AppleScript from Script Editor, until you're sure it works. It takes me a few tries (at least) to get these things to work. It's crazy to try on a large file. It's going to be slow even when it works right. It will run much faster in an AppleScript step; but wait 'til you're sure it works first. Look carefully at your filepaths, that's the mostly likely error point, once you have the GI OSAX in place.

There is no original file name. When you completely embed a picture in that way, it's similar to copy/pasting. The receiving application keeps no record of where it came from.

So, you have unique names. Just create a calculation which will produce a valid filepath, to a folder you've created (as I said, the Desktop is the easiest place to start). If I have a NewImages folder on my desktop, the common folder path would look like:

"Macintosh HD:Users:fej:Desktop:NewImages:"

That can go into a Text global field.

Add on whatever name you want for your picture. It's probably best to do this in a FileMaker calculation first, so you can see the result on a layout.

The final result could be grabbed by AppleScript as that "cell" (see my AppleScript).

I could work up a little example I suppose. I'm kind of behind here, writing a FileMaker email solution, hence not excruciating helpful :-|

thanks for the input, yet again... i'll tackle this now, while it is cooler

good luck with your email thing, you've been a big help... hopefully I won't need you to write it... but... ya never know. smile.gif I'm down to even just export while I am on my PC w/ on of those plug ins... and do the names on the MAC... I think it can do that... although not ideal.

Here's an example file of sorts. You MUST have a folder named "NewImages" on your Desktop; or whatever name you put in the FileMaker file's "folderName" field (or a folder path).

ExportContainer.zip

ON A MISSION!

Basically want I NEED this to do is I suppose...

Select 'Image' container field

Copy 'Image' to Clipboard

Open a program, say Fireworks

paste 'Image' in Fireworks

save as [unique filemaker record#].jpg

close fireworks file (not Firework program)

add [unique Filemaker record#].jpg filename to a field in Filemaker so program can reference file... in my case, say "proaudioimages/"

Note: I no longer have the images saved on my drive (don't even ask)... that's why I need to find a way to export these images.

Maybe this will help a little more...

screenshot057.jpg

screenshot058.jpg

What would it take for someone to like handle this for me?? you know... 1 record or 1,000 records... it's the same. Someone who has this down can surely do it with ease... this, I have found, is not me... but I'll keep trying

Create an account or sign in to comment

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.