* Convert File Links error message

Homeless Posts from the old forum system
avatar
mchance
Diamond
Posts: 63
Joined: 18 Jun 2003 00:32
Family Historian: V6.2
Location: France
Contact:

Convert File Links error message

Post by mchance » 18 Dec 2011 23:38

I've tried to run the Convert File Links plugin but keep getting the error message:
'Convert File Links.fh_lua:175: attempt to call global 'fhGetItemText' (a nil value). No changes have been made to data records.'
I am using Windows XP on a Macbook Pro via Parallels. My GEDCOM files are all in my documents folder on the Mac. Has this something to do with the error message? If so, is there a solution?
Thanks
Michael

ID:5664

User avatar
RogerF
Famous
Posts: 182
Joined: 26 Apr 2009 16:32
Family Historian: V6.2
Location: Oxfordshire, England
Contact:

Convert File Links error message

Post by RogerF » 19 Dec 2011 06:59

In 5.0.0.3 the fhGetItemText() function has been removed and replaced by fhGetDisplayText() - see near the end of http://www.fhug.org.uk/cgi-bin/index.cg ... y&num=5189. However, there appear to be some issues with this new function at the moment, and a fix is expected in 5.0.0.4. In the meantime, you could try editing the plugin to change 'fhGetItemText' to 'fhGetDisplayText'.

User avatar
Jane
Site Admin
Posts: 8440
Joined: 01 Nov 2002 15:00
Family Historian: V7
Location: Somerset, England
Contact:

Convert File Links error message

Post by Jane » 19 Dec 2011 08:18

Michael, I think it needs a few more changes that that as fhGetDisplayText does not return the values correctly at the moment, I will fix it and post a new version later today.

avatar
mchance
Diamond
Posts: 63
Joined: 18 Jun 2003 00:32
Family Historian: V6.2
Location: France
Contact:

Convert File Links error message

Post by mchance » 19 Dec 2011 08:20

Thank you Jane. I look forward to the updated file.

User avatar
Jane
Site Admin
Posts: 8440
Joined: 01 Nov 2002 15:00
Family Historian: V7
Location: Somerset, England
Contact:

Convert File Links error message

Post by Jane » 19 Dec 2011 16:18

This should all be updated now. I had a problem with one png file on my system, but opening it in Irfanview and re saving it fixed the problem, so I suspect it was a 'non-standard' or slightly damaged file.

avatar
mchance
Diamond
Posts: 63
Joined: 18 Jun 2003 00:32
Family Historian: V6.2
Location: France
Contact:

Convert File Links error message

Post by mchance » 19 Dec 2011 20:06

Hi. I've just run the updated plug-in but now get a different error message:
lua5/im_process.lua:158: bad argument #2 to 'ProcessCrop' (destiny image size must be smaller than source image height-ymin).
What does that mean?

User avatar
Jane
Site Admin
Posts: 8440
Joined: 01 Nov 2002 15:00
Family Historian: V7
Location: Somerset, England
Contact:

Convert File Links error message

Post by Jane » 19 Dec 2011 20:51

I suspect it's to do with frames touching the edge of the photo, I am still looking in to it, if you check the image which it stopped on do any of the frames touch the right edge or the bottom? If so if you move it in does the problem go away.

avatar
mchance
Diamond
Posts: 63
Joined: 18 Jun 2003 00:32
Family Historian: V6.2
Location: France
Contact:

Convert File Links error message

Post by mchance » 19 Dec 2011 21:59

How do I find out which image it stopped on? And how do I check the frames?

User avatar
Jane
Site Admin
Posts: 8440
Joined: 01 Nov 2002 15:00
Family Historian: V7
Location: Somerset, England
Contact:

Convert File Links error message

Post by Jane » 20 Dec 2011 08:05

If you watch the progress bar, then you should be able to see which one it stopped on.

To find the culprit frame just use the Media window to look at the boxes around the people in the photograph.

avatar
mchance
Diamond
Posts: 63
Joined: 18 Jun 2003 00:32
Family Historian: V6.2
Location: France
Contact:

Convert File Links error message

Post by mchance » 22 Dec 2011 10:47

Hi Jane
You were right. I've altered some of the frames & it has converted correctly. However I'm now having trouble displaying the photos in Family Tree Maker for Mac. I've altered the file paths so it will link up properly but the program says it still can't find the file. If I manually find it, it displays, but it refuses to do it automatically. As I have rather a lot of photos it's not practical to do it individually. I also noticed (at least with one photo) that the link was to the whole photo (a group one) & not to the cut-out head & shoulders as it should be. I don't know if this is a problem with Family Tree Maker or the plug-in. I'll have to wait until after Christmas now to make some more investigations. Meanwhile if you have any suggestions, please let me know.
Kind regards
Michael

User avatar
Jane
Site Admin
Posts: 8440
Joined: 01 Nov 2002 15:00
Family Historian: V7
Location: Somerset, England
Contact:

Convert File Links error message

