It is currently September 26th, 2020, 1:13 am

RainFile

Share and get help with Plugins and Addons
User avatar
Kaelri
Developer
Posts: 1739
Joined: July 25th, 2009, 4:47 am

RainFile

Post by Kaelri »

RainFile.zip


Along the lines of RainRGB, this addon allows the user to choose a file, using the Windows "open file" dialog, then sends a !WriteKeyValue command using the file path as the new value. It also refreshes all skins when finished. Great for letting your users customize images and icons, app launcher locations, note files, and the like.

Usage is as such:

Code: Select all

"C:\...\RainFile.exe" "Type" "SectionName" "KeyName" "FileName" "DefaultValue" ["Pieces"] ["debug"]
  • The Type parameter specifies whether a "File" or "Folder" is to be selected.
  • The DefaultValue parameter should specify the complete file path of the current or default file. The addon uses this information to determine where the Open File dialog should start.
  • The Pieces parameter specifies the parts of the file or folder address to return: the drive (D), path (P), name (N) and/or extension (E). If a folder is being chosen, the extension will be blank. The default value is "DPNE" (all parts).
  • The Debug parameter gives you more detailed feedback about how RainFile is running. Default is "0"; set to "1" to enable.
As with everything I touch, RainFile is licensed as Creative Commons BY-NC-SA 3.0, so feel free to redistribute this with your skins. To do this, add RainFile to your skin's @Resources folder, in:

SkinName\@Resources\Addons\RainFile\RainFile.exe

Then, in your skins, you can run RainFile from that location. For example:

LeftMouseUpAction=["#@#Addons\RainFile\RainFile.exe" ... ]

Changelog

Code: Select all

0.9.6   4 July, 2012    Replaced "NameOnly" with "Pieces".
0.9.5   26 June, 2012   Added "NameOnly" parameter.
0.9.4	24 June, 2012   Various improvements by Jeff Morley.
0.9.3   31 August, 2011 Fixed error that occurred when Rainmeter and target file were on separate drives.
0.9.2   21 July, 2011   Script now quits before executing when dialog is canceled by user.
0.9.1   21 July, 2011   Added option to select folders, in addition to files.
0.9.0   20 July, 2011   Original.
You do not have the required permissions to view the files attached to this post.
User avatar
Kaelri
Developer
Posts: 1739
Joined: July 25th, 2009, 4:47 am

Re: RainFile

Post by Kaelri »

Update (0.9.1): added the option to select folders in addition to files.
User avatar
AlC
Posts: 331
Joined: June 9th, 2011, 6:46 pm

Re: RainFile

Post by AlC »

1. Would help if you maybe post or upload a simple example like your chrome preview ??

2. I tried it and it worked
I post my very simple code, if someone has problems

Rainfile.ini
[Rainmeter]
Update=1000

[Variables]
@Include=#Currentpath#Variables.inc

