tecc Posted September 11, 2018 Posted September 11, 2018 As explained elsewhere the idea is to highlight a phone number in an e-mail, docx or PDF and to press Capslock to get get it formatted properly and pasted into our softphone client and dial the number. Problem here is twofold: - the number gets pasted and dialing starts but then interrupts (as if ESC were pressed) and then immediately dialing starts again and the call goes out - once the number has been dialed successfully and the clipboard emptied, another press on Capslockon another highlighted phone number should do the same. What happens though is that this new number does get pasted but not formatted. Any idea what's wrong with my loop/function? #include <Clipboard.au3> While ProcessExists("3CXWin8Phone.exe") HotKeySet("{CAPSLOCK}", "GetNumber") WEnd Func GetNumber() Opt("SendCapslockMode",0) Send("{CAPSLOCK OFF}") Send("^c") $n = ClipGet() $n = StringRegExpReplace("0" & $n , _ '^(?:0\+49|0\d|(0)\+(\d\d))(?:\h*\(0\))?\D*0?(\d+)\D*(\d+)\D*', "0$1$2$3$4") ClipPut ($n) WinActivate("3CX - ") WinWaitActive("3CX - ") Send("^v") Sleep(500) Send("{ENTER}") ClipPut ("") EndFunc Exit
careca Posted September 11, 2018 Posted September 11, 2018 I would try to stay as far as possible from things like this. Send("^v") It's known to give issues with ctrl keys being stuck. May be causing the issue you mentioned, or at least interfering. You dont need ctrl+v when you can send the string. You could put a small sleep in the function to make sure it isn't called 2 times with one key capslock press. Spoiler Renamer - Rename files and folders, remove portions of text from the filename etc. GPO Tool - Export/Import Group policy settings. MirrorDir - Synchronize/Backup/Mirror Folders BeatsPlayer - Music player. Params Tool - Right click an exe to see it's parameters or execute them. String Trigger - Triggers pasting text or applications or internet links on specific strings. Inconspicuous - Hide files in plain sight, not fully encrypted. Regedit Control - Registry browsing history, quickly jump into any saved key. Time4Shutdown - Write the time for shutdown in minutes. Power Profiles Tool - Set a profile as active, delete, duplicate, export and import. Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes. NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s. IUIAutomation - Topic with framework and examples Au3Record.exe
tecc Posted September 11, 2018 Author Posted September 11, 2018 Right. To rule out any issues I've temporarily switched to F11 as the hotkey and I've changed CTRL+V to Send($n & "{ENTER}") which works fine on the first run: The formatted number gets pasted and dialed and the clipboard is emptied (as CTRL+V into notepad shows). However, when I finish the call and mark a phone number and press F11 to do it again, a '0' gets pasted into the number field of the softphone client. So I removed the command to empty the clipboard but still, even with the same number marked or a new one, a '0' gets pasted into the number field every time I press F11.
careca Posted September 11, 2018 Posted September 11, 2018 (edited) I still think it's related to stuck keys, try this: before you do the second attempt, press control a couple of times and then press the f11. I think that, if the ctrl is stuck, when you do ctrl+c, the result maybe zero, as the copy fails. Edited September 11, 2018 by careca Spoiler Renamer - Rename files and folders, remove portions of text from the filename etc. GPO Tool - Export/Import Group policy settings. MirrorDir - Synchronize/Backup/Mirror Folders BeatsPlayer - Music player. Params Tool - Right click an exe to see it's parameters or execute them. String Trigger - Triggers pasting text or applications or internet links on specific strings. Inconspicuous - Hide files in plain sight, not fully encrypted. Regedit Control - Registry browsing history, quickly jump into any saved key. Time4Shutdown - Write the time for shutdown in minutes. Power Profiles Tool - Set a profile as active, delete, duplicate, export and import. Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes. NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s. IUIAutomation - Topic with framework and examples Au3Record.exe
jdelaney Posted September 11, 2018 Posted September 11, 2018 I believe send ("") clears stuck keys. I'd also recommend using _ie functions to set data rather than using send. or controlsettext if it's a gui. IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.
tecc Posted September 12, 2018 Author Posted September 12, 2018 Pressing CTRL several times before F11 again did not change the outcome, neither did sending send(""). If you think the loop itself is done properly, I'll read up on ie functons and controlsettext.
careca Posted September 12, 2018 Posted September 12, 2018 Add a msgbox after the clipput line, with the variable, just to see if the output is correct. You know, a bit of troubleshooting. Spoiler Renamer - Rename files and folders, remove portions of text from the filename etc. GPO Tool - Export/Import Group policy settings. MirrorDir - Synchronize/Backup/Mirror Folders BeatsPlayer - Music player. Params Tool - Right click an exe to see it's parameters or execute them. String Trigger - Triggers pasting text or applications or internet links on specific strings. Inconspicuous - Hide files in plain sight, not fully encrypted. Regedit Control - Registry browsing history, quickly jump into any saved key. Time4Shutdown - Write the time for shutdown in minutes. Power Profiles Tool - Set a profile as active, delete, duplicate, export and import. Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes. NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s. IUIAutomation - Topic with framework and examples Au3Record.exe
tecc Posted September 13, 2018 Author Posted September 13, 2018 (edited) After several tries I finally figured out that the command ClipPut ($n) was pointless. Since I was writing the content of the regexed $n into the client, there was no need to use the clipboard again. Since I've removed this line the script runs just fine. Thanks for you help. Gonna open a new thread cause I need to use another hotkey. Edited September 13, 2018 by tecc careca 1
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now