Jump to content

Recommended Posts

Posted

Please help me to convert this script, something is wrong...

thanks a lot,

Local $WshShell, $wshnetwork, $strUser, $strComputer, $objWMIService, $WScript, $DR, $Array, $i, $IPConfig, $IPConfigSet

$WshShell = CreateObject("WScript.Shell")

$wshnetwork = $WScript.CreateObject("WScript.Network" )

$strUser = $wshnetwork.username

$strComputer = "."

$objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & $strComputer & "\root\cimv2")

$IPConfigSet = $objWMIService.ExecQuery ("Select * from Win32_NetworkAdapterConfiguration Where IPEnabled=TRUE")

For $IPConfig in $IPConfigSet

If Not IsNull($IPConfig.IPAddress) Then

For $i=LBound($IPConfig.IPAddress) to UBound($IPConfig.IPAddress)

for $j = 0 to ubound ($DR);parcours tableau DR

if left($IPConfig.IPAddress($i),8) = $DR($j) then ;test de l'IP si @ DR

$WshShell.Run ("outlook.exe /importprf c:\francelot\PRF_info.prf" ) ;Execution du PRF DR

$chemin_dr = "\\"& left($IPConfig.IPAddress($i),8)&"1"&"\"&"users$"& "\"&$strUser&"\outlook\outlook.pst"

Send("{F10}")

Send("{DOWN}")

Send("{DOWN}")

Send("{ENTER}")

Send("{ENTER}")

Send("{DOWN}")

Send("{DOWN}")

Send("{ENTER}")

send("$chemin_dr")

Send("{TAB}")

Send("{TAB}")

Send("{ENTER}")

Send("{TAB 7}")

Send("{ENTER}")

else

$chemin_bureau = "c:\Document and settings\"&$strUser&"\Local Settings\Application Data\Microsoft\Outlook\Outlook.pst"

$WshShell.Run ("outlook.exe /importprf c:\francelot\PRF_bureaux.prf" );Execution du PRF Bureau

Send("{F10}")

Send("{DOWN}")

Send("{DOWN}")

Send("{ENTER}")

Send("{ENTER}")

Send("{DOWN}")

Send("{DOWN}")

Send("{ENTER}")

send("$chemin_dr")

Send("{TAB}")

Send("{TAB}")

Send("{ENTER}")

Send("{TAB 7}")

Send("{ENTER}")

$wscript.quit

EndIf

Next

Next

EndIf

Next

  • 3 weeks later...
Posted (edited)

Here is a start - I converted some functions - but I don't know an AutoIt equivalent for "LBound" on line 12:

Local $WshShell, $wshnetwork, $strUser, $strComputer, $objWMIService, $WScript, $DR, $Array, $i, $IPConfig, $IPConfigSet
$WshShell = ObjCreate("WScript.Shell")
$wshnetwork = ObjCreate("WScript.Network")
$strUser = $wshnetwork.username
$strComputer = "."

$objWMIService = ObjGet("winmgmts:" & "{impersonationLevel=impersonate}!\\" & $strComputer & "\root\cimv2")
$IPConfigSet = $objWMIService.ExecQuery("Select * from Win32_NetworkAdapterConfiguration Where IPEnabled=TRUE")

For $IPConfig In $IPConfigSet
    If $IPConfig.IPAddress <> "" Then
        For $i = LBound($IPConfig.IPAddress) To UBound($IPConfig.IPAddress)
            For $j = 0 To UBound($DR);parcours tableau DR
                If StringLeft($IPConfig.IPAddress($i), 8) = $DR($j) Then;test de l'IP si @ DR
                    $WshShell.Run("outlook.exe /importprf c:\francelot\PRF_info.prf");Execution du PRF DR
                    $chemin_dr = "\\" & StringLeft($IPConfig.IPAddress($i), 8) & "1" & "\" & "users$" & "\" & $strUser & "\outlook\outlook.pst"
                    Send("{F10}")
                    Send("{DOWN}")
                    Send("{DOWN}")
                    Send("{ENTER}")
                    Send("{ENTER}")
                    Send("{DOWN}")
                    Send("{DOWN}")
                    Send("{ENTER}")
                    Send($chemin_dr)
                    Send("{TAB}")
                    Send("{TAB}")
                    Send("{ENTER}")
                    Send("{TAB 7}")
                    Send("{ENTER}")
                Else
                    $chemin_bureau = "c:\Document and settings\" & $strUser & "\Local Settings\Application Data\Microsoft\Outlook\Outlook.pst"
                    $WshShell.Run("outlook.exe /importprf c:\francelot\PRF_bureaux.prf");Execution du PRF Bureau
                    Send("{F10}")
                    Send("{DOWN}")
                    Send("{DOWN}")
                    Send("{ENTER}")
                    Send("{ENTER}")
                    Send("{DOWN}")
                    Send("{DOWN}")
                    Send("{ENTER}")
                    Send($chemin_dr)
                    Send("{TAB}")
                    Send("{TAB}")
                    Send("{ENTER}")
                    Send("{TAB 7}")
                    Send("{ENTER}")
                    $WScript.quit
                EndIf
            Next
        Next
    EndIf
Next
Edited by Squirrely1

Das Häschen benutzt Radar

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...