5

When I click on "execute action entity"
=>Copy to clipboard a preconfigured set of attributes of my layer.

Here's what I've done so far:

  • Open the Layer Properties dialog and head over to the Actions tab
  • Set up a new action using the following properties for the action

    Type: Windows
    Name: Copy Attribute
    Action : "copy to clipboard [%name%] - [%value1%] - [%value2%]"

but I'm not familiar with actions script semantic.

what would be the correct redaction of the action code above?

1 Answer 1

7

You could choose action-type Python and do something like this:

from PyQt4.Qt import QApplication
clipboard = QApplication.clipboard()
clipboard.setText("[% "name"%]"+","+str([% "myintegerfield"%])) 

enter image description here

2
  • Wonderful, thanks for your quick answer, works well. I just had to remove the str() since I had a syntax error...
    – Fabien
    Commented Sep 13, 2018 at 8:51
  • Hi all! I need to copy some attribute values in some fields of a layer, and paste these automatically in another layer, which have the same fields. This script could work? Can you explain briefly how this "action" works? Thanks a lot.
    – Mark
    Commented Dec 7, 2020 at 17:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.