• 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: simple Quictime script
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: simple Quictime script


  • Subject: Re: simple Quictime script
  • From: Alex Zavatone <email@hidden>
  • Date: Wed, 13 Oct 2010 15:26:48 -0500

Here's how I call a subroutine from within a tell block.  The problem is one of scope.  We need to refer back to the current script and tell AppleScript that the sub routine you want to run is within the current script or it will think that you want the target of the tell block to try and call the subroutine.

So one way is instead of issuing a tell to another application and then calling the subroutine, use this:

using terms from application "QuickTime Player"

-- do stuff
set myValue to mySubroutine()

end using terms from


The other way to reference the script itself.  Near the top of your script put this:

script main

And at the end of your script do this:

end script


Then you can call "main's subfunction()".  Like so:

on run {}
	Main's Go()
end run

script Main
	on Go()
		tell application "QuickTime Player"
			-- do stuff
			set myValue to Main's MySubroutine()
			display dialog myValue
		end tell
	end Go

	on MySubroutine()
		return "Hi!"
	end MySubroutine

end script
 _______________________________________________
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: simple Quictime script
      • From: Stan Cleveland <email@hidden>
    • Re: simple Quictime script
      • From: "Jan E. Schotsman" <email@hidden>
References: 
 >Re: simple Quictime script (From: "Jan E. Schotsman" <email@hidden>)
 >Re: simple Quictime script (From: Alex Zavatone <email@hidden>)
 >Re: simple Quictime script (From: "Jan E. Schotsman" <email@hidden>)

  • Prev by Date: Re: simple Quictime script
  • Next by Date: Re: simple Quictime script
  • Previous by thread: Re: simple Quictime script
  • Next by thread: Re: simple Quictime script
  • Index(es):
    • Date
    • Thread