Re: Scripting DC Replication

Tech-Archive recommends: Fix windows errors by optimizing your registry



Umesh and Fosco, than you both for your time. I'll take a look at your
suggestions, but it looks like you both helped me save some valuable time -
not to mention right-click RSI !!

Thanks Again,
Orb.


"Fosco" <fake@xxxxxxxxxxxx> wrote in message
news:SI5Rf.11428$6e2.5866@xxxxxxxxxxxxxxxxxxxxx
"Orbital"
... Highlight NTDS settings, highlight DC's in right pane, right click
'Replicate Now', hit okay, then do the other three DC's, what a pain!
Does
anyone have anything to replicate DC's in a single click file?

NOT in reliable way with WSH but with :
http://www.hiddensoft.com/autoit3/

I have not XP for testing >> generic sample (my private test) with
Autoit3 and
ccleaner http://www.ccleaner.com/ :


Dim $primary
Dim $secondary
;Determine if user has swapped right and left mouse buttons
$k = RegRead("HKEY_CURRENT_USER\Control Panel\Mouse", "SwapMouseButtons")
; watch line wrap ^^^^^^^^^^^^^
If $k = 1 Then
$primary = "right"
$secondary = "left"
Else ;normal (also case if could not read registry key)
$primary = "left"
$secondary = "right"
EndIf

Run("C:\PROGRA~1\CCLEANER\CCLEANER.EXE")
AutoItSetOption("WinTitleMatchMode", 4)
WinWaitActive( "CCleaner", "", 5 )
ControlFocus ( "CCleaner","" , "ThunderRT6CommandButton1" )
ControlClick ( "CCleaner", "" , "ThunderRT6CommandButton1","$primary" )
sleep(1500)
$a =ControlCommand ( "CCleaner", "",
"ThunderRT6CommandButton2","IsEnabled", "" )
; watch line wrap ^^^^^^^^^^^^^
while $a = 0
sleep(500)
$a =ControlCommand ( "CCleaner", "",
"ThunderRT6CommandButton2","IsEnabled", "" )
; watch line wrap ^^^^^^^^^^^^^
Wend
sleep(1000)
$text = WinGetText("CCleaner", "")
$temp1 ="c:\windows\temp\tmp.tmp"
$file = FileOpen($temp1, 1)
; Check if file opened for writing OK
If $file = -1 Then
MsgBox(0, "Error", "Unable to open file.")
Exit
EndIf
FileWrite($file, $text & @CRLF)
FileClose($file)
$file = FileOpen("c:\windows\temp\tmp.tmp", 0)
If $file = -1 Then
MsgBox(0, "Error", "Unable to open file.")
Exit
EndIf
$line = FileReadLine($file,5)
MsgBox(0, "Char read:", $line)
FileClose($file)
If $line = "0 bytes to be removed. (Approximate size)" Then
MsgBox(0, "0 bytes","")

exit
else
sleep(500)
ControlFocus ( "CCleaner","" , "ThunderRT6CommandButton2" )
; ControlClick ( "CCleaner", "" , "ThunderRT6CommandButton2","$primary" )
endif
FileDelete("c:\windows\temp\tmp.tmp")

; save as Test.au3


; [1] >> Mouse Control ... NOT so reliable as ControlCommand

MouseClick ( "button" [, x, y [, clicks [, speed ]]] )
Example:
MouseClick("left", 0, 500, 2)

related :
MouseGetPos
Example :
$pos = MouseGetPos()
MsgBox(0, "Mouse x,y:", $pos[0] & "," & $pos[1])

--
Fosco




.


Quantcast