Result of run to clipboard
Hi!
This maybe simple, but couldn't find it...
I have (bash.exe) script "RadomPassword" what generates random password as result. How I can copy "result of run command" automatically to clipboard?
This maybe simple, but couldn't find it...
I have (bash.exe) script "RadomPassword" what generates random password as result. How I can copy "result of run command" automatically to clipboard?
If the caret is at the end of the generated string, you can select the last word (Shift+Ctrl+Left) and copy it to clipboard. The following assumes the modifiers are turned on in Preferences/Text Expander. Type: Send
Code: Select all
!^{Left}^c
Hi!
I don't understand how I can make !^{Left}^c working. Because bash windows is closed automatically after run of the script. I I put echo -en "!^{Left}^c" at the end of my script, it wouldn't select anything.
I'm not yet good with this product.
Why "command" works, but don't work?
So, solution to my problem would be something like:
except that this don't work
I don't understand how I can make !^{Left}^c working. Because bash windows is closed automatically after run of the script. I I put echo -en "!^{Left}^c" at the end of my script, it wouldn't select anything.
I'm not yet good with this product.
Why "command"
Code: Select all
Run % "C:\Windows\" (A_Is64bitOS?"Sysnative":"System32")"\bash.exe"
Code: Select all
Run % "C:\Windows\System32\bash.exe"
So, solution to my problem would be something like:
Code: Select all
Run % "C:\Windows\" (A_Is64bitOS?"Sysnative":"System32")"\bash.exe"
Sleep 100
Send, /home/jjussi/randpass.sh
Send, !^{Left}^c
I'm not familiar with Bash. How you run is dependent on it's folder location on your system. Most probably you can run the script directly like this (one of the two should work):
Then you need to capture the result string. The solution above assumed the result is shown on a command line - how do you get it?
Code: Select all
Run C:\Windows\System32\bash.exe /home/jjussi/randpass.sh
Run C:\Windows\Sysnative\bash.exe /home/jjussi/randpass.sh
I found information that 32bit and 64bit don't mix... At C:\Windows\System32 -directory there is lot's of .exe files what you cannot start with direct Run command. You need to use that "virtual" Sysnative directory.
What comes to that my script, it echoes result to command line and then ends. When script ends, window is closed. As it is when .bat file is ran.
Anyway....
I managed to find other solution, what is "enough"
What comes to that my script, it echoes result to command line and then ends. When script ends, window is closed. As it is when .bat file is ran.
Anyway....
I managed to find other solution, what is "enough"
Code: Select all
RunWait % "C:\Windows\" (A_Is64bitOS?"Sysnative":"System32")"\bash.exe -c /home/jjussi/randpass.sh > /mnt/c/temp/randpass.txt", , Hide
FileRead, clipboard, C:\temp\randpass.txt
Last edited by JJussi on Jan 23rd, ’19, 10:41, edited 1 time in total.
This is getting interesting.
Same code at "Start Menu" works fine, but not as "Shortcuts".
Both run that first "RunWait" commmand and result is saved to that temporary file. Only at "Start Menu" version that result is read to the clipboard. With Shortcuts version, nothing is inserted to clipboard.
Same code at "Start Menu" works fine, but not as "Shortcuts".
Both run that first "RunWait" commmand and result is saved to that temporary file. Only at "Start Menu" version that result is read to the clipboard. With Shortcuts version, nothing is inserted to clipboard.
Maybe a short pause is needed before FileRead.
I tested that too.. At least, 100 ms pause didn't do any difference. And anyway, that content should be at filecache.
If the command is the same there is no reason this would not work. For example, I tried the similar code below and it works in both, Shortcuts and Start Menu.
Code: Select all
FileAppend, % "This is a test", Test.txt
FileRead, clipboard, Test.txt
FileDelete, Test.txt
Yes, you are right. Same code should work both cases. But at least my case it didn't.
First I made (and tested) that code as "Start menu" -item.
Then I copy paste that code to Shortcut item and noticed that it don't work.
Then I created new Start menu item, just right clicking that Shortcut item and selecting "Copy to start menu" and that start menu item worked as it should be.
All those three versions should work, but...
First I made (and tested) that code as "Start menu" -item.
Then I copy paste that code to Shortcut item and noticed that it don't work.
Then I created new Start menu item, just right clicking that Shortcut item and selecting "Copy to start menu" and that start menu item worked as it should be.
All those three versions should work, but...