• 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
sub-routines' error
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

sub-routines' error


  • Subject: sub-routines' error
  • From: Maik Waschfeld <email@hidden>
  • Date: Wed, 10 May 2017 13:59:56 +0200

Hi AS-users,

I’m trying to get a little deeper into the sub-routine-thing.
But I’m stuck at a strange error -1708, that I can reproduce with the following script.

use AppleScript version "2.4" -- Yosemite (10.10) or later
use scripting additions

on run
set the_List to {}


activate


set the_Files to (choose file with prompt "Please select a file to process:" with multiple selections allowed)


repeat with f from 1 to (count of the_Files)
set the_File to (the_Files's item f)


my the_Name(the_File)


set the_List's end to (the_Name)
end repeat


display dialog ("the_Files: " & the_Files & "\n\nthe_List: " & the_List)


end run

on the_Name(the_File)
tell application "Finder"
set the_Name to name of the_File
end tell
end the_Name


When selecting more than one file, so that the sub-routine runs multiple times, I get this error:
error „«script» doesn’t understand the message „the_Name“.“ number -1708 from «script»

As far as I understand AppleScript, there’s basically nothing wrong with the script.

If I replace the „my the_Name(the_File)“ line with
tell application "Finder"
set the_Name to name of the_File
end tell
no error comes up, even when I select quite a lot files.

Any hints, how I get it to work, anyway?


With kindest regards…
…Maik Waschfeld

(sent from my MBAir11)


 _______________________________________________
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: sub-routines' error
      • From: "Stockly, Ed" <email@hidden>
    • Re: sub-routines' error
      • From: Christopher Stone <email@hidden>
    • Re: sub-routines' error
      • From: Axel Luttgens <email@hidden>
    • Re: sub-routines' error
      • From: Deivy Petrescu <email@hidden>
  • Prev by Date: I want to delete 'Mail' mailboxes.
  • Next by Date: Re: sub-routines' error
  • Previous by thread: Re: I want to delete 'Mail' mailboxes.
  • Next by thread: Re: sub-routines' error
  • Index(es):
    • Date
    • Thread