Import Serials from Yojimbo into 1P4

Options
yabdab
yabdab
Community Member
edited January 2014 in Mac

I could not find a good way to import my serials into 1P4, so I made this little applescript.
Maybe it will help some one else?

set theString to ""

tell application "Yojimbo"
    
    set yserials to every serial number item
    
    repeat with yserial in yserials
        
        set Title to name of yserial
        set Owner to the owner name of yserial
        set Email to the email address of yserial
        set Serial to the serial number of yserial
        
        -- csv format expected by 1Password4
        -- title, version, license key, owner name, owner email, owner company, download link, publisher, publisher URL, retail price, support email, purchase date, order number, notes
        
        
        set theString to theString & Title & ",," & Serial & ", " & Owner & "," & Email & return
        
    end repeat
    
end tell


-- show in results tab
theString

Take the results and create your csv file. Then import into 1P4

Make sure no values have commas in them, that one got me.

Hope this helps :-)

Comments

  • jxpx777
    jxpx777
    1Password Alumni
    Options

    Hi, @yabdab! Thank you for sharing this script! It looks great. You mentioned having issues with values with commas in them. If you surround each field with quotes instead, that will take care of fields with commas and new lines. If there are fields with " or \ characters, escape those with a \ as well. (This will be changing in a future release as I'm making changes to the import scripts to conform to RFC 4180. This isn't available yet but it should be in the next release.)

  • yabdab
    yabdab
    Community Member
    edited January 2014
    Options

    Y, i tried escaping the quotes by doing "\"" & Title & "\"" , but the results did not remove the backslashes.

  • jxpx777
    jxpx777
    1Password Alumni
    Options

    That's odd. I'm not much of an AppleScript guy honestly, but it makes sense that it's outputting the "\"" since it has to make sense of the fact that the interior " is not the end of the string. I tried setting the " character to a variable and that seems like it worked a little better:

    set doublequote to ASCII character 22
    

    Then, just concatenate this with the Title variable like this:

    doublequote & Title & doublequote
    

    when doing the output. I hope that helps!

This discussion has been closed.