Groups > dBase > dBase programming > Re: run() not work in exe




run() not work in exe

run() not work in exe
Tue, 15 Apr 2008 13:00:15 -050
I have a line in a .wfo

            run( false , "ftp -s:script.ftp www.mydomain.com")

it runs fine in design mode, but it seems not be able to run when it 
compiles to .wfo

what happen here ?

Please advise , Thanks!!!!

Eric 

Post Reply
Re: run() not work in exe
Tue, 15 Apr 2008 18:09:39 -040
thank you!

 A DOS window opened and the instructions in the script were  
  executed and the ftp session was completed. 

my DOS window  open and close so fast.
Post Reply
Re: run() not work in exe
Tue, 15 Apr 2008 22:39:58 +020
On Tue, 15 Apr 2008 20:00:15 +0200, Eric Wu <ericwuu@hotmail.com> wrote:

> I have a line in a .wfo
>
>             run( false , "ftp -s:script.ftp www.mydomain.com")
>
> it runs fine in design mode, but it seems not be able to run when it
> compiles to .wfo
>
> what happen here ?
>
> Please advise , Thanks!!!!

It works for me.

The ftp site I used to try this out is HEAnet which is Ireland's National  
Education and Research Network.  This is a nice big public ftp site with  
plenty of bandwidth.

I tried the following in a program and also in the onClick event of a  
button on a form and it worked both in the IDE and as a compiled program  
or form.  A DOS window opened and the instructions in the script were  
executed and the ftp session was completed.  The dBase DIR command didn't  
start until the DOS window had closed so there doesn't appear to be any  
need to use runwait() from the dUFLP library.  (The DIR listing doesn't  
show with the compiled versions but that is to be expected.)

All I did was list the /pub directory but there is no reason to think that  
putting or getting files (or any other ftp command for that matter)  
wouldn't work.



run(false, "ftp -s:ftp.txt ftp.heanet.ie")
dir // just to give the program something to do after the ftp session  
ended.

The contents of ftp.txt is

anonymous
me@myisp.co.za   (Use your own email address)
cd /pub
pwd
dir
quit

Post Reply
Re: run() not work in exe
Tue, 15 Apr 2008 23:00:14 -040
In article <GpCRmV0nIHA.320@news-server>, ericwuu@hotmail.com says...
> thank you!
> 
>  A DOS window opened and the instructions in the script were  
>   executed and the ftp session was completed. 
> 
> my DOS window  open and close so fast.
> how to pause the DOS window so I can make sure the script did executed ?
 

Eric,

Put your script in a batch (.bat) file. Then in that batch file create a 
text file and check for the existence of that text file (IamDone.txt in 
my example below).


run( false , "your.bat")


---- your.bat --------------------

ftp -s:script.ftp www.mydomain.com
dir > IamDone.txt


-- 
Geoff Wass [dBVIPS]
Montréal, Québec, Canada

.|.|.|        dBASE info at http://geocities.com/geoff_wass       |.|.|.
.|.|.| ---------------------------------------------------------- |.|.|.
Post Reply
Re: run() not work in exe
Wed, 16 Apr 2008 08:18:06 +020
On Wed, 16 Apr 2008 00:09:39 +0200, eric wu <ericwuu@hotmail.com> wrote:

> thank you!
>
>  A DOS window opened and the instructions in the script were
>   executed and the ftp session was completed.
>
> my DOS window  open and close so fast.
> how to pause the DOS window so I can make sure the script did executed ?


It depends on the extent you want your file transfer to be automated.

Geoff has made the suggestion that you create a "flag" file which you
can  
then check for. (Remember to delete it each time <g>)  I haven't tried it 

but I have an idea that the flag file would be created even if the ftp  
transaction wasn't successful.

As an alternative you could remove the "quit" command from your script
 
file.  This would leave the DOS window open with your entire session  
visible for you to scroll through untill you typed in quit at the ftp  
prompt.  This would drop the ftp session  and close the DOS window  
allowing your program to continue.  This would, of course, mean that you,  
or your user, would have to intervene each time.

If you have FUNCky which was bundled with some versions of dBASE (look for  
FUNCky60.DLL in  the  ...\WINDOWS\system32 subdirectory) you can use it  
instead of the Windows ftp.  This will give you control every step of the  
way.  Some simple example code follows my signature.


Mervyn.

******** Start of example code *********
ftp = new OleAutoClient("funckyftp")

cServer = "ftp.xxxxx.com"
cName = "username"   // perhaps "anonymous"
cPassword = "xxxxx"  // usually your email address if anonymous
cServerFile = "util.txt"
cPutFile = "c:\sub1\myutil.txt"
cStoreFile = "c\sub2\myutil.txt"
cDir = "\pub"
nFtpPort = 21 //default
cProxy = ""


if ftp.Connect(cServer,cName,cPassword,nFtpPort,cProxy)
    if  ftp.ChangeDir(cDir)
        if ftp.get(cServerFile,cStoreFile,0)
           msgbox("File "+ cServerFile + " retrieved.")
        else
           msgbox("File "+ cServerFile + " not found.")
           if ftp.put(cPutFile,cServerFile)
              msgbox("File " + cServerFile + " uploaded.")
           else
              msgbox("Upload of file " + cServerFile + "
failed.")
           endif
        endif
    else
       msgbox("Directory " + cDir + " not found.")
    endif
    if not ftp.disconnect()
          msgbox(" Problem!!!  Disconnect failed.")
    endif
else
    msgbox("Connection to " + cServer + " failed.")
endif

Post Reply
<< Previous 1 2 Next >>
( Page 1 of 2 )
about | contact