4

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?

4

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

  • Wonderful, thanks for your quick answer, works well. I just had to remove the str() since I had a syntax error... – Fabien Sep 13 '18 at 8:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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