Jump to content
Macro Express Forums

Restoring the icons of desktop shortcuts-to-folders to GENERIC


Recommended Posts

Because the talent at this forum can produce an effective macro in much less time than I can, I will put this job 'out for tender' (joke only), rather than spend innumerable hours gradually inching towards a solution.

The problem : On the desktop IN PARTICULAR POSITIONS, I have shortcuts-to-folders which hold videos temporarily. That leaves the icons of the shortcuts 'contaminated' with video thumbnail elements. While I can do a disk-cleanup to restore the generic icons of the shortcuts [and that MAY be simpler than the alternative], I know that deleting the shortcuts, and re-creating them is another way.

I would like a macro that will achieve the end result of 'leaving the shortcuts where they are, and labled as they are' [as a disk cleanup would], but with generic icons (without thumbnail remnants).

Link to comment
Share on other sites

Would deleting the hidden thumbs.db file work?

And if you don't want them, why don't you disable the feature in File Explorer? I think it Folder Options > "Always show icons, never thumbnails" does the trick. But it's been a long time since I messed with it. 

 

Link to comment
Share on other sites

How about a hotkey activated macro? Select the icon you want to fix, and press whatever hotkey you want to this script:

 

Text Type (Simulate Keystrokes): <ALT><ENTER> // Properties for desktop icon
Delay: 500 milliseconds
Text Type (Simulate Keystrokes): <ALT>c // Change icon...
Delay: 500 milliseconds
Text Type (Simulate Keystrokes): <ALT>s // Select an icon from the list below
Delay: 500 milliseconds
Text Type (Simulate Keystrokes): <HOME> // Select the icon in the top left
Delay: 500 milliseconds
Text Type (Simulate Keystrokes): <ENTER> // OK
Delay: 500 milliseconds
Text Type (Simulate Keystrokes): <ENTER> // OK

  
<TEXT TYPE Action="0" Text="<ALT><ENTER>" _COMMENT="Properties for desktop icon"/>
<DELAY Flags="\x02" Time="500"/>
<TEXT TYPE Action="0" Text="<ALT>c" _COMMENT="Change icon..."/>
<DELAY Flags="\x02" Time="500"/>
<TEXT TYPE Action="0" Text="<ALT>s" _COMMENT="Select an icon from the list below"/>
<DELAY Flags="\x02" Time="500"/>
<TEXT TYPE Action="0" Text="<HOME>" _COMMENT="Select the icon in the top left"/>
<DELAY Flags="\x02" Time="500"/>
<TEXT TYPE Action="0" Text="<ENTER>" _COMMENT="OK"/>
<DELAY Flags="\x02" Time="500"/>
<TEXT TYPE Action="0" Text="<ENTER>" _COMMENT="OK"/>

 

Link to comment
Share on other sites

Acantor - if your macro works - I think it is the very thing I was hoping for. I will probably know later today - and will report back.

 

Cory - deleting thumbs.db is I think what DiskCleanUp does; disabling 'the feature in File Explorer' would, I suspect, have much unforeseen and potentially undesirable ramifications. Moreover, I would have to go and discover what 'this feature' is.

 

I allocated the macro to CTRL_1; I clicked on the 'offending' shortcut - various windows opened, eventually a video processing program stayed open, but the shortcut did NOT lose its thumbnail-tainted icon.

Link to comment
Share on other sites

Different computers are configured slightly differently, so if my script isn't working, you may be the only one who can sort out how to modify it to do what you need it to do.

 

You might find it helpful to understand how the script works. The macro assumes that one desktop shortcut is selected. (You can get to this stage by clicking a desktop shortcut once.) Then press Ctrl + 1 to start the macro.

 

The macro opens the "Properties" screen for the selected shortcut.

 

Then the macro does the equivalent of clicking on the "Change Icon…" button.

 

Then, in the "Change Icon" screen, the macro navigates to the area of the window that displays all currently available icons.

 

Then, the macro chooses the topmost icon in the display area. That's what the "Home" key does. If you want to choose a different icon, you can add different key presses, e.g., right arrow and down arrow.

 

Then, the macro does the equivalent of clicking the "OK" button in the "Change Icon" screen.

 

Finally, the macro does the equivalent of clicking the "OK" button in the "Properties" screen.

 

