• 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
more scoping aggravation
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

more scoping aggravation


  • Subject: more scoping aggravation
  • From: tom wible <email@hidden>
  • Date: Mon, 17 Jan 2011 09:48:05 -0500

i've got a utility lib, sammylib:
...
global resultMsg

on write_log(msg)
	log msg
	try
		set now to current date
		set end of resultMsg to (now & " - " & msg & newline as string)
	on error
		set resultMsg to {now & " - " & msg}
	end try
end write_log

on clear_log()
	set resultMsg to {}
end clear_log

on getResults()
	return resultMsg as string
end getResults
...
which i include & use:

property SAMMY_LIB : "/DVR/scripts/sammyLib.app"
property sammylib : (load script POSIX file (SAMMY_LIB as string))
...
on write_log(msg)
	if interactive then ¬
		display alert msg giving up after 20
	sammylib's write_log(msg)
end write_log

on get_log()
	return sammylib's getResults()
end get_log

on clear_log()
	sammylib's clear_log()
end clear_log
...
		write_log(tvpiSender & " - " & cmds)
		display alert get_log() -- dbg
		write_log(tvpiName)
		display alert get_log() -- dbg

and here's what i get:

(*airdrummer - tvpi2DVR:send2eyetv:runlonger =30*) -- the log in sammylib's write_log(msg)
current date
date "Monday, January 17, 2011 9:28:30 AM" -- the date in sammylib's write_log(msg)
display alert "Monday, January 17, 2011 9:28:30 AM - email@hidden - tvpi2DVR:send2eyetv:runlonger =30"
{button returned:"OK"}
(*/Users/tomw/Desktop/program.tvpi*) -- the log in sammylib's write_log(msg)
current date
date "Monday, January 17, 2011 9:28:38 AM" -- the date in sammylib's write_log(msg)
display alert "Monday, January 17, 2011 9:28:38 AM - /Users/tomw/ Desktop/program.tvpi"
{button returned:"OK"}


please explain why resultMsg is local, not global as specified:- ( this used to work:

Outsourced # Sari, Charlie # 4-1 # 10:30PM every Thu # 30mins
Saturday, January 8, 2011 6:42:07 AM - airdrummer - tvpi2DVR:send2eyeTV:weekly
Saturday, January 8, 2011 6:42:07 AM - /tmp/11_01_08__06_42_05- program.tvpi
Saturday, January 8, 2011 6:42:07 AM - weekly
Saturday, January 8, 2011 6:42:08 AM - persistSched:sent2eyetv
Saturday, January 8, 2011 6:42:08 AM - resolveConflicts4etv:updateSchedList:#dirtyScheds=0
Saturday, January 8, 2011 6:42:10 AM - crontab updated




_______________________________________________
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: Posting scripts (was more scoping aggravation)
      • From: "Stockly, Ed" <email@hidden>
    • Re: more scoping aggravation
      • From: Axel Luttgens <email@hidden>
  • Prev by Date: Re: Top-posting [ please stop this discussion]
  • Next by Date: Re: more scoping aggravation
  • Previous by thread: Re: Soap and Applescript
  • Next by thread: Re: more scoping aggravation
  • Index(es):
    • Date
    • Thread