Example pathname and tokenized version of same seem to match, but KM can't Open file with Numbers

Hi, all:

A client sends me a work package containing, among other things, an Excel file that I want to open in Numbers. Sometimes he has a space before .xlsx; sometimes he doesn't. (Client name blanked for confidentiality.)

I think I've got everything in order but it won't fly.

What I've Tried / Of Possible Interest
Using the current package as an example and using Finder's Copy...as Pathname on the desired file, I get the first line shown below. My tokenized version as set in the Open File action in KM gets resolved (using Display Text in Window) as shown on the second line below. I'm showing them together so you can compare them more easily:

/Users/ckbarlow/Documents/Freelance and Corporate/ClientName/Technical Reviews/Technical Reviews In Progress/Batch 8_3_2023 10-27-32 AM/Wav files sent on 8_3_2023 10-27-32 AM/Tracks to check as of 03-08-2023 .xlsx
/Users/ckbarlow/Documents/Freelance and Corporate/ClientName/Technical Reviews/Technical Reviews In Progress/Batch 8_3_2023 10-27-32 AM/Wav files sent on 8_3_2023 10-27-32 AM/Tracks to check as of 03-08-2023 .xlsx

Here is my tokenized version that yields line 2 above, as entered in the Open File ...in Numbers action:
%Variable%TechRevsInProg_LocalPath%/Wav files sent on %Variable%TechReviewBatch_Date%/Tracks to check as of %Variable%TechReviewBatch_DateDay%-%Variable%TechReviewBatch_DateMonth%-%Variable%TechReviewBatch_DateYear% .xlsx

I checked the Engine Log file and I see this line a lot:
2023-08-10 07:11:39 Invalid Plug In Action with Name Set Finder Label

In the Editor log file, there are dozens of this pairing; I don't have 1Password:
2023-08-10 07:15:31 Invalid Plug In Action with Name Set Finder Label
Last message repeated 8 times
2023-08-10 07:16:08 Failed to find any 1Password metadata folder or bookmarks-default.json file
Last message repeated 2 times

And the error that I get seems to indicate that the Variable tokens aren't being resolved by the Open File action:
2023-08-10 07:11:38 Action 12954442 failed: Open File failed with non-existent path “%Variable%TechRevsInProg_LocalPath%/Wav files sent on %Variable%TechReviewBatch_Date%/Tracks to check as of %Variable%TechReviewBatch_DateDay%-%Variable%TechReviewBatch_DateMonth%-%Variable%TechReviewBatch_DateYear% .xlsx”

I also did check that the file would open in Numbers when manually double-clicked.

Here's the relevant chunk of my macro:

An Alternative That Works Sometimes But Not Consistently
In fact, it worked just now with the current work package. But I'm not sure why it doesn't always work, so I figured I would try the more precise version (i.e. using the exact filename, since I can derive it) that is the topic of this post.

I hope I've done a sufficient job laying out the issue. If there's anything more I can provide, just say the word.

Thank you for any guidance you can offer!

Edited for clarity.

Well, if you're expecting people to test this out and examine what you've done in full you really need to post your macros so that they won't have to retype what you're showing - which is impossible to do anyway from your screenshots.

Does this mean that the screenshots are too small?

As for posting the macro, I can, but it's chock full of specifics to my environment and my client's conventions, which would be cumbersome (though I guess not impossible) to replicate. Plus the Excel file contains confidential info.

I'll try to reproduce the issue in a generic version that is as simple as possible, e.g. the Excel file is in a folder residing on the desktop. If I can reproduce the problem there, I'll post that macro. That would be much easier for someone else to test.

Thanks for your time.

No - but the stuff in the If actions can’t be seen in its entirety because it’s too long for the field.

That would be ideal :grinning:

But even so, do you see any reason that a path that resolves correctly for the Display Text in Window action would not also resolve correctly in an Open File action?

Got it. User error. In my Display Text in Window action, I had the tokenized path correct, hence it matched the Copy as Pathname of the actual file char for char.
But in my Open actions, there was a level missing from the tokenized path. I apparently didn't copy/paste from one to the other.

All better now.

I determined this by populating my original If chunk with the actual pathname. I then swapped in the tokenized portions of the path, one by one, until the path was completely tokenized - and it worked. So that led me to my "wth happened?!" answer.

Argh! But at least it's fixed.

No. The same mechanism is used to expand the tokens so there won't be a difference.

Good! Saves the hassle of trying to create a simple version for debugging.

and in case anyone's wondering, yeah, I asked the client about standardizing on one date format and on having the space before .xlsx or not rather than both. Very politely. :slight_smile:

1 Like

Oh, I did that first. LOL... Couldn't repro on desktop.

1 Like

Just a tip that might save you hassle in future.

You could try setting a variable to your tokenised string like this:


and then quoting the variable in your If and Open actions like this:


This just makes things a lot easier to (a) read and (b) check.

1 Like

Believe me, I've considered it this morning!