Re: Sorting characters of the text - script doesn't work as expected
Re: Sorting characters of the text - script doesn't work as expected
- Subject: Re: Sorting characters of the text - script doesn't work as expected
- From: Emmanuel Lévy <email@hidden>
- Date: Fri, 26 May 2017 23:22:33 +0200
just in case someone is interested, Smile, the Applescript editor by satimage.fr, provides a Validate command to check for undefined variables and for unused variables.
Saves much time sometimes…
Emmanuel
> On 26 May 2017, at 21:03, ILJA SHEBALIN <email@hidden> wrote:
>
> Wow, thank you!!! So much hassle only because of some obscure typo... And I was inspecting for some possible hidden typo and didn't see any. Now it worked and am so glad that my entire script is indeed workable. Your insights regarding erroneous bytes however pose another set of problems for me to resolve: I often am sent PDF docs whose price one is able evaluate only upon retrieving the text. And the files in trouble were those that were created by retrieving the text in Automator.
> As for simplification, indeed that was an option considered by me at some point however I feared ambiguity of nonrigourous equality, i.e. "if ...≤ ...then // else" might produce incorrect results or errors because what "else" would mean in this case? If it would mean "≥" then the "=" part of it would obfuscate as clearly implementing some ambiguity ("=20" could lead to multiplication either by 2 or by 3) and would be highly undesirable. So I thought at least.
> 26.05.2017, в 20:05, Yvan KOENIG написал(а):
>
>> I found a typo in the original script.
>>
>> Near the end we may read :
>> if RuPageCount ≤ 20 then
>> set RusDocPrice to RuPageCount * 3 --failure. Returns an initial value
>> else if PageCount > 20 then
>> set RusDocPrice to RuPageCount * 2 --failure. Returns an initial value
>> end if
>>
>> It must be :
>> if RuPageCount ≤ 20 then
>> set RusDocPrice to RuPageCount * 3
>> else if RuPageCount > 20 then
>> set RusDocPrice to RuPageCount * 2
>> end if
>>
>>
>> In fact the three blocks of code calculating the prices may be simplified as:
>>
>> if EnPageCount ≤ 20 then
>> set EnDocPrice to EnPageCount * 4
>> else
>> set EnDocPrice to EnPageCount * 3
>> end if
>>
>> if LtPageCount ≤ 20 then
>> set LtDocPrice to LtPageCount * 3
>> else
>> set LtDocPrice to LtPageCount * 2
>> end if
>>
>>
>> if RuPageCount ≤ 20 then
>> set RusDocPrice to RuPageCount * 3
>> else
>> set RusDocPrice to RuPageCount * 2
>> end if
>>
>>
>> Yvan KOENIG running Sierra 10.12.5 in French (VALLAURIS, France) vendredi 26 mai 2017 19:05:27
>>
>>
>>
>> _______________________________________________
>> 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
>
> _______________________________________________
> 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
_______________________________________________
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