Jump to content

WorkFlow RunScipt use clipboard place holder , but an exception occurred in the python split() function.


Recommended Posts

In the following code, the corresponding content of str1 and str2 are the same,

str1 is obtained from the clipboard. str2 is directly assigned. But the value is the same.

then they are split in the same way.

But the content obtained is different. I am very confused and don't know the reason. Please help me to answer.

image.thumb.png.46f5b5aebedccbd42a9ad3fc4f7a0194.png

Link to comment
2 hours ago, vitor said:

The code can’t be working as the comments suggest, because {clipboard} and other dynamic placeholders do not expand inside Run Scripts (that could interfere with the code itself). You’ll need to tell Python to get the clipboard. Examples:

 

I want to get the most recent history content in the clipboard, Not only the last one , use dynamic placeholders are convenient and direct. 

It seems that the two ways you provide can not get previous clipboard history....

Link to comment
Just now, SummerChill said:

I tried to use {var:str1}

 

Again, you can’t use dynamic placeholders inside scripts, there would be no way to distinguish them from code.

 

1 minute ago, SummerChill said:

how to get it in the runscript component(python interpreter)

 

Those are passed in as environment variables, so you read them like:

 

import os

os.environ['str0']

 

To read the argument instead of the variable, follow the placeholder example:

 

import sys

sys.argv[1]

 

Link to comment
27 minutes ago, vitor said:

 

Again, you can’t use dynamic placeholders inside scripts, there would be no way to distinguish them from code.

 

 

Those are passed in as environment variables, so you read them like:

 

import os

os.environ['str0']

 

To read the argument instead of the variable, follow the placeholder example:

 

import sys

sys.argv[1]

 

 

Hi vitor!   

Thank you very much for your patience to explain to me. This problem has troubled me for a day, and finally solved my problem through your reply.😀👍

 

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...