Topic "logic in scripts"

Author Message
david@ots.net.au
[View user's profile]

Joined: 2007-08-21
Posts: 3
Location: Australia
Hi, relatively new to scripting. I have been able to get a basic script working from a batch file but cannot find any information on using some sort of logic within the script. I.e

result=open session
IF(NOT(ISEQUAL(result,"OK")))
CALL(blat_cmd_line1)
SLEEP(5)
EXIT(1)
END IF

Any help or examples would be appreciated.
Advertisements
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24996
Location: Prague, Czechia
There's no logic implemented.
_________________
Martin Prikryl
david@ots.net.au
[View user's profile]

Joined: 2007-08-21
Posts: 3
Location: Australia
Thanks, I have made some progress and am using a batchfile in conjunction with a script. Is it possible to step in and out of a single script from a batch file or would I have to use multiple script files if I want / need to go back and forth from the batch file.
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24996
Location: Prague, Czechia
It is not possible to step out of a script.
_________________
Martin Prikryl
david@ots.net.au
[View user's profile]

Joined: 2007-08-21
Posts: 3
Location: Australia
Martin, This batch script works but when I break it down to more than 1 command block I can't get it to work. If I can sort this out then the error reporting can be much better.

This Works
____________________________________________________
@echo off
set cmdopen=open tester
set cmdbatchon=option batch on
set cmdconfirmoff=option confirm off
set cmdgetaudio=get /uploads/*.DSS /uploads/*.dss /uploads/*.WAV /uploads/*.wav /uploads/*.MP3 /uploads/*.mp3 C:\QSDU\Uploads\*.*
set cmdmvaudio=mv /uploads/*.DSS /uploads/*.dss /uploads/*.WAV /uploads/*.wav /uploads/*.MP3 /uploads/*.mp3 /uploads/wsArchive/*.*
set cmdgetinc=get /incomplete_reports/*.doc C:\QSDU\incomplete_reports\*.doc
set cmdmvinc=mv /incomplete_reports/*.doc /incomplete_reports/wsArchive/*.doc
set cmdputfiles=put C:\QSDU\temp\*.* /completed_reports/2007/*.*
set logpath="C:\Program Files\WinSCP\ots_scripts\logs\qsdu.log"
echo running winscp commands
winscp.exe /command "%cmdopen%" "%cmdbatchon%" "%cmdconfirmoff%" "%cmdgetaudio%" "%cmdmvaudio%" "%cmdgetinc%" "%cmdmvinc%" "%cmdputfiles%" "exit" /log=%logpath%
if errorlevel 1 goto error1
echo WinSCP commands run successfully ...
pause
exit
:error1
echo Error Level 1 Reported
pause
exit__________________________________________________________________

But this doesn't ??

winscp.exe /command "%cmdopen%" /log=%logpath%
winscp.exe session 1 /command "%cmdbatchon%" /log=%logpath%
or
winscp.exe /command "session 1" "%cmdconfirmoff%" /log=%logpath%
or
winscp.exe session /command "%cmdgetaudio%" /log=%logpath%

etc...

Thanks
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24996
Location: Prague, Czechia
The connection is naturally closed with WinSCP, so you need to reopen it each time.
_________________
Martin Prikryl
Advertisements

You can post new topics in this forum






Search Site

What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

WinSCP Privacy Policy

WinSCP License