Please help..
Please help..
- Subject: Please help..
- From: email@hidden
- Date: Tue, 2 Oct 2001 09:20:54 EDT
(*
Hi All,
I left this little section of script for assistance a couple of days ago, and
have not yet received any help yet. Could someone please tell me why the
lines of code marked below give me errors, and what I can do to make those
lines of code run properly?
I have commented my questions below inside my attempted code. I am extremely
new to AS, and most of the time, I am not sure what the errors I am getting
really are, never mind that I can't correct them. Can someone explain to me
the reason this code doesn't work where marked? this script actually was
longer and had other sections, but I have removed everything I could to get
down to just the problem area.
Thank you in advance for all of your help.
Sincerely,
Kevin Shapiro
*)
(**************************************************)
(* Set a Picture *)
(**************************************************)
(* *)
(* *)
(* This function used to work when I did not have the code for the "try ...
on error .. end try". However, I added a couple of lines toward the top to
try to track the problem down, and it doesn't even get as far as the try
block. I am really confused now since the "set .. to ..." code used to work.
Please help me..
*)
on SetPicture(thePicture, thePositioning, theMonitor)
local CurPictureFile
local CurPicturePos
tell application "Appearance"
tell monitor theMonitor
(***************)
(***************)
(* I have tried several variations of the lines below to get and
save the variables. I said above that it used to work. then I realized that
in the main script, what if a file in the list I am trying to set was deleted
since its last use. I need to trap the error because it won't be able to
find the file, and then reset the last picture used and report the problem to
the user. So now I try to save the current settings, and set the new picture
with positioning. It used to work, but now tells me several different errors
depending on which compiled line I include.
If you need to contact me directly, Which would be great in case I don't
understand the simple correction you give me, you can reach me at
email@hidden. Also, phone can be arranged without much of a problem.
Thanks for your assistance.
*)
-- Save The Current Settings.
--set (CurPicturePos of me) to (get picture positioning)
set picture positioning to thePositioning
get picture positioning
set (CurPicturePos of me) to result
set (CurPictureFile of me) to (get picture file)
(***************)
(***************)
-- Try to Set The New Picture and Positioning.
try
(***************)
(***************)
(*
This was originally the only real code inside of this
function, and it used to work. Not now though.
*)
-- Set The New Picture and Positioning.
set picture positioning to thePositioning
set picture file to thePicture
(***************)
(***************)
on error
-- Probobly the Picture File No Longer Exists.
-- So Reset The Old File and Informm User.
set picture positioning to CurPicturePos
set picture file to CurPictureFile
-- Notify the user the Picture No Longer is Available.
beep 2
-- Display A Dialog To The User.
display dialog ,
"There seems to be a problem with setting the desired
file. Please ensure that the file exists or set new file choices." buttons
{"OK"} default button 1 ,
with icon warning giving up after 10
end try
end tell
end tell
end SetPicture
(* *)
(**************************************************)
(**************************************************)
(* Drop Handler *)
(**************************************************)
(* *)
(* *)
(*
I am Dropping a file (Using execute Choose File) inside of Script Debugger
to execute this script.
*)
on open of theFiles
local thePicture
local thePositioning
local theMonitor
set thePicture to ((item 1 of theFiles) as string)
set thePositioning to (automatic)
set theMonitor to (1)
(*
I had the below lines in because I use Script Debugger. I however don't
know if it works with other programs or AppleScript itself, so I have removed
the lines since they are just for analyzation anyway.
log class of thePicture
log thePicture
log class of thePositioning
log thePositioning
log class of theMonitor
log theMonitor
*)
SetPicture(thePicture, thePositioning, theMonitor)
end open
(* *)
(**************************************************)