• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
XCode TableView Script Error....
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

XCode TableView Script Error....


  • Subject: XCode TableView Script Error....
  • From: Kathryn Tate <email@hidden>
  • Date: Wed, 15 Aug 2007 02:13:49 -0700

I have built my first applescript application in XCode,
using a tutorial I found online, which addresses using TableView.

Here is the script. I am having a hard time debugging it.

Can someone recommend an applescript editor?

Could someone copy and paste this into the Editor and see what the problem is?
It may not work with the Editor, though, as it uses instances in XCode.


on awake from nib theObject
set theDataSource to make new data source at end of data sources with properties
{name: "Account Data"}
tell theDataSource
make new data column at end of data columns with properties {name: "Account Name"}
make new data column at end of data columns with properties {name: "Account Status"}
end tell
set data source of theObject to theDataSource
end awake from nib


on refreshAccountListing()
tell application "Mail"
set theAccountNameList to name of every account
set theAccountStatusList to enabled of every account
end tell

tell data source "Account Data"
set update views to false
delete every data row
repeat with a from 1 to length of theAccountNameList
set theRow to make new data row at end of data rows

tell theRow
set contents of data cell "Account Name" to item a of theAccountNameList
if item a of theAccountStatusList = true then
set theAccountStatus to "Enabled"
else
set theAccountStatus to "Disabled"
end if

set contents of data cell "Account Status" to theAccountStatus
end tell

end repeat

set update views to true

end tell

end refreshAccountListing

on launched theObject
refreshAccountListing()
set visible of window "Main Window" to true
end launched


on toggleAccounts()
set theSelectRows to selected data rows of table view "Account List" of
scroll view "Account List" of window "Main Window"
repeat with a from 1 to length of theSelectedRows
set theRow to item a of theSelectedRows

tell theRow
set theAccountName to contents of data cell "Account Name"
set theAccountStatus to contents of data cell "Account Status"

if theAccountStatus = "Enabled" then
set theNewAccountStatus to false
else
set theNewAccountStatus to trus
end if

tell application "Mail"
set enabled of account theAccountName to theNewAccountStatus
end tell

end tell

end repeat

refreshAccountListing()

end toggleAccounts

on clicked theObject
if name of theObject  = "Toggle" then
toggleAccounts()
else
quit
end if
end clicked









 _______________________________________________
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

  • Prev by Date: Re: Get Random number?
  • Next by Date: Applying permissions to all files in all subfolders
  • Previous by thread: [example]: Applescript and Quicktime, converting time string to movie location
  • Next by thread: Applying permissions to all files in all subfolders
  • Index(es):
    • Date
    • Thread