Source language: Translate to:

Copy File

General questions about NeoBook

Moderator: Neosoft Support

Copy File

Postby StarterPack » Tue Feb 23, 2016 7:03 pm

Hi Guys
Can someone help me please! I want to copy a file to destination folder.
What i have is

1. Button1 named: Load File
2. Button2 named: Copy To
3. Button3 named: Start Copy
3. ListBox named: ListBox
4. InputBox named: [TextEntry1]
5. InputBox named: [TextEntry2]

Let me first say, i've created a batch file (dir /s /b *.txt | Findstr /v .txt. > TextFiles.txt)
That will search all the .txt files on (lets say E Drive) and save it as a text file with path

Now, when i click the "Load File" button and select the "TextFiles.txt" it will load it in the "ListBox ( path+filename)
FileOpenBox "" "Text File|*.txt*" "" "[TextFiles]" ""
FileRead "[TextFiles]" "All" "[ListBox]"

now

When i click in the ListBox it will load the filename + path in [TextEntry1]
SetVar "[TextEntry1]" ""
StrIns '[ListBox1]" "[TextEntry1]" "" "[TextEntry1]"
example
E:\MyFiles\names.txt

When i click on Copy To, it will open a window where i can select a Folder and it will load the path of the Folder in [TextEntry2]
C:\Users\MyPC\Documents

NOW when i click the "Start Copy" button i want to copy the the file that is in [TextEntry1] with full path to the destination folder in [TextEntry2]


Thanks In Advance
StarterPack
StarterPack
 
Posts: 115
Joined: Fri Feb 19, 2016 6:55 am

Re: Copy File

Postby Gaev » Wed Feb 24, 2016 10:00 am

StarterPack:

Can someone help me please! I want to copy a file to destination folder.

Not exactly sure which particular step you need help with.

1) Please tell us which step work as expected ... and which don't.

2) Can you not accomplish all this with just the FileOpenBox and FileCopy commands ?
User avatar
Gaev
 
Posts: 3728
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada

Re: Copy File

Postby StarterPack » Wed Feb 24, 2016 12:07 pm

How can i send a demo of the program?
StarterPack
 
Posts: 115
Joined: Fri Feb 19, 2016 6:55 am

Re: Copy File

Postby Gaev » Wed Feb 24, 2016 2:06 pm

StarterPack:

How can i send a demo of the program?

I don't want to look at your pub ... you need to post the details here ...

(a) identify which step (button code) is not performing as expected
(b) describe expected vs. actual results
(c) post your code here
User avatar
Gaev
 
Posts: 3728
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada

Re: Copy File

Postby Neosoft Support » Wed Feb 24, 2016 9:33 pm

NOW when i click the "Start Copy" button i want to copy the the file that is in [TextEntry1] with full path to the destination folder in [TextEntry2]


Assuming that all the other elements of your pub are working correctly, couldn't you just use NeoBook's FileCopy action to perform the copy?
NeoSoft Support
Neosoft Support
NeoSoft Team
 
Posts: 5602
Joined: Thu Mar 31, 2005 10:48 pm
Location: Oregon, USA

Re: Copy File

Postby StarterPack » Thu Feb 25, 2016 3:31 am

Let me explain and if you don't mind doing it the way i told you

1. Open a Text Document
2. Copy this in the text document
dir /s /b *.mp3 | findstr /v .mp3. > Mp3Files.txt

3. Choose "Save As" and save it on your desktop as Mp3Files.bat
4. Now copy the Mp3Files.bat file and paste it on any harddrive (in my case it is E drive) and run it. This will search for all the .mp3 files on that harddrive and save it as Mp3Files.txt on that same harddrive.
When you open that text file you will see that it has all the mp3 names with their paths (example: E:\All my mp3 Files\Country\When you looking like that.mp3)

Ok, now open your neobook and add
3 Buttons . 2 EditBoxes . and 1 ListBox

Name button 1 : "Open Files" and put this script in
FileOpenBox "" "Text File|*.txt*" "" "[LoadedText]" ""
FileRead "[LoadedText]" "All" "[ListBox]"


