Re: AppleScript script unable to respond to a script statement correctly
Re: AppleScript script unable to respond to a script statement correctly
- Subject: Re: AppleScript script unable to respond to a script statement correctly
- From: Deivy Petrescu <email@hidden>
- Date: Sun, 24 Jun 2018 17:33:44 -0400
> On Jun 24, 2018, at 16:20 , Nigel Garvey <email@hidden> wrote:
>
> ILJA SHEBALIN wrote on Sun, 24 Jun 2018 05:07:14 +0300:
>
>> set RecList to {{ParagraphText:"On 18 Jun 2018, at 3:28 pm, Ilya
> Shebalin
>> <email@hidden> wrote:", ParagraphPosition:1},
>> {ParagraphText:"That's how the as \"class utf8\" compiles in
>> ScriptDebugger:", ParagraphPosition:3}, {ParagraphText:"",
>> ParagraphPosition:4}, {ParagraphText:"Type this into a Script Debugger
>> window:", ParagraphPosition:5}, {ParagraphText:"", ParagraphPosition:6},
>> {ParagraphText:"current date", ParagraphPosition:7},
>> {ParagraphText:"Compile, then go to the View Menu and choose Show Raw
>> (Chevron) Syntax, and compile again. What do you see now?",
>> ParagraphPosition:9}, {ParagraphText:"", ParagraphPosition:2},
>> {ParagraphText:"", ParagraphPosition:8}}
>> set NewRecList to {}
>> repeat until RecList is {}
>> repeat with itemRef in RecList
>> if ParagraphPosition of contents of itemRef = (count RecList)
>> then
>> "log (count RecList):"
>> log (count RecList)
>> "log ParagraphPosition of contents of itemRef = (count
>> RecList):"
>> log (ParagraphPosition of contents of itemRef = (count
>> RecList))
>> set end of NewRecList to contents of itemRef
>> set (contents of itemRef) to missing value --a problem
>> here!
>> "log (contents of ItemRef):"
>> log (contents of itemRef)
>> set RecList to every record of RecList
>> "log RecList:"
>> log RecList
>> "log (count RecList):"
>> log (count RecList)
>> end if
>> end repeat
>> end repeat
>
>> Tell me please what mistake I made.
>
> Further to Shane's reply, the line 'set RecList to every record of
> RecList' should go between the two 'end repeat' lines. And where it is
> at the moment, you should ideally have 'exit repeat'.
>
> set RecList to {{ParagraphText:"On 18 Jun 2018, at 3:28 pm, Ilya Shebalin
> <email@hidden> wrote:", ParagraphPosition:1},
> {ParagraphText:"That's how the as \"class utf8\" compiles in
> ScriptDebugger:", ParagraphPosition:3}, {ParagraphText:"",
> ParagraphPosition:4}, {ParagraphText:"Type this into a Script Debugger
> window:", ParagraphPosition:5}, {ParagraphText:"", ParagraphPosition:6},
> {ParagraphText:"current date", ParagraphPosition:7}, {ParagraphText:"Compile,
> then go to the View Menu and choose Show Raw (Chevron) Syntax, and compile
> again. What do you see now?", ParagraphPosition:9}, {ParagraphText:"",
> ParagraphPosition:2}, {ParagraphText:"", ParagraphPosition:8}}
> set NewRecList to {}
> set RecListLen to (count RecList)
> repeat until RecListLen is 0
> repeat with itemRef in RecList
> if ParagraphPosition of itemRef = RecListLen then
> set end of NewRecList to contents of itemRef
> set (contents of itemRef) to missing value --a problem here!
> exit repeat
> end if
> end repeat
> set RecList to every record of RecList
> set RecListLen to RecListLen - 1
> end repeat
>
> return {List1:NewRecList, List2:RecList}
>
>
> NG
Nigel
Am I missing something?
Why are the lines
set (contents of itemRef) to missing value —a problem here!
and
set RecList to every record of RecList
needed?
If you remove them the script is shorter and it works, probably faster then
this.
By the way, congrats on the victory :-)
Deivy Petrescu
email@hidden
_______________________________________________
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