Author Topic: Pasting data - Using VA to post screenshots from ShareX  (Read 5920 times)

Exigeous

  • Newbie
  • *
  • Posts: 23
Pasting data - Using VA to post screenshots from ShareX
« on: September 05, 2016, 12:30:32 PM »
Here's what I'm trying to do and how I've tried, and failed, to do it.

- Say "Share Screenshot"
- VA executes a keypress to have ShareX grab a screenshot (works)
- ShareX will then put a link to the image on your clipboard (works)
- "Show" the Discord app window (works)
- Paste the URL into the chat box and press enter (PROBLEM)
- Return focus to Elite Dangerous (previous active window) (works)

I've tried a number of methods
- Place the mouse in a specific location on screen where the chat box is (works)
- Execute a right click to bring up the "Paste" option (works)
- Move mouse so it's on "Paste" and only needs to click (works)
- Click the left button to execute the paste (PROBLEM)
- NOTE: I have tried various pauses between the presses above
- Next I tried sending "Ctrl + V" (PROBLEM)

I feel like I'm so close to making this work but am missing the best way to get the clipboard URL pasted into the Discord chat window and entered.  That way when I'm in game playing with friends and want to share a screenshot with them I simply say "Share Screen Shot" and bazinga, it's sent to them without me ever removing my Rift headset and breaking immersion.

What am I doing wrong?  What's the best way to make this work??

Thanks for any help you can provide!

iceblast

  • Sr. Member
  • ****
  • Posts: 374
Re: Pasting data - Using VA to post screenshots from ShareX
« Reply #1 on: September 05, 2016, 12:51:49 PM »
Is what happening, the moment you hit the Left Mouse button the mouse menu closes, but doesn't activate paste?

iceblast

  • Sr. Member
  • ****
  • Posts: 374
Re: Pasting data - Using VA to post screenshots from ShareX
« Reply #2 on: September 05, 2016, 01:06:52 PM »
Here, download this file, and have VA run it, instead of VA Left Clicking.

The only thing it will do is hit the Left Mouse button.

So, if VA can move the mouse into the correct position, this will click the button.

I also have problems with mouse actions with VA. What I think happens is, that VA is making it's self the active window for a split second, and that causes the issue. At least it use to do that, not sure what it's doing now. On some programs, I can't have VA interact with menu's at all. So, had to find another way.

If there is another solution with just VA, I don't know what it is. This might work, or not. It's simple though.

Maybe one of the other guys might have a better solution, let me know if this helps. :)

http://www.filedropper.com/leftclick

Exigeous

  • Newbie
  • *
  • Posts: 23
Re: Pasting data - Using VA to post screenshots from ShareX
« Reply #3 on: September 05, 2016, 05:23:13 PM »
Thanks very much for the help, I'll give your workaround a try soon.  I think you're right about the focus changing as I see the active window state change back and forth very quickly.  You're also right that everything works properly all the way to the left click event, it's then that it basically stops working.  If I can get your left click to work I'd be able to click paste then click "Post" to share the link into chat.

I'll certainly reply back once I can try your workaround - again thanks for helping out.

-Ross

Exigeous

  • Newbie
  • *
  • Posts: 23
Re: Pasting data - Using VA to post screenshots from ShareX
« Reply #4 on: September 07, 2016, 06:07:49 PM »
I just wanted to reply back and say a big thank you, especially for your little "click" executable.  Hopefully it's not stealing all my credit card information or anything as it works great ;-)

Thanks to that I was finally able to get this all working.  In short here's my script:

- I say "Share Screen to Discord"
- VA executes a hotkey to activate ShareX
- ShareX has a script that switches to Elite Dangerous and grabs a screenshot
- ShareX then uploads that screenshot to Imgur
- ShareX then puts the URL for the screenshot on my clipboard
- VA pauses 7.5 seconds (to wait for the upload, I can't find a programmatic way to know when the upload is complete)
- VA moves my cursor to the Discord chat input window
  (I have to make sure Discord opens in the correct location, not too hard)
- VA right clicks to get the "Paste" menu to appear
- VA moves the cursor over "Paste"
- VA executes the "Click" executable from this thread (this saved my bacon!!!)
- VA then executes an "Enter" keypress

DONE.  After the first cursor move to the Discord window I add .5 second pauses between each step.  I tested everything between .2 and .5 and found that .5 was the fastest that was still reliable.  The only part of this that is less than rock solid is waiting for ShareX to upload to Imugr.  Usually that only takes a few seconds but at times it'll take 10+  At first I had the script wait only 5 seconds which was often too short or up to 10 which is usually way too long.  Oh and note that I'm wearing my Rift VR headset during all this so once I execute the commands I have to stay very still so the screenshot is what I want and focus returns properly.  I did recently add an AutoHotkey script that when it sees input from a specific joystick, like my Warthog, focus returns to Elite.

So finally with all this I can share what I'm looking at with friends without ever breaking immersion - I have to admit it's f'ing fantastic.  I sing VA's praises to every person I play with - if you're reading this you already know how fantastic it is!!!

Again thanks so much for helping me make this work!

-Ross

iceblast

  • Sr. Member
  • ****
  • Posts: 374
Re: Pasting data - Using VA to post screenshots from ShareX
« Reply #5 on: September 07, 2016, 08:04:45 PM »
Glad to hear that Left Click file worked for you. I'm using it myself. :)

Don't worry about it stealing anything, it's just a compiled AHK script. If you like, you can make your own AHK file to run.

Here's the script code you would need.

Click

That's it, just drop that in a notepad, and save it .AHK and you'll have what I gave you. :)

Pretty simple right haha.

Anyway, glad it worked out for you.

Exigeous

  • Newbie
  • *
  • Posts: 23
Re: Pasting data - Using VA to post screenshots from ShareX
« Reply #6 on: September 13, 2016, 10:34:46 PM »
Well seems I lied, it's not quite working correctly.  The issue is the final "Enter" keypress, it simply won't execute it.  I've tried both methods, Window and Game mode.  If I manually click in the box enter works fine but I can't get VA to execute it.

What's odd is I built a little script for the comms box so I can say "Send Salute" and it types "o7" and presses enter.  While I have to be staring at the box (in VR) the enter key there always works but won't work with Discord.

Any thoughts?

iceblast

  • Sr. Member
  • ****
  • Posts: 374
Re: Pasting data - Using VA to post screenshots from ShareX
« Reply #7 on: September 14, 2016, 02:04:03 AM »
Have you tried the newest beta? It suppose to do a better job at targeting windows. It may fix your problem.

Also, have you tried using VA's Quick Input option? The Enter key might work there.

Or just have a AHK script hit Enter for you?

But if you haven't gotten the newest beta of VA, I would start there first. It fixes a lot of issues I had. I still need the Left Click script, but, it's the only AHK script I need now.