I have another question about the script above from Korm. It is working great now, but when I copy text, the special characters are not copying correctly. Even dashes are coming out as crazy combinations of random characters when I try to copy them over. When I use ctrl-c to copy, I am able to copy all of the special characters just fine. Is there something about converting the text to string above that is messing up the special characters and can that be fixed?
Thanks in advance.
I just wanted to check in if anyone had any advice on my question above about copying special characters. It is driving me crazy. ctrl-c copies the characters just fine, but whatever copy and paste the code above is using is not translating the characters correctly (superscript 2 comes out as âˆ’1 for example) and I don’t know enough about strings to fix it. I have been trying to look this up, but am not finding anything similar.
The characters are probably not escaped before appending them to the reference URL.
Some other characters that are not translating are " which turn up as â€œ and - which turns up as â€“.
Does this occur on another macOS account?
I am just on my personal laptop and user login. I can log back in as admin and try, is that what you mean? I didn’t realize that would matter. I am happy to try it.
If you have a separate macOS user account, yes try to see if its reproducible there too.
I don’t have another user account with access to my DT3. I created another login account, but I’m not sure how to easily give the other account access to all of my files and programs. It seems like it is going to take a decent bit of time for me to figure out how to set it up to access everything. Before I do that, is there any other way to test by chance?
Is DEVONthink 3 installed in the root /Applications folder?
If so, it should be accessible by any other accounts on the machine.
You shouldn’t need anything but test data for what you’re describing.
Sorry, I meant my applescripts in DT3. I turned out to be trivial though. I am not able to run the script on special characters at all in the new account. It works fine with no special characters, but otherwise, I get this error (when trying to run the script on the text ’ Testing “here is some text” '): “Parse error: syntax error, unexpected ‘here’ (T_STRING), expecting ‘,’ or ‘)’ in Command line code on line 1”.
A screencap of the error could be useful.
Any ideas on what might be causing the strings to copy incorrectly? I just don’t know enough about strings, and I am having trouble finding the right info online. Any leads on what terms to search or where the problem might be would also be helpful. Thanks in advance!
Does anyone have any suggestions on the issue above? Search terms perhaps to help me find the issue? I’m not very familiar with strings. If the characters are not escaped before appending them to the reference URL, as cgrunenberg suggests above, what might be a way to fix that? cmd-c copies the special characters just fine, it is only when I copy them using the script that it gets messed up.
set theStringEncoded to (do shell script "php -r 'echo trim(urlencode(" & "\"" & theString & "" & "\"));'" as string)
…should probably use the
quoted form of theString.
Thank you!! But isn’t it using the quoted form of theString already?
No, in that line it’s still the selected text which might include characters that need quoting for the shell script.