Sign in to follow this  
Followers 0
Starstar

How can i convert this code to autoit?

10 posts in this topic

#1 ·  Posted (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 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."

Share this post


Link to post
Share on other sites



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.

2 people like this

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

I am trying to check an rasphone entry is exist or not?

Edited 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."

Share this post


Link to post
Share on other sites

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 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Have you tried searching the Forum? I know it's an obvious question, but I have to ask.


_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_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 parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 04/09/2015

Share this post


Link to post
Share on other sites

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."

Share this post


Link to post
Share on other sites

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 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

#10 ·  Posted (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)

#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 by PincoPanco
1 person likes this

small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0