how to perform copy file using imacros
Forum rules
iMacros EOL - Attention!
The renewal maintenance has officially ended for Progress iMacros effective November 20, 2023 and all versions of iMacros are now considered EOL (End-of-Life). The iMacros products will no longer be supported by Progress (aside from customer license issues), and these forums will also no longer be moderated from the Progress side.
Thank you again for your business and support.
Sincerely,
The Progress Team
Before asking a question or reporting an issue:
1. Please review the list of FAQ's.
2. Use the search box (at the top of each forum page) to see if a similar problem or question has already been addressed.
3. Try searching the iMacros Wiki - it contains the complete iMacros reference as well as plenty of samples and tutorials.
4. We can respond much faster to your posts if you include the following information: CLICK HERE FOR IMPORTANT INFORMATION TO INCLUDE IN YOUR POST
iMacros EOL - Attention!
The renewal maintenance has officially ended for Progress iMacros effective November 20, 2023 and all versions of iMacros are now considered EOL (End-of-Life). The iMacros products will no longer be supported by Progress (aside from customer license issues), and these forums will also no longer be moderated from the Progress side.
Thank you again for your business and support.
Sincerely,
The Progress Team
Before asking a question or reporting an issue:
1. Please review the list of FAQ's.
2. Use the search box (at the top of each forum page) to see if a similar problem or question has already been addressed.
3. Try searching the iMacros Wiki - it contains the complete iMacros reference as well as plenty of samples and tutorials.
4. We can respond much faster to your posts if you include the following information: CLICK HERE FOR IMPORTANT INFORMATION TO INCLUDE IN YOUR POST
how to perform copy file using imacros
1. how to perform copy file using imacros
eg click "play" button
folder C:\zzz
file A.txt copies and rename to file B.txt
2. after I extracted text to txt file, it showed
"100"
"234"
how can i remove the quotation mark automatically? i mean i don't want the quotation mark.
i know you have FILEDELETE, do u also FILEDCOPY something like that?
eg click "play" button
folder C:\zzz
file A.txt copies and rename to file B.txt
2. after I extracted text to txt file, it showed
"100"
"234"
how can i remove the quotation mark automatically? i mean i don't want the quotation mark.
i know you have FILEDELETE, do u also FILEDCOPY something like that?
- Tech Support
- Posts: 4948
- Joined: Tue Sep 20, 2005 7:25 pm
- Contact:
Re: how to perform copy file using imacros
iMacros itself has no copy command, but please see this solution: http://wiki.imacros.net/Web_Testing#Q:_ ... iMacros.3F
Re: how to perform copy file using imacros
Tech Support wrote:iMacros itself has no copy command, but please see this solution: http://wiki.imacros.net/Web_Testing#Q:_ ... iMacros.3F
Code: Select all
Set objshell = CreateObject("Wscript.shell");
objshell.Run "cmd /c copy C:\text.txt C:\777.txt";
in js file,
iErrorCode = objShell.Run("ping http://www.mywebsite.com",,True)
the quotation mark make it a comment?
something like this?
iErrorCode = objShell.Run(copy C:\test.txt C:\777.txt)
even the sample code doesnt work
SyntaxError: missing ; before statement (Error code: 991)
-
- Posts: 3834
- Joined: Mon May 31, 2010 4:59 pm
Re: how to perform copy file using imacros
bumusic,
The sample code is VBScript and requires the iMacros Scripting Edition. You can not use that code inside an iMacros for Firefox .js file.
The sample code is VBScript and requires the iMacros Scripting Edition. You can not use that code inside an iMacros for Firefox .js file.
Regards,
Tom, iMacros Support
Tom, iMacros Support
Re: how to perform copy file using imacros
so how can we remove the double quotation mark when save to text ?Tom, iOpus wrote:bumusic,
The sample code is VBScript and requires the iMacros Scripting Edition. You can not use that code inside an iMacros for Firefox .js file.
"aaa"
"bbb"
"ccc"
to
aaa
bbb
ccc
or replace the " file after saving
ie
"aaa"
"bbb"
"ccc"
and run code to become this
aaa"
"bbb"
"ccc"
/
Re: how to perform copy file using imacros
i just solved it by the following:Tom, iOpus wrote:bumusic,
The sample code is VBScript and requires the iMacros Scripting Edition. You can not use that code inside an iMacros for Firefox .js file.
1. create a bat file
Code: Select all
@echo off
copy /Y C:\test.txt C:\test2.txt
Code: Select all
var file = Components.classes["@mozilla.org/file/local;1"]
.createInstance(Components.interfaces.nsILocalFile);
file.initWithPath("c:\\d.bat");
file.launch();
now i can bookmark the js file and make COPY function with one click!!!
Last edited by bumusic on Wed Nov 02, 2011 7:03 pm, edited 1 time in total.
-
- Posts: 3834
- Joined: Mon May 31, 2010 4:59 pm
Re: how to perform copy file using imacros
Excellent! Thanks for sharing your solution!
Regards,
Tom, iMacros Support
Tom, iMacros Support
-
- Posts: 22
- Joined: Sat May 07, 2011 6:12 am
Re: how to perform copy file using imacros
More simple solution would be
This will work in Linux. For Windows you need to change the path separator.
Code: Select all
function file_copy(from,to)
{
var to_folder=to.substring(0,to.lastIndexOf("/")+1);
var to_file=to.substring(to.lastIndexOf("/")+1);
var source = Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile);
source.initWithPath(from);
var target = Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile);
target.initWithPath(to_folder);
source.copyTo(target,to_file);
}
Re: how to perform copy file using imacros
as ONPRINT isn't supported with iMacros for Firefox found really simple solution for both onprint lack and copying files:
first print to pdf without prompt for filename to defaultFolder/default.pdf with Adobe PDF printer or similar,
then we can copy default.pdf with
first print to pdf without prompt for filename to defaultFolder/default.pdf with Adobe PDF printer or similar,
then we can copy default.pdf with
Code: Select all
URL GOTO=file:///C:/defaultFolder/
ONDOWNLOAD FOLDER=C:\defaultFolder FILE=anyOtherFileName.pdf WAIT=YES
TAG POS=1 TYPE=A ATTR=TXT:default.pdf