This is a sample script which lets you map your network share to your windows
machine/system.
This can be used/helpful in your scripting where you want to save your results
in a shared folder once you are done with test execution.
- Tools used here is AutoIT , which helps in triggering powershell commands on
windows machine and opens notepad and save it to network share.
- Benefit of using AutoIT is that you can create .exe file and can be run/trigger
from remote using .bat file etc.
;#----------------------------------------------------------------------------
;## Script Function:
;## To map network drive and open Notepad and save file to a shared location.
;##@author : P programs
;##----------------------------------------------------------------------------
Run("powershell.exe")
Sleep(1000)
;send("net use : \\\shared_folder_name /User:")
send("net use o: \\10.20.30.40\results secretPassword /User:userdemo1")
Send("{ENTER}")
Send("exit")
Send("{ENTER}")
;WinClose("powershell.exe")
sleep(1000)
Run("notepad.exe")
$handle = WinWaitActive("[CLASS:Notepad]","")
WinSetState("[CLASS:Notepad]","",@SW_MAXIMIZE)
sleep(160000)
Send("Hello there")
WinClose($handle)
$handle = WinGetHandle("[ACTIVE]")
ControlClick($handle,"","[CLASS:Button; INSTANCE:1]")
$handle = WinWaitActive("[CLASS:#32770]","")
$hw = WinGetHandle("[ACTIVE]")
ControlSetText($hw, "", "ComboBox1", "O:\results")
ControlSend($hw,"","ComboBox3","UTF-8")
;sleep(2000)
ControlClick($hw,"","[CLASS:Button; INSTANCE:1]") ;to click on the button
Reference links: http://ss64.com/nt/net_share.html
http://ss64.com/nt/net_use.html
No comments:
Post a Comment