Post by Jane » 22 Dec 2011 10:51

Michael, please can you try the current version, I think I have now fixed the frames and possibly the linking issue.

I don't know much about the Mac, but I suspect you might need to do a replace on the text file to take out the PC backslashes and the c: bit before you import them.

avatar
mchance
Diamond
Posts: 63
Joined: 18 Jun 2003 00:32
Family Historian: V6.2
Location: France
Contact:

Convert File Links error message

Post by mchance » 22 Dec 2011 12:41

Jane. I've managed to solve the displaying of photos. You were right. I hadn't replaced the Windows backslash with the Mac one. I've run the updated plug-in but still have a problem with frames near the edge of the photo. There are not nearly as many as the last time, but enough to make it frustrating. The progress bar goes so quickly that it's very difficult to work out which picture it stops at. Also, now I have managed to display the photos in Family Tree Maker, I can see that not all photos are cut-outs. Some people show the whole photograph even though I have linked them with a frame. It's not everyone though. Any thoughts?
Michael

User avatar
Jane
Site Admin
Posts: 8440
Joined: 01 Nov 2002 15:00
Family Historian: V7
Location: Somerset, England
Contact:

Convert File Links error message

Post by Jane » 22 Dec 2011 12:48

Could you add a line to the code as follows

print(image,x1,x2,ya,yb)

just before the line:

new_image = im.ProcessCropNew(image, x1, x2, ya, yb)

If you then run the program from the editor you should be able to see the last attempted file before it failed and the crop values.

avatar
mchance
Diamond
Posts: 63
Joined: 18 Jun 2003 00:32
Family Historian: V6.2
Location: France
Contact:

Convert File Links error message

Post by mchance » 22 Dec 2011 18:13

Right. I've done that & can now see which images cause the error. What do I do about some images not being the cut-outs though?

User avatar
Jane
Site Admin
Posts: 8440
Joined: 01 Nov 2002 15:00
Family Historian: V7
Location: Somerset, England
Contact:

Convert File Links error message

Post by Jane » 22 Dec 2011 23:37

If you can see a pattern to the ones which are not working I can try and work out why they are failing.

avatar
mchance
Diamond
Posts: 63
Joined: 18 Jun 2003 00:32
Family Historian: V6.2
Location: France
Contact:

Convert File Links error message

Post by mchance » 15 Jan 2012 15:22

Hello Jane
Now Christmas & New Year are over I can get back to looking at this problem. The updated file made a big difference & although there are still a handful of photographs which get error messages. I also have some sound files (.wav), all of which get error messages (presumably because they are not photos). It doesn't affect the file but it is a bit tedious having to click 'ok' for each one, particularly as I get the same message twice for each sound file. Is there a way of ignoring these files so the error message doesn't appear?

I've looked at the file to see if there is a pattern to the ones which don't produce a 'cut-out' picture, but I'm afraid I can't see one. Would it help if I sent the file to you? If so, what is the best way to send it as it's a very large file?

Many thanks

Michael

User avatar
tatewise
Megastar
Posts: 27078
Joined: 25 May 2010 11:00
Family Historian: V7
Location: Torbay, Devon, UK
Contact:

Convert File Links error message

Post by tatewise » 15 Apr 2012 17:25

I ran Convert File Links V1.2 on the Family Historian Sample Project and guess what?
Some frame cut-outs with Anthony Edward MUNRO [1] on the Focus Window are NOT cut-out!!!

The problem appears to be due to a rogue statement near the end of Stage One Process All Attached Images which should be removed:
ProcessImageFile(strFileName,outFile,nil,nil,nil,nil,200,200)

This statement always overwrites the last image found in the Multimedia Record, that may be a correctly cut-out image, with an uncropped full image!

Also the Progress Bar button to Cancel is partly off the bottom of the window.
This is fixed by replacing the statement:
dlgProgress.size = 'QUARTERxEIGHTH'
with
dlgProgress.size = 'QUARTER'

avatar
mchance
Diamond
Posts: 63
Joined: 18 Jun 2003 00:32
Family Historian: V6.2
Location: France
Contact:

Convert File Links error message

Post by mchance » 15 Apr 2012 18:12

I've done as you suggested & that has certainly cured the cut-out problem. However I still get the warning about the frames being too near the edge of the photo. I've tried moving the frame as I did last time, but I still get the error message. Any ideas?

User avatar
tatewise
Megastar
Posts: 27078
Joined: 25 May 2010 11:00
Family Historian: V7
Location: Torbay, Devon, UK
Contact:

Convert File Links error message

Post by tatewise » 15 Apr 2012 20:56

Here are my ideas.

(1) Frames too near edge problem
In the function ProcessImageFile on about 25th line replace 0 with 1 as follows:
     if ya < 0 then ya = 0 end
     if yb < 0 then yb = 0 end

with:
     if ya < 0 then ya = 1 end
     if yb < 0 then yb = 1 end

(2) Audio/Video files problem
In the Stage One Process All Attached Images section try following:

