Script to double quotes
I have a keyboard that does not have double quotes, when I need to use it, it's very difficult to remember the FN. How can I create a script so that when I press LShift + Escape it puts a double quote?
1 answer
-
answered 2022-05-06 19:53
Dean Householder
You can't create macros like this within bash. You would have to remap keyboard presses at the OS/application level.
If you're using a Mac, try Hammerspoon. If you're on a PC, try AutoHotkey.
do you know?
how many words do you know
See also questions close to this topic
-
WebView2 JS injection returns empty json string
With WebView2 for targeting Windows, I am trying to setup my own context menu. Either by selected text or by underlying element pointed by mouse click.
However, I can't get DOM element by mouse operation or even by byId. I think my JavaScript injection or WebView property setting is something wrong, but not too sure. Can anyone suggest me the resolution?
The version info.
- OS : Windows 10 Pro 21H2 19044.1682
- Visual Studio : Community 2022 17.1.6
- WebView2 : 1.0.1185.39
- Project Property: Target framework=.NET 6.0; Target OS version=10.0.19041.0
Here's the testing code
using Microsoft.Web.WebView2.Core; namespace WinFormsApp1 { public partial class Form1 : Form { public Form1() { InitializeComponent(); HTML(@"C:\temp\test.html"); } public void HTML(string url) { webView21.CoreWebView2InitializationCompleted += WebView2Control_CoreWebView2InitializationCompleted; webView21.Source = new Uri(url); } private void WebView2Control_CoreWebView2InitializationCompleted(object? sender, CoreWebView2InitializationCompletedEventArgs e) { if (!e.IsSuccess) { MessageBox.Show($"WebView2 creation failed, with exception : {e.InitializationException}"); return; } // subscribe to events we are interested in webView21.CoreWebView2.ContextMenuRequested += CoreWebView2_ContextMenuRequested; // user clicked right mouse to show context menu } private async void CoreWebView2_ContextMenuRequested(object? sender, Microsoft.Web.WebView2.Core.CoreWebView2ContextMenuRequestedEventArgs e) { IList<CoreWebView2ContextMenuItem> menuItemList = e.MenuItems; menuItemList.Clear(); // clear default menu items, like prev, next, property //GETTING SELECTED TEXT string text = e.ContextMenuTarget.HasSelection ? e.ContextMenuTarget.SelectionText : ""; // it works if (string.IsNullOrEmpty(text)) // no text selection, then examine DOM { //GET AN UNDERLYING ELEMENT FROM MOUSE POINT var result = await webView21.CoreWebView2.ExecuteScriptAsync($"document.elementFromPoint({e.Location.X},{e.Location.Y})"); //it doesn't work, just returns an empty JSON text (not null) //var result = await webView21.CoreWebView2.ExecuteScriptAsync("function foo(){return 'foo() gets called';}; foo();"); //for testing purpose, it works //var result = await webView21.CoreWebView2.ExecuteScriptAsync("function foo(){return document.getElementById('table-content'};foo();)"); //it returns an empty result } // TO DO // setup menuItem tree based on the result we got //...... //...... e.Handled = true; } } }
-
site only opens in CefSharp
zaakr.net is a site can be opened only in zaakr.exe application or through android(.apk), when opened in browser u been redirected to https://browser.zaakr.net so u download there application, (.exe) file is using cefsharp as a browser so it can access website, from 2 month i could open it from chromium as cefsharp uses chromium, now i can't access website through chromium for some reason idk, i even made a cefsharp browser myself using visual studio nothing worked all the time i been redirected to browser.zaakr.com, i want to access through any browser that have devtools available for a project, note that application zaakr.exe is still using cefsharp even the older version still can access site. i would appreciate any help, sry for any spelling mistakes, thanks.
-
Subprocess $Env:Path python: The filename, directory name, or volume label syntax is incorrect
I am trying to change the windows environment variables, but I am having trouble doing so.
Before I tried to use
os.environ()
I tried out using powershell commands and adding a string to$Env:Path
which worked, but removing it with:$env:Path = ($env:Path.Split(';') | Where-Object -FilterScript {$_ -ne $Remove}) -join ';'
however didn't seem to remove it being my path I want to add
("FFmpeg:C:\Users\user\AppData\"
) and adding it with+= C:/Users/etc..
didn't see, the way to go.Another way I tried to add vars through the Powershell commands was using
SetEnviormentVariable
and it seemed to work fine but once I restarted my PC the entry I made with it was gone.Sadly though all in the end all my powershell commands didn't work with subprocess. Whatever command it was I was using here I got:
PS C:\Users\Me123> python >>> import subprocess >>> subprocess.run("$Env:Path", shell=True) The filename, directory name, or volume label syntax is incorrect. CompletedProcess(args='$Env:Path', returncode=1)
-
How to raise error in bash if a dir does not match certain permissions?
How can I raise an error in bash if a directory at some path does not match the below permissions?
u=rwX,g=rwX,o=rwX
-
How to sort a specified column in l、Linux
This is my two column sequence, I want to combine them into 1 column and sort them in Linux, but I don't know how to write the shell script to handle them.
GGCTGCAGCTAACAGGTGA TACTCGGGGAGCTGCGG CCTCTGGCTCGCAGGTCATGGC CAGCGTCTTGCGCTCCT GCTGCAGCTACATGGTGTCG CGCTCCGCTTCTCTCTACG
The sorted results are as follows (first column first, second column second, and split by "\t")
1 GGCTGCAGCTAACAGGTGA 2 CCTCTGGCTCGCAGGTCATGGC 3 GCTGCAGCTACATGGTGTCG 4 TACTCGGGGAGCTGCGG 5 CAGCGTCTTGCGCTCCT 6 CGCTCCGCTTCTCTCTACG
what should I do?
-
Update global variable from while loop
Having trouble updating my global variable in this shell script. I have read that the variables inside the loops run on a sub shell. Can someone clarify how this works and what steps I should take.
USER_NonRecursiveSum=0.0 while [ $lineCount -le $(($USER_Num)) ] do thisTime="$STimeDuration.$NTimeDuration" USER_NonRecursiveSum=`echo "$USER_NonRecursiveSum + $thisTime" | bc` done
-
i used Powershell in a script to execute and install a app in a computer remotly, I Used psexec
well i have a little script this should execute and install one application but really in the other computer hasn't installed i'll want to install application in the other computer
the files txt have the name of the computer yours hostname, when i execute of the script i look that my computer can connect to other computer by psexec and i can watch that appears on my screen in summary "psexec v2... - execute processes remotly, copyright, sysinternals" but after the application has not installed what i can do? i have problems in the last line
& C:\pstools\psexec.exe -u $user -p $password \$destination\c$ $app
$Computers = Get-content "C:\Users\marc\Documents\computer.txt" $destination = Get-content "C:\Users\marc\Documents\destination.txt" $File= "c:\Documents\program.exe" $app="c:\program.exe /clone_wait /s /v' /qn PROGTYPE=ENTEGRA REBOOT=Supress'" Foreach ($destination in $Computers) { $Test = Test-Path -path "\\$destination\c$" If ($Test -eq $True) {Write-Host "The path exists, the software will be installed in $destination."} Else {(Write-Host " the path does not exist, therefore it will be created in $destination and the installation will start")} Echo "Copying Files to C:\$destination" Copy-Item $File "\\$destination\c$" echo "Second part : installing the software on $destination" & C:\pstools\psexec.exe -u $user -p $password \\$destination\c$ $app }
-
Xpath Changing Dynamically
Stuck at a div dropdown from where i have to count the number of options I am working with a application using selenium java using Maven & testng framework, i am stuck at xpath which is changing on every time i run the test e.g
/html/body/div[7]/div/div/div/div[2]/div[1]/div/div
The div[7] index changes everyTime like it will be differnt next time etc 9, 7
What i tried is to make the xpath dynamic is
//*[normalize-space(text()) and normalize-space(.)='Balochistan'])[1]/following::div[6]
//body//div[@class=\"rc-virtual-list-holder-inner\"]
and few more locator techniques by using this
//body//div[@class=\"rc-virtual-list-holder-inner\"]
I am getting 5 element in which i need the fourth one i tried to use the index along with it but it did not workBelow is the HTML
<div class="rc-virtual-list-holder-inner" style="display: flex; flex-direction: column;"> <div aria-selected="false" class="ant-select-item ant-select-item-option ant-select-item-option-active" title="Please Select"> <div class="ant-select-item-option-content">Please Select</div> <span class="ant-select-item-option-state" unselectable="on" aria-hidden="true" style="user-select: none;"></span> </div> <div aria-selected="false" class="ant-select-item ant-select-item-option" title="abc"> <div class="ant-select-item-option-content"></div> <span class="ant-select-item-option-state" unselectable="on" aria-hidden="true" style="user-select: none;"></span> </div> <div aria-selected="false" class="ant-select-item ant-select-item-option" title="efg"> <div class="ant-select-item-option-content"></div> <span class="ant-select-item-option-state" unselectable="on" aria-hidden="true" style="user-select: none;"></span> </div> <div aria-selected="false" class="ant-select-item ant-select-item-option" title="lol"> <div class="ant-select-item-option-content"></div> <span class="ant-select-item-option-state" unselectable="on" aria-hidden="true" style="user-select: none;"></span> </div> <div aria-selected="false" class="ant-select-item ant-select-item-option" title="lope"> <div class="ant-select-item-option-content"></div> <span class="ant-select-item-option-state" unselectable="on" aria-hidden="true" style="user-select: none;"></span> </div> <div aria-selected="false" class="ant-select-item ant-select-item-option" title="adssa"> <div class="ant-select-item-option-content"></div> <span class="ant-select-item-option-state" unselectable="on" aria-hidden="true" style="user-select: none;"></span> </div> <div aria-selected="false" class="ant-select-item ant-select-item-option" title="ddddd"> <div class="ant-select-item-option-content"></div> <span class="ant-select-item-option-state" unselectable="on" aria-hidden="true" style="user-select: none;"></span> </div> <div aria-selected="false" class="ant-select-item ant-select-item-option" title="e21e12e"> <div class="ant-select-item-option-content"></div> <span class="ant-select-item-option-state" unselectable="on" aria-hidden="true" style="user-select: none;"></span> </div> <div aria-selected="false" class="ant-select-item ant-select-item-option" title="Other"> <div class="ant-select-item-option-content">Other</div> <span class="ant-select-item-option-state" unselectable="on" aria-hidden="true" style="user-select: none;"></span> </div> </div> ```
-
Get duplicate users on AD server and append a suffix
I want to append a suffix to differentiate users having same samaccountname.
* Create new AD user * Get samaccountname of created user($newsam) * Get list of samaccountname for all users in AD ($allsams) * Match new samaccountname with list of samaccountname to detect accounts with duplicate samaccountnames * Append suffix 1 to new user samaccountname and 2,3,4.... as suffixes to others created afterward
Thanks for your help!