This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2010-11-06 13:19:45

SeptimusHeap
Scratcher
Registered: 2010-02-01
Posts: 1000+

Can anyopne help me?

Anyone good with VB...? I'm stumped. It's

Code:

            Dim localFile As String = "F:\Documents and Settings\User\My Documents\Downloads\Program\changes.txt"
            Dim direct As String = "F:\Documents and Settings\User\My Documents\Downloads\Program"
            Const remoteFile As String = "/changes.txt"
            Const host As String = "A web host"
            Const username As String = "MY USER NAME"
            Const password As String = "MY PASS"

       
            If My.Computer.FileSystem.DirectoryExists(direct) Then
                System.IO.Directory.Delete(direct, True)
            End If
            System.IO.Directory.CreateDirectory(direct)
            Dim URI As String = host & remoteFile
            Dim ftp As System.Net.FtpWebRequest = _
                CType(System.Net.WebRequest.Create(URI), System.Net.FtpWebRequest)

            '2. Set credentials

            ftp.Credentials = New  _
                System.Net.NetworkCredential(username, password)

            '3. Settings and action

            ftp.KeepAlive = False
            'we want a binary transfer, not textual data

            ftp.Method = System.Net.WebRequestMethods.Ftp.ListDirectory

            Dim response As FtpWebResponse = CType(ftp.GetResponse(), FtpWebResponse)

            Dim reader As New StreamReader(response.GetResponseStream())

            Dim files() As String = reader.ReadToEnd().Split(New String() {Environment.NewLine}, StringSplitOptions.RemoveEmptyEntries)

            response.Close()

            For Each currentFile As String In files

                Dim theWebClient As New WebClient()

                theWebClient.Credentials = ftp.Credentials


                theWebClient.DownloadFile(host & "/" & currentFile, direct & "\" & currentFile)

            Next

It's supposed to download all of the files in my web host to the Program folder, but it doesn't owrk. No error, though...


http://i46.tinypic.com/dw7zft.png

Offline

 

#2 2010-11-06 14:13:58

SeptimusHeap
Scratcher
Registered: 2010-02-01
Posts: 1000+

Re: Can anyopne help me?

Please?


http://i46.tinypic.com/dw7zft.png

Offline

 

#3 2010-11-06 14:14:58

ihaveamac
Scratcher
Registered: 2007-09-22
Posts: 1000+

Re: Can anyopne help me?

VBS or Visual Basic 2010/2008?


~ihaveamac - visit ihaveamac.net

Offline

 

#4 2010-11-06 14:18:11

SeptimusHeap
Scratcher
Registered: 2010-02-01
Posts: 1000+

Re: Can anyopne help me?

Visual Basic.net 2010 Express Edition.


http://i46.tinypic.com/dw7zft.png

Offline

 

#5 2010-11-06 14:22:54

recycle49
Scratcher
Registered: 2009-12-21
Posts: 1000+

Re: Can anyopne help me?

Eh me can not help you with dis


"Every challenge must be met, every battle must be won, and every story will end." -Me
Recycle49 December 09 - November 11 Goodbye

Offline

 

#6 2010-11-06 19:09:59

SeptimusHeap
Scratcher
Registered: 2010-02-01
Posts: 1000+

Re: Can anyopne help me?

recycle49 wrote:

Eh me can not help you with dis

Then why'd you post...


http://i46.tinypic.com/dw7zft.png

Offline

 

#7 2010-11-06 19:31:48

recycle49
Scratcher
Registered: 2009-12-21
Posts: 1000+

Re: Can anyopne help me?

SeptimusHeap wrote:

recycle49 wrote:

Eh me can not help you with dis

Then why'd you post...

First of all what are you running and what do you need to fix?


"Every challenge must be met, every battle must be won, and every story will end." -Me
Recycle49 December 09 - November 11 Goodbye

Offline

 

#8 2010-11-06 19:32:19

Aidan
Scratcher
Registered: 2007-06-15
Posts: 1000+

Re: Can anyopne help me?

recycle49 wrote:

SeptimusHeap wrote:

recycle49 wrote:

Eh me can not help you with dis

Then why'd you post...

First of all what are you running and what do you need to fix?

Read the OP.  roll

Offline

 

#9 2010-11-07 11:23:55

SeptimusHeap
Scratcher
Registered: 2010-02-01
Posts: 1000+

Re: Can anyopne help me?

Bump


http://i46.tinypic.com/dw7zft.png

Offline

 

#10 2010-11-07 13:18:39

SeptimusHeap
Scratcher
Registered: 2010-02-01
Posts: 1000+

Re: Can anyopne help me?

I got some sort of error in this part:

Code:

 theWebClient.DownloadFile(host & "/" & currentFile, direct & "\" & currentFile)

But I think this part is wrong, too:

Code:

 Dim files() As String = reader.ReadToEnd().Split(New String() {Environment.NewLine}, StringSplitOptions.RemoveEmptyEntries)

http://i46.tinypic.com/dw7zft.png

Offline

 

#11 2010-11-08 04:02:29

what-the
Scratcher
Registered: 2009-10-04
Posts: 1000+

Re: Can anyopne help me?

I made something like this which my program checks for updates. I can't remember the code but you don't need a password or username if you can download it without it.

Now I remember it was my scratch screensaver.

Search for "VB.net downloading files"


http://imageshack.us/m/64/9034/ddfss.pngMy site
Find someone post count. Click posts under username. Find number of pages. Times that by 40 for min and 60 for max and you have a rough estimate of post count.

Offline

 

#12 2010-11-08 06:45:39

SeptimusHeap
Scratcher
Registered: 2010-02-01
Posts: 1000+

Re: Can anyopne help me?

But it's not just supposed to download files. It's supposed to clear a directory by deleting and remaking it, then it finds all of the files on the pass-protected FTP server, and then it downloads ALL the files into the directory.


http://i46.tinypic.com/dw7zft.png

Offline

 

#13 2010-11-09 07:05:47

SeptimusHeap
Scratcher
Registered: 2010-02-01
Posts: 1000+

Re: Can anyopne help me?

Bump


http://i46.tinypic.com/dw7zft.png

Offline

 

#14 2010-11-09 07:27:01

Scratchthatguys
Scratcher
Registered: 2010-07-16
Posts: 1000+

Re: Can anyopne help me?

SeptimusHeap wrote:

Anyone good with VB...? I'm stumped. It's

Code:

            Dim localFile As String = "F:\Documents and Settings\User\My Documents\Downloads\Program\changes.txt"
            Dim direct As String = "F:\Documents and Settings\User\My Documents\Downloads\Program"
            Const remoteFile As String = "/changes.txt"
            Const host As String = "A web host"
            Const username As String = "MY USER NAME"
            Const password As String = "MY PASS"

       
            If My.Computer.FileSystem.DirectoryExists(direct) Then
                System.IO.Directory.Delete(direct, True)
            End If
            System.IO.Directory.CreateDirectory(direct)
            Dim URI As String = host & remoteFile
            Dim ftp As System.Net.FtpWebRequest = _
                CType(System.Net.WebRequest.Create(URI), System.Net.FtpWebRequest)

            '2. Set credentials

            ftp.Credentials = New  _
                System.Net.NetworkCredential(username, password)

            '3. Settings and action

            ftp.KeepAlive = False
            'we want a binary transfer, not textual data

            ftp.Method = System.Net.WebRequestMethods.Ftp.ListDirectory

            Dim response As FtpWebResponse = CType(ftp.GetResponse(), FtpWebResponse)

            Dim reader As New StreamReader(response.GetResponseStream())

            Dim files() As String = reader.ReadToEnd().Split(New String() {Environment.NewLine}, StringSplitOptions.RemoveEmptyEntries)

            response.Close()

            For Each currentFile As String In files

                Dim theWebClient As New WebClient()

                theWebClient.Credentials = ftp.Credentials


                theWebClient.DownloadFile(host & "/" & currentFile, direct & "\" & currentFile)

            Next

It's supposed to download all of the files in my web host to the Program folder, but it doesn't owrk. No error, though...

I'm good with basic VBS, but not VB.

Offline

 

#15 2010-11-09 09:44:36

what-the
Scratcher
Registered: 2009-10-04
Posts: 1000+

Re: Can anyopne help me?

SeptimusHeap wrote:

But it's not just supposed to download files. It's supposed to clear a directory by deleting and remaking it, then it finds all of the files on the pass-protected FTP server, and then it downloads ALL the files into the directory.

Here's what I would do.

-  Make a Program that downloads the new files to a file in the startup directory.
-  The program then deletes or moves all old files (Move it for backup) (Don't delete the new files or the program)

- Program then copy's new files to the old location.
- Program then deletes files in the new folder



My program which updates:
Checks a text file on the net.
If file is different from current version it downloads the next installer.
It then runs the installer and shuts itself down for deletion.
The user then chooses the install settings.


http://imageshack.us/m/64/9034/ddfss.pngMy site
Find someone post count. Click posts under username. Find number of pages. Times that by 40 for min and 60 for max and you have a rough estimate of post count.

Offline

 

#16 2010-11-09 16:42:20

SeptimusHeap
Scratcher
Registered: 2010-02-01
Posts: 1000+

Re: Can anyopne help me?

what-the wrote:

SeptimusHeap wrote:

But it's not just supposed to download files. It's supposed to clear a directory by deleting and remaking it, then it finds all of the files on the pass-protected FTP server, and then it downloads ALL the files into the directory.

Here's what I would do.

-  Make a Program that downloads the new files to a file in the startup directory.
-  The program then deletes or moves all old files (Move it for backup) (Don't delete the new files or the program)

- Program then copy's new files to the old location.
- Program then deletes files in the new folder



My program which updates:
Checks a text file on the net.
If file is different from current version it downloads the next installer.
It then runs the installer and shuts itself down for deletion.
The user then chooses the install settings.

But I want it to download ALL the files in the FTp directory, and It isn't getting the contents right.


http://i46.tinypic.com/dw7zft.png

Offline

 

#17 2010-11-09 16:45:08

SeptimusHeap
Scratcher
Registered: 2010-02-01
Posts: 1000+

Re: Can anyopne help me?

what-the wrote:

SeptimusHeap wrote:

But it's not just supposed to download files. It's supposed to clear a directory by deleting and remaking it, then it finds all of the files on the pass-protected FTP server, and then it downloads ALL the files into the directory.

Here's what I would do.

-  Make a Program that downloads the new files to a file in the startup directory.
-  The program then deletes or moves all old files (Move it for backup) (Don't delete the new files or the program)

- Program then copy's new files to the old location.
- Program then deletes files in the new folder



My program which updates:
Checks a text file on the net.
If file is different from current version it downloads the next installer.
It then runs the installer and shuts itself down for deletion.
The user then chooses the install settings.

But I want it to download ALL the files in the FTp directory, and It isn't getting the contents right.


http://i46.tinypic.com/dw7zft.png

Offline

 

Board footer