Name button 2 : "Choose Folder" and put this script it
FolderBox "Select a Folder:" "[TextEntry2]"

Name button 3 : "Copy File"

Put this script in your ListBox on Selection Changed
SetVar "[TextEntry1]" ""
StrIns "[ListBox1]" "[TextEntry1]" "" "[TextEntry1]"



In default you will have [TextEntry11] and [TextEntry2] as your EditBoxes

Now when you Run the project and you click Open Files Button and choose Mp3Files.txt it will load the file path + file names in your ListBox
When you click on one of the names in ListBox it will load it in TextEntry1
When you click the Choose Folder Button it will open a window where you can choose a destination folder and load the path in TextEntry2

Now you will see there is a path in both TextEntry's.

What i want to know is.... How can i copy the File that is shown in TextEntry1 to the destination folder in TextEntry2
FileCopy "[TextEntry1]" "[TextEntry2]" THIS DOESNT WORK FOR ME

I'm a beginner in this so please be patient with me
StarterPack
 
Posts: 115
Joined: Fri Feb 19, 2016 6:55 am

Re: Copy File

Postby Gaev » Thu Feb 25, 2016 8:32 am

StarterPack:

What i want to know is.... How can i copy the File that is shown in TextEntry1 to the destination folder in TextEntry2
FileCopy "[TextEntry1]" "[TextEntry2]" THIS DOESNT WORK FOR ME

1) When you say THIS DOESNT WORK FOR ME ... please be more specific ... does NeoBook pop up an error ? ... does it copy to the wrong folder ? ... something else ?

2) copy the contents of [TextEntry1] and [TextEntry2] ... and paste it in a post here ... so we can see exactly which value is not as expected

You can also add commands like ...
Code: Select all
AlertBox "TextEntry1" "[TextEntry1]"
AlertBox "TextEntry2" "[TextEntry2]"
... to clearly see these values.



By the way, can you explain what you are aiming for with this code ...
Code: Select all
Put this script in your ListBox on Selection Changed
SetVar "[TextEntry1]" ""
StrIns "[ListBox1]" "[TextEntry1]" "" "[TextEntry1]"

The format for StrIns is ...
Code: Select all
StrIns "source string" "dest string" "insert position" "variable"

... other than the missing "start position", you could do this ...
Code: Select all
SetVar "[TextEntry1]" "[ListBox1]"
... to achieve the same end result.
User avatar
Gaev
 
Posts: 3728
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada

Re: Copy File

Postby mishem » Thu Feb 25, 2016 9:04 am

FileCopy "[TextEntry1]" "[TextEntry2]" THIS DOESNT WORK FOR ME


It will not work.

[TextEntry1] = The path to the file
[TextEntry2] = Must be a new path to the file name. You do this only path to the folder.

It should be something like this ...

Code: Select all
ExtractFileName "[ListBox1]" "[FileName]"
FileCopy "[ListBox1]" "[TextEntry2]\[FileName]"
mishem
 
Posts: 575
Joined: Mon Oct 08, 2012 1:51 pm

Re: Copy File

Postby Gaev » Thu Feb 25, 2016 10:04 am

mishem:

I do not think what you are saying is correct ... from the Help file ...
destination
The drive and folder on the reader’s computer where the copied file is to be saved. You may optionally include a file name as part of the destination to save the copied file under a different name.

Example:
FileCopy "[PubDir]test.doc" "c:\my documents"

... best if StarterPack posts the values here.
User avatar
Gaev
 
Posts: 3728
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada

Re: Copy File

Postby mishem » Thu Feb 25, 2016 11:00 am

I do not think what you are saying is correct

You're right. I made a mistake.
mishem
 
Posts: 575
Joined: Mon Oct 08, 2012 1:51 pm

Re: Copy File

Postby StarterPack » Thu Feb 25, 2016 1:14 pm

Lol i'm out of words... Let me try to figure this out.
Thank you guys
StarterPack
 
Posts: 115
Joined: Fri Feb 19, 2016 6:55 am


Return to General NeoBook Discussions

Who is online

Users browsing this forum: No registered users and 2 guests