Re: A bug (was Re: make new folder)-- not a bug!
Re: A bug (was Re: make new folder)-- not a bug!
- Subject: Re: A bug (was Re: make new folder)-- not a bug!
- From: deivy petrescu <email@hidden>
- Date: Tue, 3 Jun 2008 10:06:27 -0400
On Jun 2, 2008, at 11:07, deivy petrescu wrote:
On Jun 2, 2008, at 9:18, Luther Fuller wrote:
Thanks for all your comments. I got the script to work late last
night. I eliminated the problem by not using variables created in
System Events within Finder and vv. The problem is that the folder
"background" is invisible and only System Events can handle it.
So ...
tell application "System Events"
if (exists folder "background" of container of pictFile) then
set visible of (folder "background" of container of pictFile) to
true
end if
end tell
tell application "Finder"
-- move files into or outof background folder
-- and other stuff
end tell
do shell script "chflags hidden " & hiddenPath
tell application "Finder" to open window of folderRef
Now, I still have one more odd little problem. See new thread.
I was looking into this when I stumble in something I'd call a big
bug.
I was looking for a way to dissociate hFolder and System Events. I
found a way, but in the process I got something really bad...
The work around for the problem above, assuming background is visible:
<script>
set aaa to POSIX file "/Users/deivy/Desktop/testanu.txt" as file
specification
tell application "System Events"
set hFolder to folder "/Users/deivy/Desktop/background/"
set hFolder to (POSIX path of hFolder)
end tell
set hFolder to POSIX file hFolder
tell application "Finder" to move aaa to alias hFolder
</script>
So make hFolder into posix path inside the tell System events
and make hFolder posix file hFolder outside the tell System Events
block.
This is Fine. However, look at the path of hFolder, now instead of
set hFolder to POSIX file hFolder
write
set hFolder to hFolder as file specification
Check the path you get.
Compare it to the first line (set aaa to...).
This is really weird and very bad, who called SE into the picture?
Deivy
I further checked the behavior of "file specification" and I was
wrong. There is no bug!
I checked in other machines running 10.4.11 and the same consistent
behavior happens there.
So, if it is a feature it is not documented.
"" as file specification return the path to the application's
"Contents:MacOS" folder.
In my case, it is either SE or Smile.
"file specification" always return the HFS path. If you use an HFS
path then the path sticks and you get what you are shooting for,
otherwise it gets the folder above.
I, for one, was not aware of that.
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