I'm having trouble setting up phraseexpress to run bash shell command and paste its output to text field. I looked all over the forums and docs but found no solution whatsoever.
For example, I want to paste the output of `curl 'https://api.ipify.org'` using bash shell on Windows.
Type: Run program
File Path: C:\Program Files\Git\bin\bash.exe
Parameters: curl 'https://api.ipify.org'
Actual output: opens bash terminal window briefly and then closes.
Expected output: paste the output of command `curl 'https://api.ipify.org'` to the text field.
It would open lots of possibilities if we could run bash/powershell/wsl commands and process output into text fields.
How to run shell command and paste its output? SOLVED
-
- PhraseExpress Expert
- Posts: 920
- Joined: 27 Feb 08, 15:07
@ jerry_goyal
Maybe it helps if you use the #focus-macro before inserting in the input field?
Peter Stotz
Windows 10 - PhraseExpress v15.0.81
Maybe it helps if you use the #focus-macro before inserting in the input field?
Peter Stotz
Windows 10 - PhraseExpress v15.0.81
-
- Posts: 7
- Joined: 11 Apr 20, 13:11
I don't think that would work because the text is not available at all for pasting it into applications. the command `curl 'https://api.ipify.org'`when executed in bash shell gives the public ip address of PC for ex: (21.123.45.98). But here when using 'run program', phraseexpress is invoking the shell, passing this command as parameter and that's all. The output text is not carried at all to the phraseexpress.
-
- Posts: 7
- Joined: 11 Apr 20, 13:11
Friendly ping. Is there any way to run bash/powershell commands and paste the output of commands back in the current application window?
-
- Posts: 2798
- Joined: 10 Feb 06, 22:23
Well, a possible solution would be writing the output to a file:
It is just not very nice, that we cannot wait for the file, so a sleep for 3 seconds is used here.
Code: Select all
{#run -file "powershell.exe" -params "-command "curl 'https://api.ipify.org' | Select-Object -ExpandProperty Content > d:\out.txt"" -variablename Windows PowerShell}{#sleep 3000 -variablename Wait}{#insertfile D:\out.txt -variablename Output file}
-
- Posts: 7
- Joined: 11 Apr 20, 13:11
Thanks, Although the instant flash of powershell window and 3 second timer ruins the beauty of automation.
May I suggest that shell scripting execution should be supported natively in PhraseExpress.
May I suggest that shell scripting execution should be supported natively in PhraseExpress.
-
- Posts: 2798
- Joined: 10 Feb 06, 22:23
You can decrease the wait time, of course.
We will add shell scripting support to our todo list.
We will add shell scripting support to our todo list.