• 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
Re: Applescript-users Digest, Vol 1, Issue 158
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Applescript-users Digest, Vol 1, Issue 158


  • Subject: Re: Applescript-users Digest, Vol 1, Issue 158
  • From: Paul Berkowitz <email@hidden>
  • Date: Sat, 30 Oct 2004 10:07:50 -0700

On 10/30/04 9:23 AM, "Mark Alldritt" <email@hidden> wrote:

>> I need to write a script in which I want to retrieve the current line number
>> of the script, if the script is being executed from script debugger, so that
>> if an error occurs, a dialog can be displayed or a report can be generated,
>> which says which line number caused the error, so that a person can directly
>> go to that line and may inspect the cause of the error without going through
>> the Apple Event Log.
>
> There are a series of properties on the 'script document' object that report
> information about script errors:

> The 'last error range' property points to the text that AppleScript reports
> as the source of the error.

Hey! That's very cool, Mark. This works exactly how the original questioner
wanted. (Mark, you've replied to the Digest without including either the
original subject OR sender. Please include at least an attribution line.)

    set theScript to script document 2
    set errorPos to position of (get last error range of theScript)
    set lineIndex to index of (last line of theScript whose position <
errorPos)
    --> 9

--
Paul Berkowitz


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >Re: Applescript-users Digest, Vol 1, Issue 158 (From: Mark Alldritt <email@hidden>)

  • Prev by Date: Re: Applescript-users Digest, Vol 1, Issue 158
  • Next by Date: Re: How to find current user?
  • Previous by thread: Re: Applescript-users Digest, Vol 1, Issue 158
  • Next by thread: Re: AppleMods (was Re: Dice)
  • Index(es):
    • Date
    • Thread