DaleHohm Posted August 6, 2010 Share Posted August 6, 2010 (edited) I got tired of forgetting to add the area code when dialing local numbers with magicJack. Here is a simple solution... just configure for your area code and start it when magicJack starts Note that this works either when you are using a handset or if you are typing into the softphone. It keys off of a pause after entering exactly 7 digits and prepends the area code before magicJack performs the dial operation. ; mjAddLocalAreaCode.au3 ; ; AutoIt program to add local area code automatically when ; dialing a local number with magicJack ; ; Requires Autoit from http://www.autoitscript.com $sMyAreaCode = "111" ; Change to your area code $iSecondsToWait = 2.5 ; Number of seconds to wait with 7 digits entered ; before deciding you are done entering numbers ; make this too short and you may still be dialing ; make it too long and mj may dial the 7 digit # While WinExists("magicJack") If StringLen(DialString()) = 7 Then AddPrefixIfLocal() Sleep(100) WEnd Func AddPrefixIfLocal() ; Wait a configurable number of seconds and if the dial string has not ; changed, prepend the local area code to the dial string $sStart = DialString() Sleep($iSecondsToWait * 1000) If DialString() = $sStart Then ControlSetText("magicJack", "", "Edit1", $sMyAreaCode & $sStart) ControlSend("magicJack", "", "Edit1", "{End 1}") EndIf EndFunc ;==>AddPrefixIfLocal Func DialString() ; Get and return the current dial string from the magicJack softphone Return ControlGetText("magicJack", "", "Edit1") EndFunc ;==>DialString Dale Edited August 6, 2010 by DaleHohm Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model Automate input type=file (Related) Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded Better Better? IE.au3 issues with Vista - Workarounds SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead? Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble Link to comment Share on other sites More sharing options...
jaberwacky Posted August 7, 2010 Share Posted August 7, 2010 What if you're like me and you forget your own name and you forget to start it up with MagicJack? Helpful Posts and Websites: AutoIt3 Variables and Function Parameters MHz | AutoIt Wiki | Using the GUIToolTip UDF BrewManNH | Can't find what you're looking for on the Forum? Link to comment Share on other sites More sharing options...
DaleHohm Posted August 7, 2010 Author Share Posted August 7, 2010 Where's your vorpal sword, son? Wrap the main loop in another one and then drag a shortcut to this code and magicJack into your startup folder: ; mjAddLocalAreaCode.au3 ; ; AutoIt program to add local area code automatically when ; dialing a local number with magicJack ; ; Requires Autoit from http://www.autoitscript.com $sMyAreaCode = "111" ; Change to your area code $iSecondsToWait = 2.5 ; Number of seconds to wait with 7 digits entered ; before deciding you are done entering numbers ; make this too short and you may still be dialing ; make it too long and mj may dial the 7 digit # While True While WinExists("magicJack") If StringLen(DialString()) = 7 Then AddPrefixIfLocal() Sleep(100) WEnd Sleep(500) WEnd Func AddPrefixIfLocal() ; Wait a configurable number of seconds and if the dial string has not ; changed, prepend the local area code to the dial string $sStart = DialString() Sleep($iSecondsToWait * 1000) If DialString() = $sStart Then ControlSetText("magicJack", "", "Edit1", $sMyAreaCode & $sStart) ControlSend("magicJack", "", "Edit1", "{End 1}") EndIf EndFunc ;==>AddPrefixIfLocal Func DialString() ; Get and return the current dial string from the magicJack softphone Return ControlGetText("magicJack", "", "Edit1") EndFunc ;==>DialString snicker-snack! Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model Automate input type=file (Related) Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded Better Better? IE.au3 issues with Vista - Workarounds SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead? Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble Link to comment Share on other sites More sharing options...
jaberwacky Posted August 7, 2010 Share Posted August 7, 2010 (edited) I left it down there with the borogoves Edited August 7, 2010 by jaberwocky6669 Helpful Posts and Websites: AutoIt3 Variables and Function Parameters MHz | AutoIt Wiki | Using the GUIToolTip UDF BrewManNH | Can't find what you're looking for on the Forum? Link to comment Share on other sites More sharing options...
DaleHohm Posted August 25, 2010 Author Share Posted August 25, 2010 The magicJack virtual phone application has just been updated and now uses Qt, therefore, the script above no longer works. Worse, the UI uses nonstanard windows components and everything is a Qwidget control that does not respond AutoIt control functions. If anyone has had success in automating a Qt interface, please let me know. Dale Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model Automate input type=file (Related) Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded Better Better? IE.au3 issues with Vista - Workarounds SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead? Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble Link to comment Share on other sites More sharing options...
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