I just took a fast look at it, need to go in a minute, but i noticed this. write -ds" $+ %istriggeredit $+ " <- you need to use a space there. write -ds " $+ %istriggeredit $+ " , or you can use $qt() instead of " . write -ds $qt(%istriggeredit)