Starstar Posted November 21, 2013 Share Posted November 21, 2013 (edited) How can i convert this code to autoit? I shall be very thankful to you. If Not Me.AllUsersPhoneBook.Entries.Contains(EntryName) Then Dim entry As RasEntry = RasEntry.CreateDialUpEntry(EntryName, PhoneNumber, RasDevice.GetDeviceByName("(PPPOE)", RasDeviceType.PPPoE) Me.AllUsersPhoneBook.Entries.Add(entry) End If Edited November 21, 2013 by Starstar Life is like a coin. You can spend it Anyway as you wish and for your kind information. "you can spend it only once." Link to comment Share on other sites More sharing options...
water Posted November 21, 2013 Share Posted November 21, 2013 If Not $Me.AllUsersPhoneBook.Entries.Contains($EntryName) Then Global $entry = $RasEntry.CreateDialUpEntry($EntryName, $PhoneNumber, $RasDevice.GetDeviceByName("(PPPOE)", $RasDeviceType.PPPoE) $Me.AllUsersPhoneBook.Entries.Add($entry) EndIf Best bet without having seen the rest of the code. And without any description what you are talking about. Starstar and Shrapnel 2 My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
Starstar Posted November 21, 2013 Author Share Posted November 21, 2013 (edited) I am trying to check an rasphone entry is exist or not? Edited November 21, 2013 by Starstar Life is like a coin. You can spend it Anyway as you wish and for your kind information. "you can spend it only once." Link to comment Share on other sites More sharing options...
water Posted November 21, 2013 Share Posted November 21, 2013 The translation I provided is the best I can do. Because I don't know if the referenced objects have been properly defined. My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
guinness Posted November 21, 2013 Share Posted November 21, 2013 Have you tried searching the Forum? I know it's an obvious question, but I have to ask. UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 Link to comment Share on other sites More sharing options...
Starstar Posted November 21, 2013 Author Share Posted November 21, 2013 Thanks a lot of you water......... Life is like a coin. You can spend it Anyway as you wish and for your kind information. "you can spend it only once." Link to comment Share on other sites More sharing options...
l3ill Posted November 21, 2013 Share Posted November 21, 2013 My Contributions... SnippetBrowser NewSciTE PathFinder Text File Manipulation FTP Connection Tester / INI File - Read, Write, Save & Load Example Link to comment Share on other sites More sharing options...
l3ill Posted November 21, 2013 Share Posted November 21, 2013 See Pic My Contributions... SnippetBrowser NewSciTE PathFinder Text File Manipulation FTP Connection Tester / INI File - Read, Write, Save & Load Example Link to comment Share on other sites More sharing options...
water Posted November 21, 2013 Share Posted November 21, 2013 The translation I provided is the best I can do. Because I don't know if the referenced objects have been properly defined. With "defined" I refer to ObjCreate or ObjGet statements to create a COM object or attach to an existing one. My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
Gianni Posted November 22, 2013 Share Posted November 22, 2013 (edited) I am trying to check an rasphone entry is exist or not? P.S. not exactly on topic and a bit late, anyway.... this should list network connections, (don't know if also RAS connections) also let you enable or disable selected connections. It uses the "netsh" command that is localized, check lines78 and 87 for correct lacalized msg (found here: http://www.eng2ita.net/forum/index.php/topic,7610.0.html) expandcollapse popup#include <GUIConstantsEx.au3> #include <Constants.au3> ;~ #include <Array.au3> #include <GuiListView.au3> #include <Process.au3> Opt("GUIOnEventMode", 1) Local $line_1, $read00, $listview, $button, $Counter, $item, $textitem, $textitem2 $netshow = "netsh interface show interface" $flushdns = "ipconfig /flushdns" $NetGui = GUICreate("Net Switch", 520, 280, -1, -1) $listview = GUICtrlCreateListView("Interface name|Admin state|State|Type", 10, 10, 500, 218) GUICtrlCreateGroup("", 10, 230, 290, 42) $button1 = GUICtrlCreateButton("Enable", 20, 244, 70, 20) GUICtrlSetTip($button1, "Enables the selected network interface") GUICtrlSetOnEvent($button1, "_button1") $button2 = GUICtrlCreateButton("Disable", 120, 244, 70, 20) GUICtrlSetTip($button2, "Disables the selected network interface") GUICtrlSetOnEvent($button2, "_button2") $button3 = GUICtrlCreateButton("Update", 220, 244, 70, 20) GUICtrlSetTip($button3, "Update the reading of the interfaces by Netsh") GUICtrlSetOnEvent($button3, "_button3") GUICtrlCreateGroup("", 320, 230, 190, 42) $button4 = GUICtrlCreateButton("Pubblic Ip", 330, 244, 70, 20) GUICtrlSetTip($button4, "Gets the public IP address and copy to clipboard") GUICtrlSetOnEvent($button4, "_button4") $button5 = GUICtrlCreateButton("Flushdns", 430, 244, 70, 20) GUICtrlSetTip($button5, "Clear your DNS cache") GUICtrlSetOnEvent($button5, "_button5") GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit") netshow() Func netshow() $readnetshow = Run($netshow, @SystemDir, @SW_HIDE, $STDOUT_CHILD) Local $line While 1 $line &= StdoutRead($readnetshow) If @error Then ExitLoop WEnd $line_1 = StringSplit($line, @CRLF);~ _ArrayDisplay($line_1) For $i = 7 To UBound($line_1) - 5 Step 2 $read00 = StringSplit($line_1[$i], @CRLF);~ _ArrayDisplay($read00) For $i1 = 1 To UBound($read00) - 1 Step 1 $readstate = StringRegExp($read00[1], "\S+", 3);~ MsgBox(1, "", $readstate[0]) ; Abilitato o Disabilitato ;~ MsgBox(1, "", $readstate[1]) ; Connessione o Disconnesso ;~ MsgBox(1, "", $readstate[2]) ; Dedicato $readconn = StringTrimLeft($read00[$i1], 47) ;~ MsgBox(1, "", $readconn) ; Nome della Connessione $item = GUICtrlCreateListViewItem($readconn & "|" & $readstate[0] & "|" & $readstate[1] & "|" & $readstate[2], $listview) Next Next _GUICtrlListView_SetExtendedListViewStyle($listview, BitOR($LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT)) _GUICtrlListView_SetColumnWidth($listview, 0, $LVSCW_AUTOSIZE); $LVSCW_AUTOSIZE $LVSCW_AUTOSIZE_USEHEADER _GUICtrlListView_SetItemSelected($listview, 0) EndFunc ;==>netshow GUISetBkColor(0xF0F4F9) GUISetState(@SW_SHOW) While 1 Sleep(10) WEnd Func _Exit() Exit EndFunc ;==>_Exit Func _refresh() _GUICtrlListView_DeleteAllItems($listview) netshow() EndFunc ;==>_refresh Func _button1() $Indices = _GUICtrlListView_GetSelectedIndices($listview) $Indices2 = StringSplit($Indices, "|") For $x = 1 To $Indices2[0] Step 1 $textitem = _GUICtrlListView_GetItemText($listview, Int($Indices2[$x])) ;~ MsgBox(4160, "Info", "Item selezionato: " & $textitem) $textitem2 = _GUICtrlListView_GetItemText($listview, Int($Indices2[$x]), 1);~ MsgBox(4160, "Info", "SubItem selezionato >>" & $textitem2 &"<<") If Not ($textitem2 = "Enabled") Then _enableadapter() Next EndFunc ;==>_button1 Func _button2() $Indices = _GUICtrlListView_GetSelectedIndices($listview) $Indices2 = StringSplit($Indices, "|") For $x = 1 To $Indices2[0] Step 1 $textitem = _GUICtrlListView_GetItemText($listview, Int($Indices2[$x])) ;~ MsgBox(4160, "Info", "Item selezionato: " & $textitem) $textitem2 = _GUICtrlListView_GetItemText($listview, Int($Indices2[$x]), 1) ;~ MsgBox(4160, "Info", "SubItem selezionato >>" & $textitem2 &"<<") If Not ($textitem2 = "Disabled") Then _disableadapter() Next EndFunc ;==>_button2 Func _button3() _refresh() EndFunc ;==>_button3 ; #FUNCTION# ========================================================================================================= ; Name...........: _GetIP ; Description ...: Retrieves the Public IP Address of a Network/Computer. ; Syntax.........: _GetIP() ; Parameters ....: None ; Requirement(s).: v3.3.2.0 or higher ; Return values .: Success - Returns Public IP Address. ; Failure - Returns -1 & sets @error = 1 ; Author ........: guinness ; Example........; Yes ;===================================================================================================================== Func _GetIP() Local $aReturn, $bRead, $sRead $bRead = InetRead("http://checkip.dyndns.org/") $sRead = BinaryToString($bRead) $aReturn = StringRegExp($sRead, '(?s)(?i)<body>Current IP Address: (.*?)</body>', 3) If @error = 0 Then Return $aReturn[0] EndIf $bRead = InetRead("http://automation.whatismyip.com/n09230945.asp") ; http://forum.whatismyip.com/f14/our-automation-rules-t241/ $sRead = BinaryToString($bRead) If @error Then Return SetError(1, 0, -1) EndIf Return $sRead EndFunc ;==>_GetIP Func _button4() $PublicIP = _GetIP() If @error <> 0 Then MsgBox(16, "Error", "Unable to get the public address") Else MsgBox(64, "Ip Address", $PublicIP) ClipPut($PublicIP) EndIf EndFunc ;==>_button4 Func _button5() $flushdnscmd = Run($flushdns, @SystemDir, @SW_HIDE, $STDOUT_CHILD) Local $lineflush While 1 $lineflush &= StdoutRead($flushdnscmd) If @error Then ExitLoop WEnd MsgBox(64, "Flushdns", $lineflush ) ;~ _RunDOS("ipconfig /flushdns") EndFunc ;==>_button5 Func _enableadapter() _RunDOS('netsh interface set interface "' & $textitem & '" enabled') _refresh() EndFunc ;==>_enableadapter Func _disableadapter() _RunDOS('netsh interface set interface "' & $textitem & '" disabled') _refresh() EndFunc ;==>_disableadapter Edited November 22, 2013 by PincoPanco Starstar 1 Chimp small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt.... 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