SummerChill Posted June 1, 2022 Share Posted June 1, 2022 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. Link to comment
vitor Posted June 1, 2022 Share Posted June 1, 2022 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:With pbpaste.With Tkinter. Link to comment
SummerChill Posted June 1, 2022 Author Share Posted June 1, 2022 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: With pbpaste. With Tkinter. 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
vitor Posted June 1, 2022 Share Posted June 1, 2022 Then use an Argument and Variables Utility to send your dynamic placeholder to the next object. Link to comment
SummerChill Posted June 1, 2022 Author Share Posted June 1, 2022 38 minutes ago, vitor said: Then use an Argument and Variables Utility to send your dynamic placeholder to the next object. I have done the above settings, how to get it in the runscript component(python interpreter)? I tried to use {var:str1}, but did not get the corresponding clipboard information. Link to comment
vitor Posted June 1, 2022 Share Posted June 1, 2022 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
SummerChill Posted June 1, 2022 Author Share Posted June 1, 2022 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
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now