Create Folder with iMacros / JavaScript
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
Create Folder with iMacros / JavaScript
Hey there,
I was wondering myself if iMacros can create folders or if there is a way to do this with JavaScript.
I want iMacros to automatically create a structure of folders where data about the running macro will be saved.
I tried to do it with:
SAVEAS TYPE=EXTRACT FOLDER={{PATH}}\{{FolderIwishToCreate}} FILE=blah.csv
But I get the following error:
RuntimeError: Path C:\... does not exist, line x
Now i thought, when there is a command FILEDELETE, why can't iMacros create new folders?
I was wondering myself if iMacros can create folders or if there is a way to do this with JavaScript.
I want iMacros to automatically create a structure of folders where data about the running macro will be saved.
I tried to do it with:
SAVEAS TYPE=EXTRACT FOLDER={{PATH}}\{{FolderIwishToCreate}} FILE=blah.csv
But I get the following error:
RuntimeError: Path C:\... does not exist, line x
Now i thought, when there is a command FILEDELETE, why can't iMacros create new folders?
-
- Posts: 3834
- Joined: Mon May 31, 2010 4:59 pm
Re: Create Folder with iMacros / JavaScript
Hi yquant,
As you already discovered, this functionality is not supported by iMacros for Firefox, you'll have to use Javascript.
As you already discovered, this functionality is not supported by iMacros for Firefox, you'll have to use Javascript.
Regards,
Tom, iMacros Support
Tom, iMacros Support
Re: Create Folder with iMacros / JavaScript
Let me just leave it here, because I tried to find a solution for my script and found here this question.
ONDOWNLOAD FOLDER={{PATH}}\{{FolderIwishToCreate}} FILE=*
SAVEAS TYPE=EXTRACT FOLDER={{PATH}}\{{FolderIwishToCreate}} FILE=blah.csv
ONDOWNLOAD FOLDER={{PATH}}\{{FolderIwishToCreate}} FILE=*
SAVEAS TYPE=EXTRACT FOLDER={{PATH}}\{{FolderIwishToCreate}} FILE=blah.csv
Re: Create Folder with iMacros / JavaScript
Yep, Thanks for sharing, but the original Thread and OP was from 2011, some 8 years ago, and the 'Create Folder' Functionality got later (from around iMB v10.3 I think) implemented with the 'FOLDER' Parameter as part of the 'ONDOWNLOAD' and 'SAVEAS' Commands, like documented in the Wiki...:admazy wrote: ↑Sat Jan 05, 2019 4:50 pmLet me just leave it here, because I tried to find a solution for my script and found here this question.Code: Select all
ONDOWNLOAD FOLDER={{PATH}}\{{FolderIwishToCreate}} FILE=* SAVEAS TYPE=EXTRACT FOLDER={{PATH}}\{{FolderIwishToCreate}} FILE=blah.csv
(The iMacros v10.0.x for CR/FF 'Free' Versions do not support this 'FOLDER' Parameter btw..., only the 'PE' Versions support it...)Notes
FOLDER does not accept relative path, FILE does. In case you want to download to a subfolder under the iMacros downloads folder, you can use the FILE parameter, but that subfolder needs to exist prior to the download.
Just the FOLDER parameter creates folders, so if the folder is not there yet, it has to appear in FOLDER, not in FILE.
- (F)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE'/'Trial').
- FCI not mentioned: I don't even read the Qt...! (or only to catch Spam!)
- Script & URL help a lot for more "educated" Help...
- FCI not mentioned: I don't even read the Qt...! (or only to catch Spam!)
- Script & URL help a lot for more "educated" Help...
Re: Create Folder with iMacros / JavaScript
1. I left this answer for someone who is trying to do a similar thing in 2019 and later.chivracq wrote: ↑Sat Jan 05, 2019 6:50 pmYep, Thanks for sharing, but the original Thread and OP was from 2011, some 8 years ago, and the 'Create Folder' Functionality got later (from around iMB v10.3 I think) implemented with the 'FOLDER' Parameter as part of the 'ONDOWNLOAD' and 'SAVEAS' Commands, like documented in the Wiki...:admazy wrote: ↑Sat Jan 05, 2019 4:50 pmLet me just leave it here, because I tried to find a solution for my script and found here this question.Code: Select all
ONDOWNLOAD FOLDER={{PATH}}\{{FolderIwishToCreate}} FILE=* SAVEAS TYPE=EXTRACT FOLDER={{PATH}}\{{FolderIwishToCreate}} FILE=blah.csv
(The iMacros v10.0.x for CR/FF 'Free' Versions do not support this 'FOLDER' Parameter btw..., only the 'PE' Versions support it...)Notes
FOLDER does not accept relative path, FILE does. In case you want to download to a subfolder under the iMacros downloads folder, you can use the FILE parameter, but that subfolder needs to exist prior to the download.
Just the FOLDER parameter creates folders, so if the folder is not there yet, it has to appear in FOLDER, not in FILE.
2. Just checked this special for you on Win XP x32 + Firefox 3.1 Beta 3 + iMacros for Firefox 6.2.1.5 (it's almost 10 years ago) and it works.
Code: Select all
VERSION BUILD=6210326 RECORDER=FX
ONDOWNLOAD FOLDER=C:\\SOME_FOLDER FILE=*
Re: Create Folder with iMacros / JavaScript
Hum-hum, yep-yep-yep, you seem to be completely right...!, only the 'ONDOWNLOAD' Command is able to create the new Folder, it (still) doesn't work from the 'SAVEAS' Command (I tested using v8.8.2 + v8.9.7, both for FF), so I guess your Solution would have already worked indeed for OP, 9 years ago...admazy wrote: ↑Sat Jan 05, 2019 9:52 pm1. I left this answer for someone who is trying to do a similar thing in 2019 and later.
2. Just checked this special for you on Win XP x32 + Firefox 3.1 Beta 3 + iMacros for Firefox 6.2.1.5 (it's almost 10 years ago) and it works.
Code: Select all
VERSION BUILD=6210326 RECORDER=FX ONDOWNLOAD FOLDER=C:\\SOME_FOLDER FILE=*
(I'm impressed btw you maintain such an old FCI, ah-ah...! )
Mini-Detail, '!ERRORIGNORE' would also be needed, even with a 'SAVEAS' after the 'ONDOWNLOAD', or some "ONDOWNLOAD command was used but no download occurred. (Error code: -804)" RuntimeError will occur later on if the Script is still running after '!TIMEOUT_DOWNLOAD' has been reached...
("Funny" thing is that the 'SET !ERRORIGNORE YES' can also be placed after the 'ONDOWNLOAD' Line, as long as that Line has been reached before the Timeout ran out, ah-ah...! "Interesting" Behaviour actually, that could be used for some Conditional Aborting of a Script, even if there are easier Methods... )
>>>
And I notice btw a "Mistake" in the Wiki concerning '!TIMEOUT_DOWNLOAD':
=> This is not correct, at least both in v8.8.2 and v8.9.7, => the Default Value is '!TIMEOUT_PAGE'/2...This is by default equal to !TIMEOUT_PAGE [...]
=> 30 Sec for example if Default (or set in the Script) '!TIMEOUT_PAGE' = 60 Sec.
>>>
... And now I can go and delete all those 8 separate Folders that got created from that Testing, ah-ah...!
- (F)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE'/'Trial').
- FCI not mentioned: I don't even read the Qt...! (or only to catch Spam!)
- Script & URL help a lot for more "educated" Help...
- FCI not mentioned: I don't even read the Qt...! (or only to catch Spam!)
- Script & URL help a lot for more "educated" Help...
-
- Posts: 3834
- Joined: Mon May 31, 2010 4:59 pm
Re: Create Folder with iMacros / JavaScript
This statement in the wiki regarding the default value of !TIMEOUT_DOWNLOAD applies specifically to the iMacros browser and iMacros for IE. In the current (v10.x) versions of iMacros for Chrome and Firefox, the default is 300 seconds. The !TIMEOUT_DOWNLOAD variable is not even supported in iMacros for Firefox 8.9.7.chivracq wrote: ↑Sun Jan 06, 2019 10:23 amAnd I notice btw a "Mistake" in the Wiki concerning '!TIMEOUT_DOWNLOAD':=> This is not correct, at least both in v8.8.2 and v8.9.7, => the Default Value is '!TIMEOUT_PAGE'/2...This is by default equal to !TIMEOUT_PAGE [...]
=> 30 Sec for example if Default (or set in the Script) '!TIMEOUT_PAGE' = 60 Sec.
Regards,
Tom, iMacros Support
Tom, iMacros Support
Re: Create Folder with iMacros / JavaScript
Ah OK, I actually didn't use at all that Var in my Testing, only the '!TIMEOUT_PAGE' Var and the 'ONDOWNLOAD' Command which does have (in v8.8.2 + v8.9.7) some "Default" "TIMEOUT_ONDOWNLOAD" Functionality then if I can call it like that which is exactly the Half (50%) of '!TIMEOUT_PAGE' in my Testing..., and can be controlled by setting '!TIMEOUT_PAGE'...Tom, Tech Support wrote: ↑Tue Jan 08, 2019 1:24 pmThis statement in the wiki regarding the default value of !TIMEOUT_DOWNLOAD applies specifically to the iMacros browser and iMacros for IE. In the current (v10.x) versions of iMacros for Chrome and Firefox, the default is 300 seconds. The !TIMEOUT_DOWNLOAD variable is not even supported in iMacros for Firefox 8.9.7.chivracq wrote: ↑Sun Jan 06, 2019 10:23 amAnd I notice btw a "Mistake" in the Wiki concerning '!TIMEOUT_DOWNLOAD':=> This is not correct, at least both in v8.8.2 and v8.9.7, => the Default Value is '!TIMEOUT_PAGE'/2...This is by default equal to !TIMEOUT_PAGE [...]
=> 30 Sec for example if Default (or set in the Script) '!TIMEOUT_PAGE' = 60 Sec.
Could be nice btw to mention/add in the Wiki (for 'SAVEAS') that only the 'FOLDER' Parameter from 'ONDOWNLOAD' is able to create a new Folder, I always took for granted that the same 'FOLDER' Parameter worked the same way in both Commands..., but apparently that's not the case... (well, at least until v8.9.7 for FF)...
- (F)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE'/'Trial').
- FCI not mentioned: I don't even read the Qt...! (or only to catch Spam!)
- Script & URL help a lot for more "educated" Help...
- FCI not mentioned: I don't even read the Qt...! (or only to catch Spam!)
- Script & URL help a lot for more "educated" Help...
-
- Posts: 3834
- Joined: Mon May 31, 2010 4:59 pm
Re: Create Folder with iMacros / JavaScript
Done. Actually, SAVEAS *does* create the folder when playing a macro in the iMacros browser or iMacros for IE. Additionally, the current versions of iMacros for Chrome and Firefox (v10.x) do not create the folder even for ONDOWNLOAD. I also added a new feature request to make these commands more consistent across browsers, if possible.chivracq wrote: ↑Tue Jan 08, 2019 1:54 pmCould be nice btw to mention/add in the Wiki (for 'SAVEAS') that only the 'FOLDER' Parameter from 'ONDOWNLOAD' is able to create a new Folder, I always took for granted that the same 'FOLDER' Parameter worked the same way in both Commands..., but apparently that's not the case... (well, at least until v8.9.7 for FF)...
Regards,
Tom, iMacros Support
Tom, iMacros Support