Re: Creating unique numerical representation of file path?
Re: Creating unique numerical representation of file path?
- Subject: Re: Creating unique numerical representation of file path?
- From: deivy petrescu <email@hidden>
- Date: Sat, 13 Oct 2007 13:09:20 -0400
On Oct 13, 2007, at 1:33, Richard Rönnbäck wrote:
I am working on a project where I prepare text files for import into
FileMaker Pro. The text files contain various fields but the idea
is to use
the file path act as the matching field on import.
The problem is that FileMaker's matching mechanism has a limit of
something
like 120 characters, which means that file paths longer than that are
inaccurately matched and imported into the wrong records, and even
into
multiple records
I know how to work around this issue by using scripts and loops and
external
comparisons, but the problem is performance, the import files may
contain up
to 50,000 records and may be imported up to 50 times a day.
A second related consequence of FM's limit is when creating
relations, so I
would need such a short representation for that reason too.
So now I wonder if it would be possible to create a unique numerical
representation of a file path, that would be shorter than the file
path
itself, but as my mathematical skills are far to basic I am hoping
to get
input from someone with better knowledge of math than me.
So, how can I turn something like this:
/Some/Very/Long/POSIX/Path/
into a shorter number like this
1234
And be absolutely sure that no other path/sequence of characters
could get
the same number?
Well, there is and there isn't!
But I am sure there use to be.
The following script will return an unique id ( I assume).
tell application "System Events" to get id of (item "/path/to/file")
set r to result
However, after you get the id, you can not really retrieve the file.
The "result r" is supposed to be an Unicode text but I get a list of
the form
{-100, xxxxxxx}
where the x are digits.
I can not coerce it back to Unicode.
I believe this is a bug, but I am not sure.
Deivy
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden