Link to home
Start Free TrialLog in
Avatar of kriiis
kriiis

asked on

Batch file code to connect ftp server and run some process

Hi,

I am looking for the code to write a batch file to automate a process to run every hour from windows 7 client or from the server itself.

The logic is : connect to the ftp server using username/pwd, open a folder, copy the csv file created recently and save in another location with a filename <Test.csv>

Once this step done, i have to run a exe program which contains the steps using mouse click ( OPEN CSV file from saved location previously - EXPORT - OK )

As final step, to run some other batch files written already.

Any helps, is that possible to do ?
ASKER CERTIFIED SOLUTION
Avatar of Steve Knight
Steve Knight
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of kriiis
kriiis

ASKER

acutally the exe is not a office pack.. it is another software.. is that possible to control the mouse clicks by script ? is there any examples codes ? cause i am new to this scripting , batch command stuffs..
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of kriiis

ASKER

@dragon-it, I wrote some simple code like this :

Run("test.exe")
MouseClick ("left", 298,218)
MouseClick ("left", 491,512)

I have some issue for second mouse click.
1st mouse click clicks on the boutton open, this action will open another window with 3 buttons, i want to click the 3 button to open a file, so in my code i entered the value ( 491,512).
The problem is first mouse click works, but second fails to click the button. any ideas why this happens ?

The exe file is developped in java, probably, for information.
Good question...  you can do something with ControlClick I think:

ControlClick("window title", "", "[CLASS:Button; TEXT:Buttons text]")
Avatar of kriiis

ASKER

Run("test.exe")
MouseClick ("left", 298,218)
MouseMove (780,518)
ControlClick ( "Window title", "text in window","left", 786,515)

Here is my code, the mouse curson commes to the button open ( see screenshot ), but doesn't do any action.

I do anything wrong ?
Window-screen.png
Good question.  There is another parameter on the control click before the x,y which is number of clicks.... try a 1, before the co-ords.  Not on machine I can test an autoit on at the mo. sorry to check more and haven't used it regularly for a few years.

Did you try it like I suggesed with more like this... with the title of the popup window.

ControlClick("title", "", "[CLASS:Button; TEXT:Open")
Avatar of kriiis

ASKER

Yes i tried as you suggested on previous comment but It doesn't reacts. I will try this one and let u know.
If you the screen shot the button befor open is selected. It's shaded by blue. Is that something related ?
I wonder if maybe it is still focused on the other window.   Can you show use the rest of the buttons / window titles perhaps - can send to email address in my profile (click dragon-it link) if you don't want to post it for some reason.

Steve
Avatar of kriiis

ASKER

Hi !steve, its done.. you got the screenshot.
Ok, got it but shutting down for night.  Will look at it tomorrow.

Steve
Avatar of kriiis

ASKER

Thank u
Avatar of kriiis

ASKER

Hi Steve, i tried by adding 1 before co ordin... but same result, it doesnt clicks on the button.
Hmm how about going the keyboard route then.  Assuming there isn't a keyboard shortcut (e.g. Alt X) for the button does it work if you do

tab tab space
or tab tab enter

If so how about:

WinActivate ("Charger un enregistrement")
Send("{TAB 2}{SPACE}")

or

WinActivate ("Charger un enregistrement")
Send("{TAB 2}{ENTER}")

Steve
Avatar of kriiis

ASKER

Steve there is no keyboard shortcut. :( I already tried.
Another thing I tried is when I set mouse click value to 2 and move over the desktop icons and also at the window I need it works. But doesn't select the button automatically that I need.
Is this a proper app or a web page / java applet or something?
Avatar of kriiis

ASKER

Not a web page. It is an exe file. Needs java to be installed in the client. but I am unable to say it is java applet
Might want to try Robo-FTP.  It has a scripting interface designed to automate this sort of process.
I've requested that this question be deleted for the following reason:

Not enough information to confirm an answer.
Question was to get a file from CSV then automate a process.  I gave a working example of getting file by ftp which I believe he has working.
The next part was to automate an unknown exe.  Autoit should be able to do it and suggested many ways of doing this but without the EXE in front of us difficult to know what it/isn't clciking.

Accept: http:#a38286216  re: FTP
Accept: http:#a38289796 re: Autoit
Avatar of kriiis

ASKER

To follow the comment, i havent yet implemented the solution to automate. I am still looking for..
Drgon It comments are helpful, but doesnt fulfill my expectation.
happy to carry on, wasnt me who started to close this but got no feedback for 5 months...