Folder Icon Setting [need help]
-
eil
- Posts: 1866
- Joined: 13 Jan 2011 19:44
Folder Icon Setting [need help]
since the appearance of Portable File Icons i wanted to have an easier way to use it, and recently i got more need for it. i could do it myself, probably, but it'd took me few days and i deffenitely would have question - so i'll state a consept and maybe some local script-master make it real(and useful).
- so for ex it's a button with a script for left click(right might be useful for other addons)
- in List you select an .ico or .exe(check for ico/exe, otherwise do nothing)
- then click on button = it saves a path to this item(our icon in future)
- yet click changes icon of button = "loaded" state(there should be a place in script to specify 2 icons for button states)
- again in List, you go to folder you want to set icon and click on button again(check fot folder, otherwise do nothing)
- folder gets icon from saved path
- button chages icon back to state "free"
what's so useful? fast way to do something like this:
- so for ex it's a button with a script for left click(right might be useful for other addons)
- in List you select an .ico or .exe(check for ico/exe, otherwise do nothing)
- then click on button = it saves a path to this item(our icon in future)
- yet click changes icon of button = "loaded" state(there should be a place in script to specify 2 icons for button states)
- again in List, you go to folder you want to set icon and click on button again(check fot folder, otherwise do nothing)
- folder gets icon from saved path
- button chages icon back to state "free"
what's so useful? fast way to do something like this:
To see the attached files, you need to log into the forum.
Win 7 SP1 x64 100% 1366x768|1900x1080
-
TheQwerty
- Posts: 4373
- Joined: 03 Aug 2007 22:30
Re: Folder Icon Setting [need help]
I like the idea but unfortunately today the only way to manage Portable File Icons in a script is through modifying XYplorer.ini.
This means the script will need to save settings, modify the file, and then restart XY without saving - which makes it an uglier and rather annoying thing.
If we can convince Don to provide scriptable access I'll write the script.
Here's a couple options as far as that goes...
1) The official documented way:2) The undocumented snippet, which might be easier to implement and would be enough to meet our needs thus "closing" the wish sooner:Which adds "Awesome Apps" <xy>>xy.ico to the definitions. (Maybe complement it with snippet action "PrependCustomIcon" so we can decide if we want to add to the beginning or end of the list?)
What do you say Don?
This means the script will need to save settings, modify the file, and then restart XY without saving - which makes it an uglier and rather annoying thing.
If we can convince Don to provide scriptable access I'll write the script.
Here's a couple options as far as that goes...
1) The official documented way:
Code: Select all
seticon([definitions], [flags=0], [position]);
Definitions:
CRLF-separated list of Portable File Icon patterns.
Each may optionally start with a '+' to indicate they are enabled.
If omitted the current definitions are returned.
Flags:
0: Add Definitions
1: Set Definitions
Position:
Where to insert new definitions.
Only used if flags is 0.
0: Top of list.
n: After nth item.
-1: Bottom/End of list.Code: Select all
Snip: CustomIcon 1
XYplorer 14.20.0204, 6/13/2014 1:23:42 AM
Action
AppendCustomIcon
Caption
Awesome Apps
Pattern
<xy>
Icon
xy.icoWhat do you say Don?
-
klownboy
- Posts: 4459
- Joined: 28 Feb 2012 19:27
- Location: Windows 11, 25H2 Build 26200.8037 at 100% 2560x1440
Re: Folder Icon Setting [need help]
+1 nice idea! The script could determine if you've already per-selected a folder, which is what I would do most of the time, and then go directly to an icon selection for that folder. I wasn't sure when you were referring to button states if you were referring to the state of the folder, "open/selected" and "normal/unselected" of the subject folder or the CTB you have assigned to the script or both. In any case, it would then be great to be able to select icons if the user elected, for both the normal state and one for the open state of the subject folder which you can do manually when the icons are separated by a "|".
-
admin
- Site Admin
- Posts: 66277
- Joined: 22 May 2004 16:48
- Location: Win8.1, Win10, Win11, all @100%
- Contact:
Re: Folder Icon Setting [need help]
I say I hope I can finish it before Colombia kicks off!TheQwerty wrote:What do you say Don?
FAQ | XY News RSS | XY X
-
admin
- Site Admin
- Posts: 66277
- Joined: 22 May 2004 16:48
- Location: Win8.1, Win10, Win11, all @100%
- Contact:
Re: Folder Icon Setting [need help]
OK, looking good! Cool function. I changed it a little bit but mostly took your wording one to one. Upload probably during half time COLCIV.
FAQ | XY News RSS | XY X
-
TheQwerty
- Posts: 4373
- Joined: 03 Aug 2007 22:30
Re: Folder Icon Setting [need help]
Good! I hadn't spent much time thinking this one through.admin wrote:I changed it a little bit but mostly took your wording one to one.
-
eil
- Posts: 1866
- Joined: 13 Jan 2011 19:44
Re: Folder Icon Setting [need help]
i kinda lost track of meaning of words/ideas, but indeed we need a script access to PFI(i thought it already is present, as all things in XY do
)
more simple:
- you find an ico/exe anywhere that you like, push a button =it remembers path and chages buttons icon to show it has something in stack
- you select folder you want to set icon and push button again =it sets remembered icon to folder and changes buttons icon back to show it's null again
folder state is not a part of my consept -the main use is for fast setting icon for any single folder(that's why there are checks for ico/exe/folder =only they take part in this show).klownboy wrote: I wasn't sure when you were referring to button states if you were referring to the state of the folder, "open/selected" and "normal/unselected" of the subject folder or the CTB you have assigned to the script or both.
more simple:
- you find an ico/exe anywhere that you like, push a button =it remembers path and chages buttons icon to show it has something in stack
- you select folder you want to set icon and push button again =it sets remembered icon to folder and changes buttons icon back to show it's null again
Win 7 SP1 x64 100% 1366x768|1900x1080
-
klownboy
- Posts: 4459
- Joined: 28 Feb 2012 19:27
- Location: Windows 11, 25H2 Build 26200.8037 at 100% 2560x1440
Re: Folder Icon Setting [need help]
With Don's beta v14.20.0203 it looks like what you're suggesting for a CTB should be quite doable. I didn't have much time since I'm at the beach on vacation, but I did test the following in the Address Bar with a folder selected and it worked fine. Based on that I think we should be able to set-up the CTB as you suggest using "CTBicon" and "CTBstate" and maybe even have the capability to have a icon for both states though that makes the script more complicated and would necessitate more prompting/selecting for the user.
Notice I also had an icon for the "normal/unselected" icon and the "open/selected" icon...and it does work. So Don did make it possible to use "seticons" to set the state for normal and open.
Code: Select all
::seticons("+<curpath>\>D:\Graphics\Icons\APPLE.ICO|D:\Graphics\Icons\APPLE_HALF.ICO", 1, 1);Notice I also had an icon for the "normal/unselected" icon and the "open/selected" icon...and it does work. So Don did make it possible to use "seticons" to set the state for normal and open.
-
klownboy
- Posts: 4459
- Joined: 28 Feb 2012 19:27
- Location: Windows 11, 25H2 Build 26200.8037 at 100% 2560x1440
Re: Folder Icon Setting [need help]
Hi Don, I noticed you kicked out (between games
) an update or revamp to "SetIcons", but I was surprised to see that you mention setting multiple definitions, but you hadn't mentioned (or provided an example) that you could use it to set the "normal/unselected" icon and the "open/selected" icon as I mentioned in the previous post.This works fine from the AB to achieve both the normal and open states of the selected folder.
However, if you plug in the above code without the "a" mode, it will wipe out all the icon definitions. Luckily I exit without saving.
Thanks,
Ken
Code: Select all
::seticons("+<curpath>\>D:\Graphics\Icons\APPLE.ICO|D:\Graphics\Icons\APPLE_HALF.ICO",a);However, if you plug in the above code without the "a" mode, it will wipe out all the icon definitions. Luckily I exit without saving.
Thanks,
Ken
-
admin
- Site Admin
- Posts: 66277
- Joined: 22 May 2004 16:48
- Location: Win8.1, Win10, Win11, all @100%
- Contact:
Re: Folder Icon Setting [need help]
That did not change since before the revamp. But maybe TheQwerty was right to have the "a" mode as default? I'm not sure about the usage of the function, I'm just hacking in what TheQwerty writes down for me. 
FAQ | XY News RSS | XY X
-
eil
- Posts: 1866
- Joined: 13 Jan 2011 19:44
Re: Folder Icon Setting [need help]
whats wrong with this line? i told you there will be stupid questions.
Code: Select all
seticons("+<curitem> > $f_ico");Win 7 SP1 x64 100% 1366x768|1900x1080
-
klownboy
- Posts: 4459
- Joined: 28 Feb 2012 19:27
- Location: Windows 11, 25H2 Build 26200.8037 at 100% 2560x1440
Re: Folder Icon Setting [need help]
Don, I hadn't read that in TheQuerty's post but that's exactly what I was thinking incase someone neglects to provide a "mode", you wouldn't want it to wipe out all their previous associations.admin wrote: ...have the "a" mode as default
eil, I didn't try it, but why do you have spaces before and after the ">"? When I used it for a folder I had to put a "\" after "<curpath>" (see above) since it needed the backslash to work and "<curpath>" does not have the final backslash. So if you're using it <curitem> on a folder is the list you'll have to backslash it also.
Ken
-
eil
- Posts: 1866
- Joined: 13 Jan 2011 19:44
Re: Folder Icon Setting [need help]
thanks for a tip.klownboy wrote:So if you're using it <curitem> on a folder is the list you'll have to backslash it also.
but i'm still stuck and it not works.. please correct it.
Code: Select all
if (<curext> == "exe" || "ico") && (ctbstate==0) {
$f_ico = <curitem>;
echo [icon]= $f_ico;
ctbicon(:tagsrmv);
ctbstate(1);}
elseif (<curext> == "") && (ctbstate==1) {
echo folder;
//seticons("+<curitem>\>$f_ico");
msg(+<curitem>\>$f_ico);
ctbicon(:tagsadd);
ctbstate(0);}
else {
ctbstate(0);
ctbicon(:tagsadd);}Win 7 SP1 x64 100% 1366x768|1900x1080
-
klownboy
- Posts: 4459
- Joined: 28 Feb 2012 19:27
- Location: Windows 11, 25H2 Build 26200.8037 at 100% 2560x1440
Re: Folder Icon Setting [need help]
Might it be better to have the user select the icon to be used by using "inputselect" or similar method and then do the same for the associated file or folder? This assumes the user knows exactly what needs to be done which could be a problem. I'll take a look at it, but honestly I think I may have to start fresh. You may want to consider using "exists" to see if the selected item is a folder rather than checking if the <curext> is "". It also looks like you'll have to make $f_ico a perm variable such that it's still around for the next run and delete the perm after it gets assigned.
-
admin
- Site Admin
- Posts: 66277
- Joined: 22 May 2004 16:48
- Location: Win8.1, Win10, Win11, all @100%
- Contact:
Re: Folder Icon Setting [need help]
Does everybody agree? Please only vote if you are actually using this function.klownboy wrote:Don, I hadn't read that in TheQuerty's post but that's exactly what I was thinking incase someone neglects to provide a "mode", you wouldn't want it to wipe out all their previous associations.admin wrote: ...have the "a" mode as default
FAQ | XY News RSS | XY X
XYplorer Beta Club