Just before
     while ptrField:IsNotNull() do

insert:
     strFormat = string.lower(strForm)
     for i, strType in ipairs({'avi','mid','midi','mpeg','mpg','rmi','wav'}) do
           if string.match(strFormat,strType) then strFormat = nil end
     end

Inside while loop replace:
           ProcessImageFile(strFileName,outFile,tonumber(a),tonumber(b),tonumber(c),tonumber(d),200,200)

with:
           if strFormat then
                 ProcessImageFile(strFileName,outFile,tonumber(a),tonumber(b),tonumber(c),tonumber(d),200,200)
           else -- Audio/Video file
                 local fileSource = assert(io.open(strFileName,'rb'))
                 local fileTarget = assert(io.open(outFile,'wb'))
                 fileTarget:write(fileSource:read('*all'))                        -- Copy entire file contents
                 assert(fileSource:close())
                 assert(fileTarget:close())
           end

Just after end of while loop (where rogue statement was removed) and just above:
     tblFileList[rcdId..'-0'] = {recordId=rcdID,asid='0',filename=outFile,form=strForm,title=strTitle}

insert:
     outFile = exportFolder..'O'..rcdId..'-0-'..name
     if strFormat then ProcessImageFile(strFileName,outFile,nil,nil,nil,nil,200,200) end

avatar
mchance
Diamond
Posts: 63
Joined: 18 Jun 2003 00:32
Family Historian: V6.2
Location: France
Contact:

Convert File Links error message

Post by mchance » 16 Apr 2012 12:25

Hi Mike

I made the changes as you suggested but still get the same error message re frame too near edge. Now what?

Michael

User avatar
tatewise
Megastar
Posts: 27078
Joined: 25 May 2010 11:00
Family Historian: V7
Location: Torbay, Devon, UK
Contact:

Convert File Links error message

Post by tatewise » 16 Apr 2012 13:43

In the two lines identified above, I now realise they should have been:
    if ya < 1 then ya = 1 end
    if yb < 1 then yb = 1 end

I am away from my home PC so cannot access FH V5 just now, but plan to add some better error reporting diagnostics to get to the bottom of this problem.

I presume the Audio/Video files .wav problem is fixed.

avatar
mchance
Diamond
Posts: 63
Joined: 18 Jun 2003 00:32
Family Historian: V6.2
Location: France
Contact:

Convert File Links error message

Post by mchance » 16 Apr 2012 14:13

Hi Mike

Sorry, but still get the same error. It hasn't got as far as the .wav files so don't know of that's fixed or not. There is a pdf file which gets the 'won't load' error message.

Thanks

Michael

User avatar
tatewise
Megastar
Posts: 27078
Joined: 25 May 2010 11:00
Family Historian: V7
Location: Torbay, Devon, UK
Contact:

Convert File Links error message

Post by tatewise » 16 Apr 2012 23:57

Here are the diagnostic and other changes.

In the function ProcessImageFile change the following:

Just above comment:
   -- Full image copy no Crops

insert:
     local w=image:Width()
     local h=image:Height()
     local X1=x1 or 0
     local X2=x2 or 0
     local Y1=y1 or 0
     local Y2=y2 or 0

Replace:
     new_image = im.ProcessCropNew(image, x1, x2, ya, yb)

with:
     isOK, new_image = pcall(im.ProcessCropNew, image, x1, x2, ya, yb)
     if not isOK then
           fhMessageBox('Process Crop ErrornnImage File: '..orgfile..'nnImage _AREA {'..Y1..','..X1..','..Y2..','..X2..'}nn'..new_image..'nnArgs  #2: '..x1..'  #3: '..x2..'  #4: '..ya..'  #5: '..yb..'  width: '..w..'  height: '..h)
           return
     end

The above should produce diagnostic details of the image and all appropriate parameters to find the problem.

Replace the code inserted yesterday with:
     strFormat = string.lower(strForm)
     for i, strType in ipairs({'jpg','jpeg','gif','png','tif','tiff','bmp','pcx','tga','wmf'}) do
           if string.match(strFormat,strType) then strFormat = 'Image' break end
     end

and change both tests of strFormat to:
     if strFormat == 'Image' then

This should fix the non-image files such as PDF, DOC, WAV, etc...

avatar
mchance
Diamond
Posts: 63
Joined: 18 Jun 2003 00:32
Family Historian: V6.2
Location: France
Contact:

Convert File Links error message

Post by mchance » 17 Apr 2012 10:02

Hi Mike

Brilliant! That's sorted everything. Thank you so much for all your help. I wouldn't have had a clue where to start!

Best Wishes

Michael

User avatar
tatewise
Megastar
Posts: 27078
Joined: 25 May 2010 11:00
Family Historian: V7
Location: Torbay, Devon, UK
Contact:

Convert File Links error message

Post by tatewise » 17 Apr 2012 10:10

What was the problem???
Is it something the Plugin could fix for itself???

Locked