• 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 do I get a script to ask me the number of times to repeat?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How do I get a script to ask me the number of times to repeat?


  • Subject: Re: How do I get a script to ask me the number of times to repeat?
  • From: Simon Kidd <email@hidden>
  • Date: Thu, 24 Feb 2005 17:17:33 -0500

At 1.24pm -0600 24/2/05, Christopher Stone wrote:
At 13:44 -0500 02/24/2005, Simon Kidd wrought:

many times it is to repeat and in what phase it is to select items. So my question is what is the command I need to script to have the script ask me these questions?

*I* sure wouldn't use GUI scripting to do this.

set srcFl to alias "Lao-Tzu:Users:chris:Documents:Test_Folder_1:"
set destFl to alias "Lao-Tzu:Users:chris:Documents:Test_Folder_2:"
set n to text returned of (display dialog "Please enter \"n\":" default answer "")


 tell application "Finder"
   set fList to items of srcFl
   repeat with ndx from 1 to count of fList by n
     move item ndx of fList to destFl
   end repeat
 end tell

Chris

I didn't do a very good job of explaining myself. The files are from experiments measuring fly activity. Each file in the folder represents one fly and there are several different fly strains intermixed with each other. I need to move all the files representing one strain into their own folder. The way my data is organised I need to choose which file to copy and then subsequently copy every nth one. I then choose the next file and repeat the process until each file in the folder has been copied to a new folder. I took bits of your script and came up with:
------------------
set theDestinationFolder to choose folder with prompt "Select a destination folder:"
set nR to text returned of (display dialog "Please enter \"nR\":" default answer "") -- the number of files in the folder divided by the number of strains
set nP to text returned of (display dialog "Please enter \"nP\":" default answer "") ---the number of strains
tell application "System Events"
tell process "Finder"
activate
repeat with i from 1 to nR
copy selection to theDestinationFolder
repeat with j from 1 to nP
key code 125 -- down arrow Key
end repeat
end repeat
end tell
end tell
------------------------


It fails at "copy selection to theDestinationFolder"

Simon
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: How do I get a script to ask me the number of times to repeat?
      • From: John Stewart <email@hidden>
References: 
 >How do I get a script to ask me the number of times to repeat? (From: Simon Kidd <email@hidden>)
 >Re: How do I get a script to ask me the number of times to repeat? (From: Christopher Stone <email@hidden>)

  • Prev by Date: Re: About password fields
  • Next by Date: Re: Quark 6 Move
  • Previous by thread: Re: How do I get a script to ask me the number of times to repeat?
  • Next by thread: Re: How do I get a script to ask me the number of times to repeat?
  • Index(es):
    • Date
    • Thread