The creation of the popup menu item is completely independent of the command that it calls. There is no way to pass state values (of which there are many - not just $v1) from one identifier evaluation into another separate identifier evaluation. The solution that hixxy provided is the only way to do what you want, as far as I can see.