Page 1 of 1

Multiple action in one interaction

Posted: Thu May 17, 2018 3:58 pm
by n01a
Simple example... I was trying your "play a song" script.... If you request another song while the first one is still playing, 2 browser instances will overrun each other...

Easiest way to solve this problem is closing chrome with a separate command [taskkill /F /IM chrome.exe] and request another song after that but it's way more natural to collapse the kill and the launch in one interaction only.

Re: Multiple action in one interaction

Posted: Thu May 17, 2018 6:14 pm
by RobLatour
Hi,

Thanks for your feedback.

Actually, you can already do this by putting multiple actions into a batch (.bat) file, vb script, or depending on what you want to do an autohotkey script - and have Push2Run open that file/script.

Rob

Re: Multiple action in one interaction

Posted: Fri May 18, 2018 7:08 pm
by cicalinarrot
Hi,
even though there's the script method, I'd still love to have a multiple actions option directly in P2R, because things may get a little tricky, as in the case I'd like to transmit something to the script.
For example, I was trying to make my song-search request to open both the song on youtube (as in the duckduckgo card) and a google search with the song's lyrics. So I'll have to get the "$" parameter into the script. I still haven't looked for a way to do this, I bet it's not that hard, but still harder than just having multiple actions to add in the application. Ok, I'm a bit of a lazy user :D
Hope you're considering this.
Thanks

Re: Multiple action in one interaction

Posted: Fri May 18, 2018 10:05 pm
by RobLatour
your right it is quite easy - and I can't image I could be more flexible inside Push2Run than you could be in a .bat or scirpt file.

In any case, using Push2Run you pass a parameter into a batch file through the parameters field

for example, in the Push2Run card's open field, you just type the name of the batch file:
c:\temp\test.bat

and the Push2Run parameters field you can type either
$
or
"$"

if you just use the dollar sign (without being surrounded by the quotes) the parms will be available in the .bat file as %1 %2 %3 etc for each word in the phrase which the $ represents. That is to say, if the phrase is 'red wagon' then %1 would be 'red' and %2 would be 'wagon'

if you use the dollar sign surrounded by double quotes the whole phrase will be available in the .bat file as %1. That is to say %1 would be 'red wagon'.

in that way, for example, the file c:\temp\test.bat could contain these three lines such as:

call "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" https://www.google.com/search?q=%1
call "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" https://www.bing.com/search?q=%1
call "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" https://ca.search.yahoo.com/yhs/search?p=%1

doing all three searches at once.

Re: Multiple action in one interaction

Posted: Sat May 19, 2018 8:47 am
by cicalinarrot
I had some issues with the "&" in urls to put "feeling lucky" and other parameters inside. Escaping with "^&" didn't work, in the end I just put the url in quotes. This is the final script, opening the lyrics and the song on youtube.

Code: Select all

call "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" "http://www.google.com/webhp?#q="+%1+"lyrics&btnI=I"
call "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" "http://www.google.com/webhp?#q="+%1+"&btnI=I&as_sitesearch=youtube.com"
As usual, thank you for your quick and accurate reply, Rob.
Have a good day!

Re: Multiple action in one interaction

Posted: Sun May 20, 2018 3:08 pm
by n01a
ok thanks, good to know...