Advertisement
Guest User

radmin_auto_add.au3

a guest
Nov 30th, 2015
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
AutoIt 0.96 KB | None | 0 0
  1. ; get file name
  2. $saFile = FileOpenDialog( "Select file with computer names", @WorkingDir & "\", "All (*.*)", 1 )
  3. If @error Then
  4.     MsgBox( 0, "Error","No file selected" )
  5.     Exit
  6. EndIf
  7.  
  8. ; open file with list of computer names
  9. $oFile = FileOpen( $saFile, 0 )
  10.  
  11. ; Check if file opened for reading OK
  12. If $oFile = -1 Then
  13.     MsgBox( 0, "Error", "Unable to open specified file" )
  14.     Exit
  15. EndIf
  16.  
  17. ; Read in lines of text until the EOF is reached
  18. While 1
  19.     $saLine = FileReadLine( $oFile )
  20.     If @error = -1 Then
  21.         ExitLoop
  22.     EndIf
  23.  
  24.     ; Activate Radmin Viewer window
  25.     WinActivate( "Radmin Viewer" )
  26.  
  27.     ; send 'Insert' key ( 'Add new connection' ) to Radmin Viewer
  28.     Send( "{INSERT}" )
  29.    
  30.     ; wait for the 'New Connection' window
  31.     WinWait( "New Connection" );
  32.    
  33.     ; add computer name / IP address
  34.     ControlSetText( "New Connection", "", "Edit2", $saLine )
  35.    
  36.     ; send 'Enter' key to add computer
  37.     Send( "{ENTER}" )
  38. Wend
  39.  
  40. ; close file
  41. FileClose( $ofile )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement