• 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: How to get the number of items in a selected Folder ?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to get the number of items in a selected Folder ?


  • Subject: Re: How to get the number of items in a selected Folder ?
  • From: Yvan KOENIG <email@hidden>
  • Date: Fri, 27 Nov 2015 13:56:21 +0100


Le 2015/11/27 à 12:24, Shane Stanley <email@hidden> a écrit :

On 27 Nov 2015, at 9:13 PM, Thomas Fischer <email@hidden> wrote:

I can save the script if I create a fresh copy, but I cannot save the script after recompiling (i.e.: pushing the hammer icon or cmd-K)

Try making a small change (add a space or something) and then re-compiling.

Furthermore, why would a script like this try to save any variable to begin with? There are no global declarations and nobody using this script would expect any variables preserved from an earlier run.

It's not just global variables; it's top-level variables. As to why that happens, you'll have to ask those who designed it that way.

The solution to avoid top level variables by using something like

tell me to countFolders()

on countFolders()
…
end countFolders()

seems rather odd to me for a scripting environment that should be built for usability.

Obviously we need a better solution. Even when saving works because there are no ASObjC top-level values, the fact that non-ASObjC properties persist where they might not when deployed is unhelpful. At this stage all I can say is that it is what it is, and bugreport.apple.com is the place to get heard about it.

But it is complicated by the fact that self-modifying code is really an awful way to save any values anyway, which means it's difficult to consider in isolation. Doing something like ASObjC Explorer does and just not saving any values solves the immediate problem, but the underlying problem of being able to save values another way is inextricably related, and arguably the bigger issue.

And the total absence (at least in the German version) of any explanation why saving fails is at least annoying.

If you choose save, there should be an explanatory dialog. But there doesn’t seem to be one if the problem is triggered by an autosave.

For every script I use the structure :
on run
 my germaine()
end run

on germaine()
-- my code
end germaine

This way I don’t get the annoying « Can’t save » error message.
On my system ran in French I never faced the inability to save without a message.

Just for see, I made numerous tries with :

use scripting additions
use framework "Foundation"
use script "BridgePlus" version "1.3.1"

load framework
--set myFolder to (choose folder) as alias
set myfolder to path to library folder from user domain
count (current application’s SMSForder's itemsIn:myfolder recursive:true asPaths:false)

I ran it 20 times and never got a « Can’t save » error but looking at the file infos, I saw that it was not rewritten after run process so, I redid 20 attempts calling Save after every run. No more error message.
As I’m curious, I changed the main language to Deutsch and rebooted.
I made the same tests and got the same results.
Given that I’m really puzzled. Why is it erroring on Thomas’s machine but not on mine ?


Yvan KOENIG running El Capitan 10.11.1 in French (VALLAURIS, France) vendredi 27 novembre 2015 13:56:14


 _______________________________________________
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

  • Follow-Ups:
    • Re: How to get the number of items in a selected Folder ?
      • From: Shane Stanley <email@hidden>
References: 
 >How to get the number of items in a selected Folder ? (From: "emile.a.schwarz" <email@hidden>)
 >Re: How to get the number of items in a selected Folder ? (From: "Stockly, Ed" <email@hidden>)
 >Re: How to get the number of items in a selected Folder ? (From: "Stockly, Ed" <email@hidden>)
 >Re: How to get the number of items in a selected Folder ? (From: Yvan KOENIG <email@hidden>)
 >Re: How to get the number of items in a selected Folder ? (From: Shane Stanley <email@hidden>)
 >Re: How to get the number of items in a selected Folder ? (From: Shane Stanley <email@hidden>)

  • Prev by Date: Re: How to get the number of items in a selected Folder ?
  • Next by Date: Expected end of line, etc. but found identifier
  • Previous by thread: Re: How to get the number of items in a selected Folder ?
  • Next by thread: Re: How to get the number of items in a selected Folder ?
  • Index(es):
    • Date
    • Thread