Re: A bug (was Re: make new folder)
Re: A bug (was Re: make new folder)
- Subject: Re: A bug (was Re: make new folder)
- From: Luther Fuller <email@hidden>
- Date: Mon, 2 Jun 2008 11:44:01 -0500
System Events is called into the picture because the Finder can't see
invisible items. And, yes, there seems to be a problem with Finder and
System Events not being able to share variables.
Just before seeing this reply, I was able to get my script working
perfectly. The work-around to the problem with going from a bg picture
to white is solved by removing (trashing) the current bg picture file.
I first use System Events ONLY to make the "background" folder
visible; then I use Finder to duplicate (not move) its contents into
the parent folder; then I remove (do shell script "rm ...") the
"background" folder; and finally I make a new "background" folder, if
necessary.
Now I wonder if this new script in Leopard will work in Tiger.
On Jun 2, 2008, at 10:07 AM, 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
_______________________________________________
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