WriteFile + FolderReport

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
Post Reply
sl23
Posts: 223
Joined: 03 Feb 2015 23:34

WriteFile + FolderReport

Post by sl23 »

I've managed to get reports to write toa file using this:

Code: Select all

"Current Folder|:cliptext" writefile("- DirList - <curfolder>.ini", report("{Basename}{dir = DIR}<crlf>", , "; <curpath> on <date><crlf><crlf>"));
I've also managed to get a folderreport to show a text box, and to write to a .txt file using this:

Code: Select all

"Folders List|:cliptext" text folderreport("tree:{dir {name} ({count})}", "r", , "r");
Both work fine, It would just be more helpful if I could make the folderreport write to an .ini file in the same way the writefile does. So I tried this:

Code: Select all

"Current Folder|:cliptext" writefile("- DirList - <curfolder>.ini", folderreport("tree:{dir {name} ({count})}", "r", , "r"); <curpath> on <date><crlf><crlf>"));
Obviously these are basic examples I've manipulated from the manual. Which I am trying to decipher how to use the terms and what terms mean what. I've looked under both the folderreport and writefile sections and see in the writefile section that this is the correct order:
Syntax
writefile(filename, data, [on_exist], [mode], [start=1], [numbytes=-1])
So, where it says data, is that the correct place to put the syntax for the folderreport syntax? Sorry, I just have no clue what goes where, I'm trying to learn, but I'm not sure what is the correct way to combine these things.

Thank you for your help. :)

EDIT: Just tried this, cos I think using writefile is perhaps the wrong way to go:

Code: Select all

"Folders List|:cliptext" folderreport("tree:{dir {name} ({count})}", "f", , "r", "- DirList - <curfolder>.ini");
I get a flash of the app window, but no idea what's happening with it! It doesn't create a file at all!

Could someone shed some light on my mistake please? :)
I'm pretty sure it's the last part, as it works ok without that, but I would prefer it to save to .ini file rather than .txt.

highend
Posts: 13274
Joined: 06 Feb 2011 00:33

Re: WriteFile + FolderReport

Post by highend »

Use a full path when doing this:

Code: Select all

"Folders List|:cliptext" folderreport("tree:{dir {name} ({count})}", "f", , "r", "<curpath>\- DirList - <curfolder>.ini");
One of my scripts helped you out? Please donate via Paypal

sl23
Posts: 223
Joined: 03 Feb 2015 23:34

Re: WriteFile + FolderReport

Post by sl23 »

Omg! So close! Thank you highend for the quick response, and the solution! :tup:
May I ask, why does this need full path but writefile doesn't?

I've just seen the dirrel command, should I have used that? What is the difference between tree and dir commands anyway?

highend
Posts: 13274
Joined: 06 Feb 2011 00:33

Re: WriteFile + FolderReport

Post by highend »

- Ask Don, it's not mentioned in the help
- Why should a type influence the path where the report is written?
- Different outputs?
One of my scripts helped you out? Please donate via Paypal

sl23
Posts: 223
Joined: 03 Feb 2015 23:34

Re: WriteFile + FolderReport

Post by sl23 »

I just thought maybe the type had different response to the path. So using dirrel would make it unnesessary to use <curpath> ?

That was my thinking, but I made a quick test, swapped tree for dir and then dirrel, but they didn't work???! I'm ok with how it functions, would be nice if the layout could be adjusted to save me having to do major editing afterwards, but tbh, this little thing will save a LOT of time, so, thanks for the help!

highend
Posts: 13274
Joined: 06 Feb 2011 00:33

Re: WriteFile + FolderReport

Post by highend »

All three types work fine here...
One of my scripts helped you out? Please donate via Paypal

sl23
Posts: 223
Joined: 03 Feb 2015 23:34

Re: WriteFile + FolderReport

Post by sl23 »

Without any other adjustments though? I literally only changed that one command.

highend
Posts: 13274
Joined: 06 Feb 2011 00:33

Re: WriteFile + FolderReport

Post by highend »

Apart from checking where the focus is / what's inside the current folder? Nope
One of my scripts helped you out? Please donate via Paypal

Post Reply