I use system.perspective.print
a ton, especially in an involved script. On a previous keyboard I had, I had a hotkey mapping to where I'd press two keys simultaneously and it'd insert system.perspective.print("
for me, which was nice.
I decided to try to shorten this call so it would save me a few character types - whether it accomplishes this or not, you be the judge....
Step 1: Create a new script called sp
(or whatever you'd like to call it)
Go to the Scripting section of the designer, right-click and add a new script - I called mine sp
.
Step 2: Add script
def pr(msg, self):
pageId = self.page.id
sessionId = self.session.props.id
system.perspective.print(msg, pageId=pageId, sessionId=sessionId)
The reason why I didn't just use print
is because I got a syntax error and I figured it wouldn't be worth digging into it.
EDIT - STEP NOT NEEDED (thanks pturmel!) Step 3: Import sp
into your onActionPerformed
script, for example
sp
into your onActionPerformed
script, for example#import sp
Step 4: Sit back and relax
Now, instead of typing
system.perspective.print("you got past that tricky bit haha have a coffee break")
you can just do
sp.pr("please support me on pateron for more time saving perspective tips", self)
This saves you from typing 13 characters in each print statement, which, if your script is anything like mine and you use system.perspective.print
about 350 times per script, is a whopping 4,550 characters.
You're welcome.