Unlocking 1Password mini

I have a macro that opens a selected 1Password bookmark. This works perfectly if 1Password mini is already unlocked. However, if it’s not, I want it to unlock it with my master password and keep going. I tried an applescript but I don’t know the dictionary for 1Password and I’ve never written an AppleScript before. So, I’m a little stuck. How can I do this?