[Cat]
Meter=IMAGE
ImageName=#Currentpath#Cat.png
AntiAlias=1
RightMouseDownAction=!Execute ["#ADDONSPATH#RainFile\RainFile.exe" "File" "Variables" "pic" "#CURRENTPATH#Variables.inc" "#Skinspath#Rainfile\"]
; !Execute ["#ADDONSPATH#RainFile\RainFile.exe" "File" "Variables" "FileLocation" "#SKINSPATH#Config\Variables.inc" "#CURRENTPATH#Image.jpg"]
LeftMouseDownAction=!Execute [!RainmeterToggleMeter Animal]

[Animal]
Meter=IMAGE
ImageName=#pic#
X=200
Y=200
AntiAlias=1
Variables.inc
[Variables]
pic=
3. I notice one thing:
when I choose a pic, it show me this --> pic=C:\documents....\Rainmeter\Skins\RainFile\pork.png
Open again, but now I don't choose one and click cancel (or the X top right) --> the variable pic is empty and show nothing --> pic=
I don't know, but it would be better when it save the last correct input and don't become empty !
Rainmeter - You are only limited by your imagination and creativity.
User avatar
Kaelri
Developer
Posts: 1739
Joined: July 25th, 2009, 4:47 am

Re: RainFile

Post by Kaelri »

AlC wrote:I don't know, but it would be better when it save the last correct input and don't become empty !
You're right. I'll make this change shortly.

EDIT: Done. First post updated.
User avatar
Jkon
Posts: 192
Joined: December 4th, 2009, 2:05 am

Re: RainFile

Post by Jkon »

I've played with it for about an hour and have ran into no problems.Works like a charm.nicely done.I would have one request,if it is possible, could refresh config specification be added,as jsmorely did in RainRGB.
Image
User avatar
smurfier
Moderator
Posts: 1937
Joined: January 29th, 2010, 1:43 am
Location: Willmar, MN

Re: RainFile

Post by smurfier »

My preference would be to specify the entire bang myself. Gives the use even more options.
GitHub | DeviantArt | Tumblr
This is the song that never ends. It just goes on and on my friends. Some people started singing it not knowing what it was, and they'll continue singing it forever just because . . .
User avatar
santa_ryan
Posts: 417
Joined: June 22nd, 2010, 4:11 am

Re: RainFile

Post by santa_ryan »

Not bad, but theres quite a bit you can add to it.

In general, it would be nice to have the tool set a variable (E.G. FileBrowseComplete) to 1 when file browsing is completed, and if the browse window was closed, then have it set it to -1.

For the "FileBrowse" function, these features can be added:

Title - Title text of the Dialog GUI.
SectionName/KeyName/FileSpec - See !SetVariable in the Rainmeter Documentation
InitDir - Initial directory selected in the GUI file tree.
FileFilter - File type single filter such as "All (*.*)" or "Text files (*.txt)" or multiple filter groups such as "All (*.*)|Text files (*.txt)"
Options [optional] -
1 = File Must Exist (if user types a filename)
2 = Path Must Exist (if user types a path, ending with a backslash)
4 = Allow MultiSelect
8 = Prompt to Create New File (if does not exist)
Note: Dialog Options: To use more than one option, add the required values together.
DefaultName [optional] - Suggested file name for the user to open.

For the FolderBrowse Function, these features can be added:

Title - Title text of the Dialog GUI.
SectionName/KeyName/FileSpec - See !WriteKeyValue in the Rainmeter Documentation
InitDir - Initial directory selected in the GUI file tree.
FileFilter - File type single filter such as "All (*.*)" or "Text files (*.txt)" or multiple filter groups such as "All (*.*)|Text files (*.txt)"
Options [optional] -
1 = File Must Exist (if user types a filename)
2 = Path Must Exist (if user types a path, ending with a backslash)
4 = Allow MultiSelect
8 = Prompt to Create New File (if does not exist)
Note: Dialog Options: To use more than one option, add the required values together.
I have three rules when I'm trying to help you.
  • Don't get mad when you don't understand something
  • Be VERY specific with what you ask for.
    The more specific you are, the higher the quality of support you receive.
  • Do not just copy and paste what I put in examples and come back saying it doesn't work.
    It does work, but I purposely left blanks that you need to fill for your specific needs.
User avatar
KreAch3R
Posts: 629
Joined: February 7th, 2011, 7:27 pm
Location: Thessaloniki, GR

Re: RainFile

Post by KreAch3R »

I am getting this error:

Image

Using this command:

Code: Select all

LeftMouseUpAction=!Execute ["#ADDONSPATH#RainFile\RainFile.exe" "File" "Variables" "FileLocation" "#SKINSPATH#variables.inc" "#CURRENTPATH#Image.jpg"]
Inside variables.inc, these lines exist:

Code: Select all

[Variables]
Message1=let's see that change
FileLocation=#CURRENTPATH#Image.jpg
What am I doing wrong?
Inactive, due to life changes. Send me a PM for any question.

Desktop DeviartArt
Image
User avatar
Kaelri
Developer
Posts: 1739
Joined: July 25th, 2009, 4:47 am

Re: RainFile

Post by Kaelri »

This was an error in the RainFile source code. Fixed in 0.9.3. Link and changelog updated above. :)

@santa_ryan: I haven't forgotten about your suggestions; they're still on my to-do list. Just need to find the time.
User avatar
santa_ryan
Posts: 417
Joined: June 22nd, 2010, 4:11 am

Re: RainFile

Post by santa_ryan »

I have them included in my file browse / folder browse tools if you wish to just alter it to your needs. Of course mine aren't as clean as your's as there's 4 different executables, one for each function: FileBrowse SetVariable/WriteKey and FolderBrowse SetVariable/Writekey. I could rewrite them all into one, but i just don't have the time to do so with school :/

It would be much easier to do with a func call and then pass the variables, and if something is missing, it just defaults.
I have three rules when I'm trying to help you.
  • Don't get mad when you don't understand something
  • Be VERY specific with what you ask for.
    The more specific you are, the higher the quality of support you receive.
  • Do not just copy and paste what I put in examples and come back saying it doesn't work.
    It does work, but I purposely left blanks that you need to fill for your specific needs.