
tecc
Active Members-
Posts
21 -
Joined
-
Last visited
Everything posted by tecc
-
Hi guys, I've written a short script that runs through the for while loop just fine... until it suddenly does no longer. The $i has not reached it's limit yet but it suddenly won't work any more. Is there a way to see at what line exactly the script has halted on? Would also be nice to see a debug window that shows what vaule the variables have been assigned during that certain loop. Is this possible.
-
That works, thx! If anyone has an idea on how to remap the FN or CAPSLOCK key, I'd still be interested.
-
Thanks, but I've seen this and it did not work initially. After Windows and 3CX having been updated, the hotkey works but since I was planning on starting with AutoIt anyway, I thought this would be a good first program. With it I can reduce the amount of clicks from 3 (CTRl+V, hotkey, ENTER) to 1 (my hotkey) as well as format the numbers that I get from email signatures etc; in a few cases 3CX would not dial the way they were formatted. So, I'd really appreciate it if someone could answer my questions concerning the workaround to my Capslock problem. I'm thinking of another widget to code where setting a hotkey like SHIFT+1 would come in handy.
-
Mmh, I don't get the logic behind the loop then. I did as you suggested and it still works which is nice but how exactly does a loop work if there's no commands inside the keywords? While ProcessExists("3CXWin8Phone.exe") WEnd As far as I can tell, the softphone does not offer a hotkey for this. OTOH I might suck at searching cause I didn't find any way to intercept keypresses for Capslock and Co on this forum nor for these workarounds: - what command reliably sets the Capslock key to it's usual off state? - how can I set SHIFT+1 as a hotkey instead? HotKeySet("{SHIFT}+1", "GetNumber") does not work.
-
I'm using this script #include <Clipboard.au3> While ProcessExists("3CXWin8Phone.exe") HotKeySet("{F11}", "GetNumber") WEnd Func GetNumber() 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") WinActivate("3CX - ") WinWaitActive("3CX - ") Send($n & "{ENTER}") EndFunc Exit to dial a number I've highlighted in a mail, a PDF or elsewhere. It works just fine but I'd like to use a different hotkey, preferrably Capslock since I don't ever use it. However, when I replace F11 by CAPSLOCK the script behaves erratically, sometimes the Capslock LED flickers, sometimes text instead of digits gets pasted into the softophone client etc. Is there a way to use capslock reliably from a script? I would like to use it as a hotkey only and have it immediately turned off so I don't type in caps afterwards. Alternatively, how would I use SHIFT+1 as a hotkey or better yet FN+1?
-
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.
-
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.
-
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.
-
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
-
Found it, Opt("SendCapslockMode",0) Send("{CAPSLOCK OFF}") works!
-
I get that and I appreciate everyone's help on this. I really didn't expect some more weird phone number formats to pop up and since this is my first time at coding/scripting stuff, it's a bit much. I had to read up on what an array is and I'm really glad your regex one-liner works. I'm still confused as to why my workaround StringReplace($n,5,"",1,2) didn't. I also haven't found a way to turn off caps-lock after I've used it as a hotkey to copy the number to clipboard like this: HotKeySet("{CAPSLOCK}", "GetNumber") While 1 Sleep(100) WEnd Func GetNumber() $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") Msgbox(0,"", $n) EndFunc Exit When I replace Msgbox with Send capslock off, it's still on and the LED is lit.
-
Yes, and I like it, so I tried it like this: $n = ClipGet() $n = StringRegExpReplace($n, '^(\s*\+(\d\d)(\h*\(0\))?)', "00$2") $n = StringRegExpReplace($n, '(^0\K049|\s*)', "") $n = StringRegExpReplace($n, '[^0-9]',"") If StringRegExp($n, '^00\d\d0') = 1 Then $n = StringReplace($n,5,"",1,2) EndIf Msgbox(0,"", $n) Exit I've added those two lines cause while sorting my inbox in the meantime I've stumbled on two more formats being used in customers' signatures: 02134/55564-0 +41 01234 567890 So my first line gets rid of all none digits and my If-statement is supposed to delete the extra zero in a number like '0041 01234 567890' but curiously enough I have to replace it with another char or white space, cause replaceing it with "" just doesn't work. I could of course switch the order of those lines of code but I wonder why that is.
-
Maybe I'm pasting this wrong into my script (where I simply get one number from clipboard) but +49 1234 567890 formats to 0234567890 and +49 2345 55555 formats to +49 2345 55555 Maybe because of my preferred handling of +49 we actually need more than one expression as mikell suggested?
-
@mikell Right, I just thought it would be more elegant and I'm also quite amazed at the seeming complexity of such an expression. @Bowmore Works like a charme, 2 things though: - can you expand your expression to keep only digits? - I've just encountered this pattern in a customer's signature which isn't handled yet by your expression: '+49 1234 567890' should also be formatted to '01234567890' @all I'm thinking about what's the best way to activate this function. Should I add a hotkey to Windows to fire up the compiled script or have the script resident in memory sleeping and waiting for the designated hotkey to be pressed to copy the number over to clipboard? I guess with today's CPU speeds polling for the hotkey won't tax resources too much?
-
Since our telephone system sucks and can only dial numbers from Outlook contacts that nobody bothers to maintain, I could use a small script to dial numbers by marking them in a mail or webpage and then pasting this into the phone client. Of course the strings need to be formatted properly, like this +49 (0) 1234 567890 -> 01234 567890 +49 1234 567890 -> 01234 567890 01234 567890 -> 01234 567890 +34 (0) 1234 567890 -> 0034 1234 567890 +41 1234 567890 -> 0041 1234 567890 The added wrinkle here is that all occurences of +49 should be replaced by one 0 but all other numbers starting with a + should be replaced with two 0. Any ideas how to do this?
-
Match Window Title with Regex only when word not present
tecc replied to tecc's topic in AutoIt General Help and Support
Junkew, I've confirmed your regex to work as well on regex101 but when added to the script, it still only switches to the calendar but never to Outlook mail. I've also tried your hwhandle approach, unfortunately to no avail either. Looks like I'm gonna have to stick to WIN+1 etc. to switch, thanks though. -
Match Window Title with Regex only when word not present
tecc replied to tecc's topic in AutoIt General Help and Support
@junkew I may not have worded it very good but right from the beginning I said that was using different users as well as pretty much any folder in Outlook mail. Which is the reason why I think regex is the way to go here. Yeah, I've seen this and it looks good. However, when I copy over your code from August 26th and press the corresponding key after executing the script, I don't get Outlook Mail. I do however get Outlook Calendar. So while the regex seems correct, something with the implementation seems to be off (on my system). Also, in the meantime I've been made aware that having programs attached to the taskbar in Windows 10 allows you to start/switch to them using WIN+1 for the first program and so on. Problem here is that if you've opened Outlook Mail, notification and calendar, you'll have to press the number thrice to get to the last window of the programs grouped together. Therefore I'd still like to see your approach work while I'd like to add another wrinkle: my keyboard at work dual uses some of the regular keys as pointless multimedia keys activated by the FN key. Is there a way to use this one as a hotkey? FN+2 could be used to start a program. And what about redesignating the CAPS LOCK key? I've never use it anyway. -
Match Window Title with Regex only when word not present
tecc replied to tecc's topic in AutoIt General Help and Support
How do you mean? Even with one window, the window title can read Kalender - user1@company.com - outlook Kalender - user2@company.com - outlook Kalender - user3@company.com - outlook inbox - user1@company.com - outlook inbox - user2@company.com - outlook inbox - user3@company.com - outlook sent - user1@company.com - outlook sent - user2@company.com - outlook sent - user3@company.com - outlook waiting - user1@company.com - outlook waiting - user2@company.com - outlook waiting - user3@company.com - outlook etc. Yes, I have. I even tried it on regex101.com with the test string 'Kalender - user1@firma.de - outlook' which still gets selected from the first character after the word 'kalender'. What I expected from the regex was to not select any part of it as long as the title contains the word 'kalender'. -
Match Window Title with Regex only when word not present
tecc replied to tecc's topic in AutoIt General Help and Support
Because, as I wrote above, it can be any one of 3 different user names in that title as well as more than 10 folder names. That's a lot of combinations. So the easiest way would be to filter for " - Outlook" without "Kalender" in it. Unfortunately Jchd's Regex from above does not work. -
Match Window Title with Regex only when word not present
tecc replied to tecc's topic in AutoIt General Help and Support
Sorry guys, I've been using this to open the Outlook Calendar #include <MsgBoxConstants.au3> HotKeySet("{F2}", "_programm2") HotKeySet("{F3}", "_programm3") Func _programm2() if ProcessExists("outlook.exe") then Opt("WinTitleMatchMode", 2) WinActivate("Kalender - ") EndIf EndFunc but I have no idea how to adapt your suggestions into the WinActivate line when I want to match " - Outlook" but at the same time not match "Kalender". Something like this? Func _programm3() if ProcessExists("outlook.exe") then Opt("WinTitleMatchMode", 2) WinActivate("[REGEXPTITLE:(?<!^kalender) - .* - outlook")]") EndIf EndFunc -
I plan on using F2 - F11 as hotkeys to switch between open programs which works fine. However, I use Outlook Mail and Outlook Calendar with different users which results in similar window titles: Kalender - user@firma.de - Outlook Posteingang - user@firma.de - Outlook So if I match for " - Outlook", both windows would qualify and since I might be in any folder in Outlook Mail, I can't match "Posteingang" (Inbox) either. So I think, I should use a Regex to match " - Outlook" only if the Windows Title does not also include "Kalender". What regex do I use and how do I implement it in AutoIt? Thx!