VB script or code to open copy and paste in file
First of all let me know whether what I have asked is possible or not? I am not well aware of VB Script; you can take me as a new entry to this language. I need to learn some coding in VB script for opening a file then coping data from it and then pasting it completely. Everything should be performed automatically using scripting code. The data copy pasting should be performed between two file. Data should be opened in a file then copied and pasted onto another file and then also the file should be saved with a new name. Trust me as I already said that I am not well aware of VB script so therefore I am also unable to make out whether it is really easy and possible to perform. Anyways its on you people to guide and help me further.
Re: VB script or code to open copy and paste in file
Depends on what format of files you are trying to involve in the task. I mean to say that if you are trying to perform the manipulation of the data of a complex then it would have been quite impossible but if you are involving a text file rather than any other file then I must say you can easily achieve your target.
Anyways if in case you are really trying your hands with text file then the only thing I would suggest you is to start with filesystemobject. This filesystemobject search only work with text files. Another thing I would like to tell you that copy a data or a program in order to transfer them from one file to another would be much easier with a Copy Program only if you need your script to be able to call other programs.
Re: VB script or code to open copy and paste in file
In a simple language the above person means to say that in such programs the codes are written on the basis of the file format. Copy Program is a good option I must say. This program is something that will have to undertake within the batch file or a command line for copying the file. The syntax you could use is Copy Source Destination. Using a VB Script code you can do it in the following manner:
set WSshell = createobject("wscript.shell")
WSshell.run("copy c:\foldername\filename.txt c:\folder2name\file2name.txt",1)
Just try this out and let me know the result.
Re: VB script or code to open copy and paste in file
Using a Shell initially game me some errors. Obviously the errors are not at all understandable by me. The error message also produces some error code. I have tried running the following code:
Shell "notepad.exe c:\foldername\filename.txt", vbMaximizedFocus
Later on found that I followed the code wrongly. Actually the syntax belonged to Visual Basic Application. Then however after a long research I got the correct code for VB script. It was as follows:
set WSshell = createobject("wscript.shell")
WSshell.run("notepad.exe c:\foldername\filename.txt", 1)