Conditional to run 2 scripts?

Here is my code that does not work:


tell application "Microsoft Excel"
	if the value of cell "$E$12" is "Ceramics" then
		run script "MacHD:Library:Scripts:Folder Action Scripts:Milestones_OLD.scpt"
	else
		run script "MacHD:Library:Scripts:Folder Action Scripts:Milestones_NEW.scpt"
	end if
end tell

I keep getting an error:

Please help

I didn’t test this but you could have 2 errors. First, your file paths are strings so you have to make them mac paths. As such use “run script file” instead of “run script”. Second, you may have to move the “run script file” commands outside of the “tell application” block… although I’m not sure of that. The reason being that whatever commands you have inside of a tell block “ you are actually telling that application to perform those commands and that application might not understand the “run script” command. Applications only understand the commands that are in their applescript dictionary, and I doubt the “run script” command is in excel’s dictionary. Something like the following should work or at least get you closer…

set oldScript to "MacHD:Library:Scripts:Folder Action Scripts:Milestones_OLD.scpt"
set newScript to "MacHD:Library:Scripts:Folder Action Scripts:Milestones_NEW.scpt"

tell application "Microsoft Excel"
   if the value of cell "$E$12" is "Ceramics" then
       set runScript to oldScript 
   else
       set runScript to newScript 
   end if
end tell
run script file runScript

Hi regulus,

I answered bluenote in another thread with a single script solution

Thanks!