[comp.sys.mac.hypercard] XFCN to change file type and creator?

johnston@oscar.ccm.udel.edu (Bill Johnston) (03/31/91)

Hyperpeople!  I am looking for an external that can set the file and
creator attributes of a file.  I have tried using  Larry Wolfarth's 
"ChangeFileType" xfcn from the "Developer Stack v.1.3", but am having 
trouble getting it to work from within a script.

This works when typed into the message box:

ChangeFileType("HD40:TempFolder:foo.txt", TEXT, ALFA)

"NoError: File TYPE/Creator changed" is put into the message box,
and the file type and creator are properly set.

If the same thing is put into a button script:

on mouseUp
  ChangeFileType("HD40:TempFolder:foo.txt", TEXT, ALFA)
end mouseUp

the script fails with "Expected ")" but found ",".

What am I doing wrong?  Is there another external that will do the job?
I am trying to create a stack that will do batch operations on text
files -- everything else works except this!

If the topic is of interest to others, I'll summarize.

-- Bill Johnston (johnston@oscar.ccm.udel.edu)
-- 38 Chambers St.; Newark, DE 19711; (302)368-1949 

johnston@oscar.ccm.udel.edu (William D. Johnston) (04/01/91)

My novice question:  why doesn't this script work?

>on mouseUp
>  ChangeFileType("HD40:TempFolder:foo.txt", TEXT, ALFA)
>end mouseUp

The answer:  ChangeFileType is an XFCN, not an XCMD.  It must be
invoked with "get" or "put".  "get ChangeFileType(arg1,arg2,arg3)
works file.  Thanks to Chris Stluka and others for helpful suggestions.

-- Bill Johnston (johnston@oscar.ccm.udel.edu)