• 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: Random number and filename
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Random number and filename


  • Subject: Re: Random number and filename
  • From: email@hidden
  • Date: Tue, 26 Feb 2002 12:05:50 +0100

This script gives "stack overflow".
What is wrong?

Anyone?


get random number from 1000 to 3000
set x to result
set search_for_file to alias "Macintosh HD:images_to_database:Documents:"
set myListforfile to list folder search_for_file without invisibles
repeat with myFilename in myListforfile
set myfile to alias ("Macintosh HD:images_to_database:Documents:" &
myFilename)
end repeat
set fileName of myfile to (x & ".doc" as string)

Best regards
Peter Mathiessen













To: email@hidden, email@hidden
cc:
bcc:
Subject: Re: Random number and filename
email@hidden

2002-02-26 22:43 GMT
<font size=-1></font>





















on 26/2/02 8:38 PM, email@hidden at email@hidden
wrote:

> Dear all,
>
> Why doesn4t this script work?
>
> tell application "Finder"

none of this is "Finder"'s business

> get random number from 1000 to 3000
> set x to result
> set search_for_file to alias "Macintosh
> HD:images_to_database:Documents:"
> set myListforfile to list folder search_for_file without invisibles
> repeat with myFilename in myListforfile
> set myfile to alias "Macintosh HD:images_to_database:Documents:"
> & myFilename

set myfile to alias ("Macintosh HD:images_to_database:Documents:" &
myFilename)
--the coercion to alias of the concation is too much for the compiler so
--parenthesis are required.

> end repeat
> --try
> set fileName of myfile to (x & ".doc")

set fileName of myfile to (x & ".doc" as string)
--because x is a number and not a string you must specify the coercion.

> --end try
> end tell
_____________________________ Andy
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: Random number and filename
      • From: JollyRoger <email@hidden>
  • Prev by Date: Re: Random number and filename
  • Next by Date: Re: Why are these different?
  • Previous by thread: Re: Random number and filename
  • Next by thread: Re: Random number and filename
  • Index(es):
    • Date
    • Thread