AppleScript Studio: status bar and panel window
All I am looking for is the panel to come down, show the progress bar turning, then for the panel to go away when iCal is done adding the event. This is the entire script, but I'm not sure I have everything right in Interface builder. The Documentation for display mentioned clicking panel ended, but then further down it looked like you didn't need it.
I'm confused.
----
-- +Event.applescript
-- +Event
-- Created by Michael Ewald on 6/26/06.
-- Copyright 2006 Michael Ewald. All rights reserved.
load panel "statusPanel" from nib "statusPanel"
on clicked theObject
-- Get & Format form items
set eventTitle to contents of text field "eventTitle" of window "main" as string
set eventLocation to contents of text field "eventLocation" of window "main" as string
set EventNotes to contents of text view "eventNotesText" of scroll view "eventNotesScroll" of window "main"
set allDay to state of button "allDay" of window "main"
set startDate to current date
set startDate to content of control "startDate" of window "main"
set endDate to content of control "endDate" of window "main"
-- Make Event
start progress indicator "statusBar" of window "statusPanel"
try
start progress indicator "statusBar" of window "statusPanel"
display "statusPanel" attached to window "main"
tell application "iCal"
set theCalName to "AppleScript Test"
set theCal to calendar theCalName
if allDay is equal to 1 then
make new event at end of calendar theCalName with properties {summary:eventTitle, location:eventLocation, allday event:true, description:EventNotes}
else if allDay is equal to 0 then
make new event at end of calendar theCalName with properties {summary:eventTitle, location:eventLocation, start date:startDate, end date:endDate, description:EventNotes}
end if
end tell
-- reset form
set the contents of text field "eventTitle" of window "main" to ""
set the contents of text field "eventLocation" of window "main" to ""
set contents of text view "eventNotesText" of scroll view "eventNotesScroll" of window "main" to ""
set state of button "allDay" of window "main" to 0
set currentDate to current date
set currentDatePlus to (current date) + 1 * hours
-- Update Times
set content of control "startDate" of window "main" to currentDate
set content of control "endDate" of window "main" to currentDatePlus
on error
display alert "There was a problem!"
end try
close panel "statusPanel"
end clicked
----
MacBook Pro 15" 2.16 ghz, Mac OS X (10.4.6)