• 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
variables within idle
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

variables within idle


  • Subject: variables within idle
  • From: Die Fledermaus <email@hidden>
  • Date: Thu, 30 Jul 2015 12:13:12 -0400

Folks,

I have a script which watches a folder and moves the files based on the activity of one of the folders. The problem comes when I run this script with idle the variable nameslist comes back as undefined when it runs. if I take out the idles and just loop it or run it once I do not get the error. I have tried setting the nameslist variable as a global and that was the same result.

What am I missing when it comes to idles and this variable. The other variable set to global works without a hitch. I am running this on a 10.10.4 machine.

global nameslist

global theWatchedFolder

set nameslist to " "

set theWatchedFolder to "Macintosh HD:Users:ifbell:Desktop:videofinished" as string

on idle

tell application "Finder"

set folderFiles to (every file in the folder theWatchedFolder whose name extension is "mp4")

if folderFiles is equal to {} then return

repeat with currentFile in folderFiles

set currentFileName to (the name of currentFile)

#display alert currentFileName

copy currentFileName to the end of items in nameslist

end repeat

end tell

#display alert listOfNames

tell application "Finder"

set AppleScript's text item delimiters to "."

repeat with n from 1 to count of nameslist

try

copy (item n of nameslist) to fileName

set {finname, nameExt} to {text 1 thru text item -2, text item -1} of fileName

display alert finname giving up after 10

set fileloc to "/Users/user/Desktop/videoTBP/" & finname & ".mov" as string

set finloc to "/Users/user/Desktop/videoprocessed/"

#display alert fileloc

do shell script "mv " & quoted form of fileloc & " " & quoted form of finloc & ""

on error errTxt number errNum

display notification finname & " has been moved"

end try

end repeat

end tell

end idle


 _______________________________________________
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: variables within idle
      • From: Deivy Petrescu <email@hidden>
    • Re: variables within idle
      • From: Mark Hunte <email@hidden>
  • Prev by Date: Re: Script fonts?
  • Next by Date: Re: variables within idle
  • Previous by thread: Re: default folder x
  • Next by thread: Re: variables within idle
  • Index(es):
    • Date
    • Thread