Result from "choose from list" never equals string

Solution 1:

From choose from list in the AppleScript Language Guide:

Result
If the user clicks the OK button, returns a list of the chosen number and/or text items; if empty selection is allowed and nothing is selected, returns an empty list ({}). If the user clicks the Cancel button, returns false.


So, in your if statement, if whichWallet is "ETH" then, the "ETH" etcetera is text, not a list, {"ETH"} and why set pasteThis to ... never occurs.

Either test against a list, list item, or coerce what's returned by choose from list to text.

If you change:

set whichWallet to choose from list walletChoices with prompt "Which wallet do you need?" default items {"ETH"}

To:

set whichWallet to (choose from list walletChoices with prompt "Which wallet do you need?" default items {"ETH"}) as text

Then the rest of the code, as coded, will work.

Otherwise you can use the example shown in the choose from list link.

Or you can test against a list:

Change:

if whichWallet is "ETH" then

To:

if whichWallet is {"ETH"} then

Doing the same for the rest of the list items in the else if whichWallet is ... statements.

Notes:

The changes mentioned herein work with the the suggested changes to the code of the question as the choose from list command by default does not allow multiple selections and multiple selections allowed true has not been included as part of the choose from list command.

Based on what it appears the OP is trying to do, this is a non-issue, however, I'm mentioned it because if it was implemented then a different approach would need to be used dealing with multiple list items returned in the list. That is, one would need to loop thru the list returned and act on each list item.