Help with alias

Hi there. I’m a newbie to Applescript though I’ve managed a few simple, successful ones, based largly upon the help I’ve received digging though old post on this site.

I’m currently working on a script that will take a set of text files in a folder (and in folders within that folder) and import them into an existing Filemaker database. I know how to get a list of the files from the finder and I know how to tell Filemaker to run the import script. The piece that I’m not sure of is how to get Filemaker to understand the list of files. I gather (from reading other people’s scripts posted here) that what I need to do is to set the list of files to an alias. What I don’t get is what “set to alias” actually does. I’m hesitant to post the code I’m working on because I don’t want someone to just fix it for me. What I’m looking for is an explaination of this command so I can actually understand my own code.

Can anyone please point me to tutorial that would explain this? My searches haven’t been helpful.

Thanks!

Can you post the relevant portion of code that deals with FileMaker importing the records? There are two ways I can think to do this
and depending on which your choosing depends on how you do the rest. In terms of worrying people are just going to post a solution I wouldn’t worry much since you spelled it out that that is not what you are looking for.

Hi, scriptbug.

There are several different ways of referring to files and folders and their locations, which can be useful under different circumstances. The two standard ways used by the AppleScript language are the “alias” and the “file specification”. These can both refer to files, folders, or volumes. They look very similar on the page, but their compiled data are different.

Alias:
alias “My HD:Users:me:Desktop:My file.txt”

This is understood (or should be) by scripts, OSAXen, and scriptable applications alike. The item must exist when the alias is created, otherwise an error will occur. (In the above form, the alias is created when the script’s compiled.) If the item’s subsequently moved, the alias will track it.

File specification:
file “My HD:Users:me:Desktop:My file.txt”

This should also be universally understandable. Although the keyword ‘file’ is used, it can also refer to a folder or a disk. The item needn’t exist when the file specification is created. If the item does exist and is moved, the file specification will still point to the original location, not to the moved item.

There are also “paths”. HFS paths look similar to aliases and file specifications; but paths are just text. However, they’re increasingly recognised and interpreted as file references nowadays by many functions and applications.

HFS path:
“My HD:Users:me:Desktop:My file.txt”
– No ‘alias’ or ‘file’ keyword. This is the standard Mac OS path format.

POSIX path:
“/Users/me/Desktop/My file.txt”
– This is the Unix path format, for use in shell scripts and with certain non-standard applications.

Some applications have their own reference forms for disk items, notably the Finder and System Events. Unfortunately, only they understand their own references, although they also understand aliases, file specifications, and (usually) HFS paths. The Finder reference for the above file could be written in a number of ways:

file “My file.txt” of desktop
file “Desktop:My file.txt” of home
file “Users:me:Desktop:My file.txt” of startup disk
file “My HD:Users:me:Desktop:My file.txt”
– Inside a Finder ‘tell’ block, this is a Finder reference, not a file specification.
Etc.

If “My file.txt” were a folder instead of a file, you’d have to use folder instead of file in the Finder reference. Alternatively, you could use the non-specific item in place of either of these.

Writing as alias after a Finder reference causes the Finder to return an alias instead of one of its own references. This alias can be understood and used by another application or by something else in the script.