With this explanation in mind, it's your turn to start "debugging" the script. I suggest that you insert a "Macro Stop" after the first or second step, and save the macro. Check whether the macro is bringing you closer to what you need the macro to do.

 

If it's successful, move the "Stop" command downward a step, save the script, and try again. And so on.

Link to comment
Share on other sites

I inserted a Macro Stop after every step.

The original failure led me to try a different hotkey : CTRL_5

When I clicked on the target desktop shortcut and then pressed CTRL_5, a Properties window opened, but for a shortcut to the right and below the target one.

Since you thought CTRL_1 was the hotkey, I reverted to that, but pressing CTRL_1 caused a blimp, but did NOT open a Properties page.

 

So for now, the hotkey will be CTRL_5, and the next task is to lock-in the correct shortcut......

Link to comment
Share on other sites

2 hours ago, Sebastian42 said:

I inserted a Macro Stop after every step.

...

Properties window opened, but for a shortcut to the right and below the target one.

 

Did you control for the "Macro Stop" at the point where the Properties window opens but before the macro presses HOME?

 

While there can be conflicts between Windows system and Macro Express hotkeys, I've never encountered them when using Ctrl+1. In fact, I've used Ctrl+1 through Ctrl+0 for decades (under Keyboard Express, then non-pro Macro Express, initially) as Copy commands for multiple clipboards and the corresponding Alt keys for the Paste function.

Link to comment
Share on other sites

1 hour ago, Sebastian42 said:

I am not sure what you mean by 'control for the "Macro Stop"'

 

The CTRL_1 'malfunction' can be left till last to be sorted - after the macro works.

image.png.9df0e4f3ea7a827864f4b31cb8563911.png

 

"Macro Stop" stops the macro. There's no way to continue beyond that command. That's why acantor suggested adding Macro Stop, testing, and then moving that command down to to the next command, testing, etc.

 

However, I see from your screenshot exactly what's wrong. Your 1st command was copied into your macro from acantor's cleartext explanation of what his macro does. The actual first command for the macro is Step 3 of your macro. I would recommend deleting what you have for commands 1 and 2.

 

I personally don't use Macro Stop for troubleshooting line by line. Instead, I use Text Box Display commands personalized for which line I'm on. I may add specific values/variables into the text box to make sure everything is the way it's supposed to be. And this way, usually, I can just continue on to the next step without having to modify the macro every step of the way.

 

I've just confirmed that Ctrl+1 does not affect this macro at all.

Select Default Icon.gif

 

<TEXT TYPE Action="0" Text="<ALT><ENTER>" _COMMENT="Properties for desktop icon"/>
<DELAY Flags="\x02" Time="500"/>
<TEXT BOX DISPLAY Title="Confirm Alt Enter Worked" Content="{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang1033{\\fonttbl{\\f0\\fnil Tahoma;}}\r\n\\viewkind4\\uc1\\pard\\f0\\fs20 \r\n\\par }\r\n" Left="Center" Top="Center" Width="278" Height="200" Monitor="0" OnTop="TRUE" Keep_Focus="TRUE" Mode="\x00" Delay="0"/>
<TEXT TYPE Action="0" Text="<ALT>c" _COMMENT="Change icon..."/>
<DELAY Flags="\x02" Time="500"/>
<TEXT BOX DISPLAY Title="Confirm Alt C Worked" Content="{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang1033{\\fonttbl{\\f0\\fnil Tahoma;}}\r\n\\viewkind4\\uc1\\pard\\f0\\fs20 \r\n\\par }\r\n" Left="Center" Top="Center" Width="278" Height="200" Monitor="0" OnTop="TRUE" Keep_Focus="TRUE" Mode="\x00" Delay="0"/>
<TEXT TYPE Action="0" Text="<ALT>s" _COMMENT="Select an icon from the list below"/>
<DELAY Flags="\x02" Time="500"/>
<TEXT BOX DISPLAY Title="Confirm Alt S Worked" Content="{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang1033{\\fonttbl{\\f0\\fnil Tahoma;}}\r\n\\viewkind4\\uc1\\pard\\f0\\fs20 \r\n\\par }\r\n" Left="Center" Top="Center" Width="278" Height="200" Monitor="0" OnTop="TRUE" Keep_Focus="TRUE" Mode="\x00" Delay="0"/>
<TEXT TYPE Action="0" Text="<HOME>" _COMMENT="Select the icon in the top left"/>
<DELAY Flags="\x02" Time="500"/>
<TEXT BOX DISPLAY Title="Confirm HOME Worked" Content="{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang1033{\\fonttbl{\\f0\\fnil Tahoma;}}\r\n\\viewkind4\\uc1\\pard\\f0\\fs20 \r\n\\par }\r\n" Left="Center" Top="Center" Width="278" Height="200" Monitor="0" OnTop="TRUE" Keep_Focus="TRUE" Mode="\x00" Delay="0"/>
<TEXT TYPE Action="0" Text="<ENTER>" _COMMENT="OK"/>
<DELAY Flags="\x02" Time="500"/>
<TEXT TYPE Action="0" Text="<ENTER>" _COMMENT="OK"/>

 

 

