Sign in to follow this  
Followers 0
ameen

running an Autioit script from a remote system

2 posts in this topic

Hi,

I have an Auotit script being created in a system with IP 10.10.5.3 and I have Mapped another system with IP 10.10.6.3 to do some actions in it by Auotoit.

Now I am running this Auotit script using an iTest tool. From a remote sytem I am logging into the system containing auotoit script(10.10.5.3) from where I am exectuing the script whose functionality is to MAP a shared folder from 10.10.6.3 and to open a folder with multiple files and copy it to the local drive of the machine containing the autoit script(10.10.5.3).And then I am deleting the copied files from the local Drive.

My issue is that the Autoit script is invoked however the execution is not getting completed. So in my iTest tool i am able to see that the execution is timed out.

But when I directly run the same script in the local machine containing the autoit script it is getting started and gets completed with in 5 seconds. Why this issue is happening? Kinldy help me out in this issue.....

I have attached the code along with this mail. kindly revert me with a solution.

This is the autoit script performing the above said functioanlity....

Send("#r",@SW_HIDE)

WinWait("Run","Type the name of a p")

If Not WinActive("Run","Type the name of a p") Then WinActivate("Run","Type the name of a p")

WinWaitActive("Run","Type the name of a p")

Send("Z:\cifsfiles{ENTER}")

WinWait("cifsfiles","FolderView")

If Not WinActive("cifsfiles","FolderView") Then WinActivate("cifsfiles","FolderView")

WinWaitActive("cifsfiles","FolderView")

Send("{CTRLDOWN}a{CTRLUP}{CTRLDOWN}c{CTRLUP}",@SW_HIDE)

Send("{LWINDOWN}r{LWINUP}",@SW_HIDE)

WinWait("Run","Type the name of a p")

If Not WinActive("Run","Type the name of a p") Then WinActivate("Run","Type the name of a p")

WinWaitActive("Run","Type the name of a p")

Send("{SHIFTDOWN}e{SHIFTUP}{SHIFTDOWN};{SHIFTUP}\cif-test{ENTER}",@SW_HIDE)

WinWait("cif-test","FolderView")

If Not WinActive("cif-test","FolderView") Then WinActivate("cif-test","FolderView")

WinWaitActive("cif-test","FolderView")

Send("{CTRLDOWN}v{CTRLUP}",@SW_HIDE)

Sleep ( 6000 )

WinWait("cif-test","FolderView")

If Not WinActive("cif-test","FolderView") Then WinActivate("cif-test","FolderView")

WinWaitActive("cif-test","FolderView")

Send("{ALTDOWN}{F4}{ALTUP}",@SW_HIDE)

WinWait("cifsfiles","FolderView")

If Not WinActive("cifsfiles","FolderView") Then WinActivate("cifsfiles","FolderView")

WinWaitActive("cifsfiles","FolderView")

Send("{ALTDOWN}{F4}{ALTUP}",@SW_HIDE)

Sleep ( 6000 )

Send("{LWINDOWN}r{LWINUP}",@SW_HIDE)

WinWait("Run","Type the name of a p")

If Not WinActive("Run","Type the name of a p") Then WinActivate("Run","Type the name of a p")

WinWaitActive("Run","Type the name of a p")

Send("{SHIFTDOWN}e{SHIFTUP}{SHIFTDOWN};{SHIFTUP}\cif-test{ENTER}",@SW_HIDE)

WinWait("cif-test","FolderView")

If Not WinActive("cif-test","FolderView") Then WinActivate("cif-test","FolderView")

WinWaitActive("cif-test","FolderView")

Send("{CTRLDOWN}a{CTRLUP}",@SW_HIDE)

Send ("{SHIFTDOWN}{DEL}{SHIFTUP}")

WinWait("Confirm Multiple File Delete","Are you sure you wan")

If Not WinActive("Confirm Multiple File Delete","Are you sure you wan") Then WinActivate("Confirm Multiple File Delete","Are you sure you wan")

WinWaitActive("Confirm Multiple File Delete","Are you sure you wan")

Send("{ENTER}",@SW_HIDE)

WinWait("cif-test","FolderView")

If Not WinActive("cif-test","FolderView") Then WinActivate("cif-test","FolderView")

WinWaitActive("cif-test","FolderView")

Send("{ALTDOWN}{F4}{ALTUP}",@SW_HIDE)

thank you...

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

You know there is a special function to map network shares to drives?

From helpfile:

Function Reference -> File, Directory and Disk Management -> DriveMapAdd

DriveMapAdd ( "device", "remote share" [, flags [, "user" [, "password"]]] )

And if your smart then you dump all that Send stuff and use native commands. The send functions probably won't work in a different language or OS.

Something like the following:

First map a drive using the above function.

Then search for all files in the mapped drive.

For every file found, copy it and then delete.

DriveMapAdd ( "device", "remote share" [, flags [, "user" [, "password"]]] ) ; Fill in all nessesary data!!

; Shows the filenames of all files in the current directory.
$search = FileFindFirstFile("*.*")  

; Check if the search was successful
If $search = -1 Then
    MsgBox(0, "Error", "No files/directories matched the search pattern")
    Exit
EndIf

While 1
    $file = FileFindNextFile($search) 
    If @error Then ExitLoop
    
    FileCopy($file, $destination)
    ; FileDelete($file) ; Use this with care!! This function Deletes all found files. Test the script first with dummy files!!
    ; MsgBox(4096, "File:", $file)
WEnd

; Close the search handle
FileClose($search)
Edited by Triblade

My active project(s): A-maze-ing generator (generates a maze)

My archived project(s): Pong3 (Multi-pinger)

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