Delay With Do Script in Terminal

Ok,

I have a script which tells the Terminal to activate and do a script, the only problem is, if i have eval su meskue in my ~/.profile so that i have to enter my password at the start of a new shell the do script never gets run? I have tried putting a delay in but that seems to make the script delay opening the terminal…here is the script…if anyone can tell me how i can get the script to run after i enter my password it would be great

tell application "Terminal"
	activate
	delay 5
	do script "/bin/bash --noprofile --norc
/Applications/TAU/tau-2.15.4/apple/bin/perfdmf_configure"
end tell

thanks,
meskue

Also tried

tell application "Terminal"
	activate
	if window 1 is busy then
		delay 5
       end if
do script "/Applications/TAU/tau-2.15.4/apple/bin/perfdmf_configure"
end tell

which also doesn’t seem to work… busy is in the window dictionary for Terminal but it doesn’t seem to be working

someone please help im getting really frustrated

hi meskue,

maybe you can wait for the end of ‘su’ like so:

tell app "Terminal"
	do script ""
	set win to window 1
	repeat until (last item of (get processes of win) is "su")
	end repeat
	repeat while (last item of (get processes of win) is "su")
	end repeat

	-- should be ready here, maybe another short delay is needed ...
end