Edited by stevecasper
Added my macro text
Link to comment
Share on other sites

Hahah, yeah, I noticed that, too.

 

That's just how my clipboard copied it from MEP. I just highlighted the commands and used keyboard shortcuts for Copy/Paste. Alternatively, the right-click context menu offers Copy Command Text, which gives us the simplified output. I was just being lazy and using ctrl+c / ctrl+v.

 

Text Type (Simulate Keystrokes): <ALT><ENTER> // Properties for desktop icon
Delay: 500 milliseconds
Text Box Display: Confirm Alt Enter Worked
Text Type (Simulate Keystrokes): <ALT>c // Change icon...
Delay: 500 milliseconds
Text Box Display: Confirm Alt C Worked
Text Type (Simulate Keystrokes): <ALT>s // Select an icon from the list below
Delay: 500 milliseconds
Text Box Display: Confirm Alt S Worked
Text Type (Simulate Keystrokes): <HOME> // Select the icon in the top left
Delay: 500 milliseconds
Text Box Display: Confirm HOME Worked
Text Type (Simulate Keystrokes): <ENTER> // OK
Delay: 500 milliseconds
Text Type (Simulate Keystrokes): <ENTER> // OK

 

Link to comment
Share on other sites

Glad you got the macro to work!

 

To me, the problem you posed is an excellent example of the kind of task that is amenable to automation via macros: a single action (e.g., press Ctrl+ 1) replaces a long sequence of keystrokes and/or a precise series of clicks, right-clicks, and scrolls.

Link to comment
Share on other sites

With the merits of automation that you refer to in mind, I have written many macros that I eventually abandoned because although they COULD achieve the desired end, they often did not, so I must have chosen some ambiguous steps resulting in unreliability - a case that comes to mind, is storing a snapshot of the desktop.

Link to comment
Share on other sites

It takes time to "fine-tune" macros like this one; and even when one puts in the time, 100% reliability is not guaranteed!

 

To make this macro more "bullet-proof," it might help to wait for the "Properties" window to appear, and especially, for the "Change Icon" windows to appear... Perhaps something like this:

 

Wait for Window Title: Change Icon

 

On the other hand, if the macro in its current state works 80% of the time, I might be tempted to leave it as it is!

Link to comment
Share on other sites

I also doubt that waiting for the "Change Icon" window will make a difference. The control that displays the icons is limited -- much more limited than similar controls . Only the most basic keyboard interaction rules are supported.

 

If the icon that appears in the top-left corner varies, the script won't behave as expected.

 

But how about the icons at the bottom of the list? Instead of pressing [Home], press [End]. Don't like that icon? Then press [Up] several times until you find one you do like. Let's say you pressed [Up] seven times. Then change this:

 

Text Type (Simulate Keystrokes): <HOME>

 

To this:


Text Type (Simulate Keystrokes): <END><UP ARROW><UP ARROW><UP ARROW><UP ARROW><UP ARROW><UP ARROW><UP ARROW>

Link to comment
Share on other sites

If the positions of icons shift in the "Change Icon" window, perhaps the best solution is to stop the macro after the list of icons has focus, or after the first (or last) icon is selected. Then manually select the icon you want, press Enter twice, and you're done.

Link to comment
Share on other sites

  • 2 months later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...