Sign in to follow this  
Followers 0
Guest flattentheskyline

Creating an icon changer automation

6 posts in this topic

Okay I'm looking to write a script, although I'm not sure how useful it will be to anyone other than myself, that checks a folder to see if it's icon is of a chosen icon and if not it changes it to that icon.

The use of this for me is as follows:

My C: drive consists only of music albums, each titled [band Name] - [Album Name]

I want to make each of those icons of a certain type, each with a music note on the folder, not that it matters.

At the current time I am only looking into writing a sript to do this with my C: drive, so I plan on hard coding in the parameters to save some time, but I will most likely add detailed settings later.

So here is how I planned on doing this (flow chart type idea.)

Run -> My Computer.

Select C:

Send Enter

//First stumbing block is here. The only way I can find to select the first folder is to do a {DOWN} and then {UP} send. That doesn't seem to efficient to me, however this is my first dive into auto it so I'm only 20 minutes into the language. Well, regardless:

Send {DOWN} {UP}

??Find amount of files/folders in active window

//Not sure how I'd do this.

START LOOP (Number of times = "number of folders/files - 1")

Open properties, head to customize -> change Icon.

Get text from preselected box.

Compare to location of hard coded icon location

If different,

--Send "[icon location]"

Else

--Tab X times to cancel and return.

--Tab X times to cancel and return--again.

Send {DOWN}

END LOOP

Create message window.. "All Icons Changed."

----------------------------------------------

My main problem right now is figuring out how to launch my computer, so I'd greatly appreciate any knowledge on this.

Also any info on counting folders/files would be fantastic.

Thanks in advance for any and all tips.

--Steve

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

; Script Start - Add your code below here
Run('D:\mycomp.lnk')
Send("{DOWN} {UP} {ENTER}")
WinActivate ("MUSIC (C:)")
WinWaitActive("MUSIC (C:)")

; Highlight first folder and open Properties.
Send("{DOWN} {UP} {APPSKEY} {UP} {ENTER}")
Sleep(3000)

; Set status to customize tab.
Send("{TAB} {TAB} {TAB} {TAB} {TAB} {RIGHT} {RIGHT}")

; Launch Change Icon.
Send("!i")

; Change Icon.
Send("D:\music_f.ico {ENTER} {ENTER} {TAB} {ENTER}")

Problem here is. Run won't launch the shortcut to my computer. Anyways this is what I have so far and I have no idea if it works as I can't launch My Computer yet.

Edited by flattentheskyline

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Fantastic.. it is in a working mode now.. I just need to figure out how to grab number of files/folders. And a way to launch My Computer ofther than from a .lnk file would be fantastic too.

Here is what I came up with:

; Script Start - Add your code below here
RunWait(@COMSPEC & ' /c  start ' & 'D:\mycomp.lnk')
Sleep(500)
WinActivate("My Computer")
WinWaitActive("My Computer")
Send("{DOWN}{UP}{ENTER}")
WinActivate ("MUSIC (C:)")
WinWaitActive("MUSIC (C:)")

; Highlight first folder and open Properties.
Send("{DOWN}{UP}{APPSKEY}{UP}{ENTER}")
Sleep(500)

; Set status to customize tab.
Send("{TAB}{TAB}{TAB}{TAB}{TAB}{RIGHT}{RIGHT}")

; Launch Change Icon.
Send("!i")[CODE]
Sleep(500)

; Change Icon.
Send("D:\music_f.ico{ENTER}{ENTER}{TAB}{ENTER}")

;Start Loop
$loop1 = 0
While $loop1 < 3
; Open Properties of next folder
    Sleep(500)
    Send("{DOWN}")
    Sleep(250)
    Send("{APPSKEY}{UP}{ENTER}")
    Sleep(250)

; Set status to customize tab.                  
    Send("{TAB}{TAB}{TAB}{TAB}{TAB}{RIGHT}{RIGHT}")

; Launch Change Icon.
    Send("!i")
    Sleep(500)

; Change Icon.
    Send("D:\music_f.ico{ENTER}{ENTER}{TAB}{ENTER}")
    $loop1 = $loop1 + 1
WEnd
Edited by flattentheskyline

Share this post


Link to post
Share on other sites

And a way to launch My Computer ofther than from a .lnk file would be fantastic too.

Reference: CLSID List in Helpfile.

Run("explorer ::{20D04FE0-3AEA-1069-A2D8-08002B30309D}")

:)

Share this post


Link to post
Share on other sites

Reference: CLSID List in Helpfile.

Run("explorer ::{20D04FE0-3AEA-1069-A2D8-08002B30309D}")

:)

<{POST_SNAPBACK}>

Awesome.. Thanks so much.

Now for away to count folders? Does it exist?

Share this post


Link to post
Share on other sites

Now for away to count folders? Does it exist?

<{POST_SNAPBACK}>

A looping combination of FileGetFirstFile, FileGetAttrib and FileGetNextFile should do it. If you made a call out to VBScript via Windows Script Host, the FileSystemObject has a folders collection and a Count property...

Dale


Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0