wiredwrx Posted July 12, 2006 Share Posted July 12, 2006 Hello All, Using WIN XP Personal, and also, an NLite Versio of XP Pro SP2 I am trying to automate a connection to the internet using my BLackberry as a Modem. Currently, the process is as follows Start Blackberry desktop software (I can do that with Autoit no problem) Once started, I must start a "manual" modem connection using the BLackberry as a modem. I have set this up through windows, and named it BLackberry. I also created a shortcut to the connection on my desktop.HOWEVER, the shortcut does not point to an ".exe". Here is a screen capture of the "properties" of the shortcut. I can start the connection in the following ways, Start>Connect to>Blackberry or Start>Connect to>All COnnections>Blackberry or Start>Control Panel>Network Connections>Blackberry or Double clicking the Blackberry Shortcut on my desktop or Right click on the shortcut and select "connect" Here is the window info for the shortcut Press CTRL-ALT-F to pause the display. >>>>>>>>>>>> Window Details <<<<<<<<<<<<< Title: Program Manager Class: Progman Size: X: 0 Y: 0 W: 1024 H: 768 >>>>>>>>>>> Mouse Details <<<<<<<<<<< Screen: X: 116 Y: 19 Cursor ID: 2 >>>>>>>>>>> Pixel Color Under Mouse <<<<<<<<<<< RGB: Hex: 0x4A67A3 Dec: 4876195 >>>>>>>>>>> Control Under Mouse <<<<<<<<<<< Size: X: 0 Y: 0 W: 1024 H: 738 Control ID: 1 ClassNameNN: SysListView321 Text: FolderView >>>>>>>>>>> Status Bar Text <<<<<<<<<<< >>>>>>>>>>> Visible Window Text <<<<<<<<<<< FolderView >>>>>>>>>>> Hidden Window Text <<<<<<<<<<< Any help is greatly appreciated. If anyone knows of an alternative program to using the WinXP Modem connection, I would be willing to use that instead. Thanks, Michael Link to comment Share on other sites More sharing options...
evilertoaster Posted July 13, 2006 Share Posted July 13, 2006 I can think of 3 possiblities-1. Make a shortcut to the network conenction and run that with a command promt or batch file2. Use WMI to enable/disable the device3. use DevCon.exe ( http://support.microsoft.com/?kbid=311272 ) to enable the device. Link to comment Share on other sites More sharing options...
wiredwrx Posted July 13, 2006 Author Share Posted July 13, 2006 (edited) I can think of 3 possiblities-1. Make a shortcut to the network conenction and run that with a command promt or batch file2. Use WMI to enable/disable the device3. use DevCon.exe ( http://support.microsoft.com/?kbid=311272 ) to enable the device.Thanks for the reply, however, the shortcut I refer to is not just "enabling" the devise, it actually brings up the windows dialer. That dialer uses the "modem" to connect to the net.THe command line option I will look into further.I need to bring up the dialer.Michael Edited July 13, 2006 by wiredwrx Link to comment Share on other sites More sharing options...
MHz Posted July 13, 2006 Share Posted July 13, 2006 Look at using the RasDial.exe for dialup. Use RasDial /? for help at a command prompt. Link to comment Share on other sites More sharing options...
wiredwrx Posted July 16, 2006 Author Share Posted July 16, 2006 Look at using the RasDial.exe for dialup. Use RasDial /? for help at a command prompt.Well, I got everything to work as planned.It required moving the .lnk to the root of C:. I Then start CMD.exe, and run the lnk from the command prompt.Here is the script,; ----------------------------------------------------------------------------;; AutoIt Version: 3.1.0; Author: A.N.Other <myemail@nowhere.com>;; Script Function:; Template AutoIt script.;; ----------------------------------------------------------------------------; Script Start - Add your code below hereopt("wintitlematchmode",2)$BB=winexists("BlackBerry Desktop Manager")$ie=winexists("Microsoft Internet Explorer")opt("wintitlematchmode",3)$CMD=winexists("C:\WINDOWS\system32\cmd.exe")Selectcase $bb=0run("C:\Program Files\Research In Motion\BlackBerry\DesktopMgr.exe")opt("wintitlematchmode",3)winwait("Connected - BlackBerry Desktop Manager")sleep(1000)winwait("Connected - BlackBerry Desktop Manager") sleep(1000)case $bb=1opt("wintitlematchmode",3)winwait("Connected - BlackBerry Desktop Manager") sleep(1000)winwait("Connected - BlackBerry Desktop Manager") sleep(1000)endselectselectcase $cmd=1winactivate("C:\WINDOWS\system32\cmd.exe")sleep(1000)send("exit")send("{enter}")sleep(1000)run("cmd.exe")sleep(1000)send("cd\")send("{enter}")sleep(1000)send("Blackberry.lnk")send("{enter}")sleep(10000)case $cmd=0run("cmd.exe")sleep(1000)winactivate("C:\WINDOWS\system32\cmd.exe")send("cd\")send("{enter}")sleep(500)send("Blackberry.lnk")send("{enter}")sleep(10000)endselectsleep(10000)opt("wintitlematchmode",3)winactivate("C:\WINDOWS\system32\cmd.exe")send("exit")send("{enter}")Well, the next issue is, I want to run everything hidden. I want to hide the cmd.exe window, for sure, and would like to hide the "blackberry" app. Immediate minimizing would work, or perhaps making the windows transparent, but I tried both, and it either didn'tmake it tranparent, or the script would pause once the iwndow was minimized.Any help is greatly appreciated.Thanks,Michael Link to comment Share on other sites More sharing options...
FreeFry Posted July 16, 2006 Share Posted July 16, 2006 (edited) I recommend you to have a look at macros in autoit, because they can help you very much. Opt("WinTitleMatchMode", 2) Dim $PathToYourShortCut = FileGetShortName("C:\Blackberry.lnk");If needed, replace the C:\BlackBerry.lnk with the full path to your link(it does not nesecary need to be in the root of C:) If Not WinExists("BlackBerry Desktop Manager") Then Run(@ProgramFilesDir & "\Research In Motion\BlackBerry\DesktopMgr.exe") WinWait("Connected - BlackBerry Desktop Manager") EndIf RunWait(@ComSpec & " /c " & $ShortCutName, $DirToYourShortCut, @SW_HIDE) ;Now, as I do not know the window title, nor the classname of the Blackberry program as this launches you will have to get this using the AutoIt Active Window Info tool WinWait("Title of the new window") ;Your Code here... Also be sure to check out the full syntax of the Run, and RunWait commands, as one of the parameters specifies in what Folder of your hardrive they will be run in. Example, the RunWait part could also have been done this way: Dim $PathToYourShortCut = "C:\Blackberry.lnk" Dim $DirToYourShortCut = StringLeft($PathToYourShortCut, StringInStr($PathToYourShortCut, "\", 0, -1)) ;Gives you the Path to the Folder where your shortcut resigns Dim $ShortCutName = StringRight($PathToYourShortCut, StringLen($PathToYourShortCut)-StringInStr($PathToYourShortCut, "\", 0, -1)) ;Gives you the FileName of the shortcut RunWait(@ComSpec & " /c " $ShortCutName, $DirToYourShortCut, @SW_HIDE) ;Runs the CommandPrompt telling it to run the ShortCut file, but RunWait now tells cmd.exe ( @ComSpec ) to start in the shortcut's folder. Hope this helps you. Edit: Fixed some miss spellings, and added some comments Edited July 16, 2006 by FreeFry 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