Jump to content

Rename Desktop items / _GUICtrlListView_SetItemText


Recommended Posts

Hello,

I'm trying to rename a shortcut on the desktop called "ASTr" to "ASTr-v3.1.3" with _GUICtrlListView_SetItemText:

#Include <GuiListView.au3>

$hWnd_LV = ControlGetHandle("[CLASS:Progman]", "", "SysListView321")

For $nIdx = 0 To _GUICtrlListView_GetItemCount ($hWnd_LV) - 1
    $sIconText = _GUICtrlListView_GetItemText ($hWnd_LV, $nIdx)
    $aPos = _GUICtrlListView_GetItemPosition ($hWnd_LV, $nIdx)
    ;MsgBox( 0, "Desktop item " & $nIdx, $sIconText & " at X=" & $aPos[0] & ", Y=" & $aPos[1] )
    If StringRegExp ( $sIconText, '^ASTr', 0 ) Then
        ;MsgBox( 0, "Desktop item " & $nIdx, $sIconText & " at X=" & $aPos[0] & ", Y=" & $aPos[1] )
        _GUICtrlListView_SetItemText($hWnd_LV, $nIdx, "ASTr-v3.1.3")
    EndIf

Next

MsgBox( 0, "", "Done" )

This kinda works: I can see the text changed on the desktop, until I refresh the desktop that is!

_GUICtrlListView_SetItemText effect seems non-persistent!

I see in include/GuiListView.au3 it's sending an LVM_SETITEM message. Should it be sending another message?

Edited by ExpertNoob
Link to comment
Share on other sites

Something wrong with FileMove()? And IIRC, a hyphen is an invalid character in a file name.

;
If FileExists(@DesktopDir & "\ASTr.lnk") Then FileMove ( @DesktopDir & "\ASTr.lnk", @DesktopDir & "\ASTr_v3.1.3.lnk")
;
Edited by GEOSoft

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

That only proves I'm too expert, playing with complicated 32-character-long function names..

Still, I'm a noob, not thinking of the obvious FileMove approach!

Hence the ExpertNoob :)

Thank you GEOSoft for offering me an option!

Still, I'm curious why _GUICtrlListView_SetItemText's action does not persist !

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...