Can't make alias x into type specifier


(Ed Stockly) #1

Well, this is odd. I’ve got my sound file syncing script working just about working, but I’m getting a frequent error when copying:

Finder got an error Can’t make alias x into type specifier


System Events got an error Can’t make alias x into type specifier

Alias x is a pointer to an alias to be copied to a directory on the server.

(Mark Alldritt) #2

How are you trying to do this?. You generally need to specify an object:

set myAlias to alias "path-to-file"
tell application "Finder"
    set theObject to file myAlias

(Jim Underwood) #3

I know Mark knows all of this inside-out, but for those of us, like me, who are path-challenged, I put this together to clarify and reinforce my memory of how paths work:

###AppleScript Paths

## REF:

set myHFSpath to "Macintosh HD:Users:YourUserName:Documents:A Real File.txt"

# OR
set myPOSIXPath to "/Users/YourUserName/Documents/A Real File.txt"
set myHFSpath to POSIX file myPOSIXPath

set myAlias to alias myHFSpath

tell application "Finder"
  set myFinderObj to file myAlias
end tell

And, of course, Script Debugger does a great job of showing us the results:
###SD6 Results Panel

This has helped me, and if it helps only one other person, then it will have been worthwhile. :wink:

(Ed Stockly) #4

OK, this was very odd. The script was working with aliases. An alias to a file (generated from an Entire Contents ASObjC command) copied to a directory on a remove volume.

The script was working in a directory with 1800+ files. It would process about 50 files, then generate that error for every file after.

I switched it to System Events and same error. I switched it back to finder and the errors went away.

No other changes to the script (and I verified that the correct number of files were copied)

All that said, I had been trying to run an SD log in order to see the results, etc. But it seems the log no longer has the option to generate the output in a form like Script Editor anymore. Instead of the log telling the story of which events are sent and what the results are, I get these encapsulated lines with little information.

I very rarely use the logs, so it may have been this way for a long time.

I prefer the SE log. In fact I pasted the script into SE and ran it from there just for the logs.

(Jim Underwood) #5

Yep, I too prefer the SE log.

I complained about the SD6 log format during the original Beta, but I was chastised for even thinking of using the log view with SD. I was told to use the Results panel instead. No one seemed to understand my use case of output of results while the script is running in a loop.

Just to be clear, my use case for the log is NOT debugging or exploring. It is for documenting the results of a script as it is running. Yes, I know there are other ways, but SE makes this very easy and provides a very readable output.

(Shane Stanley) #6

The current Event Log is basically unchanged since version 5. I think it’s fair to say that it’s had both fans and detractors. What I’d love to hear is suggestions for how it could be improved.

Now before you say “do as SE”, understand that that would risk throwing out the baby with the bathwater. There are several things you can do with the existing format you simply can’t do with the SE style: filtering by target, changing style on the fly, looking for performance bottlenecks, and most importantly, being able to use an explorer to examine any event result.

So what I’d like to hear are suggestions for improving what we have. Or perhaps tell us what you miss that SE provides.

(Ed Stockly) #7

This is probably the only time I’ve tried to use the log since then. I may have been one of the users suggesting using the result window instead.

The way I want to use the log is tell the story of what’s happening when the script is run.

So each command sending an apple event should be included; the application’s response.

Way back in time there was one app (scripter? Script Editor? Script Debugger?) that did a neat trick.

It would include the script as written.
After each line that sent an appleEvent the app logged the apple event following a comment:

set myList to {}
tell application "Finder" to get selection as alias list
-->Finder--> get selection 
-->>{alias "Macintosh HD:Users:user:AutoDownloading x:CCI Newsgate Files:lati_fri_dlytalk0623.html"}

At the very least we should be able to see a collection of events and replies as a continuous text string and be able to copy and paste as text