conditionalizing scripts to only run on a certain computer? (for iCal)

Hi all,
So now that I have both a laptop and desktop (MacBook + G5 dual2.3) for the first time ever i can know the joys of syncing…
It sucks.
I’m using .Mac’s sync and one particular problem I have is that I’ve been using a calendar in iCal to run regular automated backups and such on the G5, by using recurring events with alarms that run applescript applications. Problem is that these little apps that I’ve made ONLY reside on the G5, and are only relevant to the G5, and there appears to be no way to exclude this one calendar from syncing.

So I figure a potential workaround is to go ahead and put the AS apps on both computers but first conditionalize them so that they check to see which computer they’re running on before doing anything. If they’re on the G5, they go ahead with their business; if they’re on the MacBook they just exit using the wonderful but difficult-to-find-out-about " error number -128 "

So, anyone have a good idea how to do that? Just check volume name or something? (keeping in mind that one computer could have the other mounted via the network)

And I’d also be happy to hear thoughts on whether this is even a viable solution! thanks
~jason

If the app does absolutely nothing on one computer, why not just make a new app with the same name that contains…

on run
	quit
end run

This is kind of a hack, as one would think that you should be able to find a way to disable the app from ever running at all. Worst case is that you do the above, though.

j

hi uni,

here’s a good way:


set myName to (do shell script "/bin/hostname")

if myName is "G5" then
	doStuff
else
	quit
end if

on doStuff()
	--do stuff
end doStuff

alternatively:


set myName to (do shell script "/bin/hostname")

if myName is "G5" then
	--do stuff
else
	quit
end if