Gif Posted June 20, 2007 Share Posted June 20, 2007 Func _DirSetIcon($directory, $IconFileOrShell, $IconNumberOrNothing = 0, $foldertip = '') IniWriteSection($directory & "\Desktop.ini", ".ShellClassInfo", "ConfirmFileOp=0" & @CRLF & "NoSharing=1" & @CRLF & "IconFile=" & $IconFileOrShell & @CRLF & "IconIndex=" & $IconNumberOrNothing & @CRLF & "InfoTip=" & $foldertip) FileSetAttrib($directory, "S") FileSetAttrib($directory & "\Desktop.ini", "+HS") If @error Then Return 0 SetError(0) Else Return 1 EndIf EndFuncoÝ÷ ÙìZ^Â+aÊ'jëh×6#include "_DirSetIcon.au3" DirCreate(@DesktopDir &"\dir") _DirSetIcon(@DesktopDir &"\dir", "C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\ndpsetup.ico", 0, "Icon example") ExitImportant: set $IconNumberOrNothing to zero if you are using an icon Link to comment Share on other sites More sharing options...
smashly Posted June 20, 2007 Share Posted June 20, 2007 (edited) Hi, Edit: forum bug , Valuater posted the correction further down the thread. Cheers Edited June 20, 2007 by smashly Link to comment Share on other sites More sharing options...
Valuater Posted June 20, 2007 Share Posted June 20, 2007 Hi, Question about the seterror. Would the error level be set doing the SetError(0) after Return? eg you have:[font=monospace] If @error Then Return 0 SetError(0) Else Return 1 EndIf[/font]oÝ÷ Ù(hºWbµ·ºÚ"µÍÙÛ[[ÛÜÜXÙWHYÜ[Ù]Ü B][ÙB]B[YËÙÛ The only reason I ask is because I was under the impression (I've probly got it wrong) if you return then the function is exited from the return point. I've not really played with setting error level so I was just curious. Cheers yes smash you are right also you could use Return SetError(0, 0, 0) 8) Link to comment Share on other sites More sharing options...
Gif Posted June 20, 2007 Author Share Posted June 20, 2007 yes that's right , made a mistake, updated Func _DirSetIcon($directory, $IconFileOrShell, $IconNumberOrNothing = 0, $foldertip = '') IniWriteSection($directory & "\Desktop.ini", ".ShellClassInfo", "ConfirmFileOp=0" & @CRLF & "NoSharing=1" & @CRLF & "IconFile=" & $IconFileOrShell & @CRLF & "IconIndex=" & $IconNumberOrNothing & @CRLF & "InfoTip=" & $foldertip) FileSetAttrib($directory, "S") FileSetAttrib($directory & "\Desktop.ini", "+HS") If @error Then SetError(0) Return 0 Else Return 1 EndIf EndFunc Link to comment Share on other sites More sharing options...
Gif Posted June 20, 2007 Author Share Posted June 20, 2007 (edited) yes that's right , made a mistake, updated c2--><!--YzItLSYjNjI7JiM2MDsmIzMzOy0tUm5WdVl5QmZSR2x5VTJWMFNXTnZiaWdtSXpBek5qdGthWEpsWTNSdmNua3NJQ1lqTURNMk8w bGpiMjVHYVd4bFQzSlRhR1ZzYkN3Z0ppTXdNelk3U1dOdmJrNTFiV0psY2s5eQpUbTkwYUdsdVp5QTlJREFzSUNZak1ETTJPMlp2 YkdSbGNuUnBjQ0E5SUNZak16azdKaU16T1RzcENpQWdJQ0JKYm1sWGNtbDBaVk5sWTNScGIyNG9KaU13TXpZN1pHbHlaV04wCmIz SjVJQ1poYlhBN0lDWnhkVzkwT3lZak1Ea3lPMFJsYzJ0MGIzQXVhVzVwSm5GMWIzUTdMQ0FtY1hWdmREc3VVMmhsYkd4RGJHRnpj MGx1Wm04bWNYVnZkRHNzSUNaeGRXOTAKTzBOdmJtWnBjbTFHYVd4bFQzQTlNQ1p4ZFc5ME95QW1ZVzF3T3lCQVExSk1SaUFtWVcx d095QW1jWFZ2ZER0T2IxTm9ZWEpwYm1jOU1TWnhkVzkwT3lBbVlXMXdPeUJBUTFKTQpSaUFtWVcxd095QW1jWFZ2ZER0SlkyOXVS bWxzWlQwbWNYVnZkRHNnSm1GdGNEc2dKaU13TXpZN1NXTnZia1pwYkdWUGNsTm9aV3hzSUNaaGJYQTdJRUJEVWt4R0lDWmhiWEE3 CklDWnhkVzkwTzBsamIyNUpibVJsZUQwbWNYVnZkRHNnSm1GdGNEc2dKaU13TXpZN1NXTnZiazUxYldKbGNrOXlUbTkwYUdsdVp5 QW1ZVzF3T3lCQVExSk1SaUFtWVcxd095QW0KY1hWdmREdEpibVp2Vkdsd1BTWnhkVzkwT3lBbVlXMXdPeUFtSXpBek5qdG1iMnhr WlhKMGFYQXBDaUFnSUNCR2FXeGxVMlYwUVhSMGNtbGlLQ1lqTURNMk8yUnBjbVZqZEc5eQplU3dnSm5GMWIzUTdVeVp4ZFc5ME95 a0tJQ0FnSUVacGJHVlRaWFJCZEhSeWFXSW9KaU13TXpZN1pHbHlaV04wYjNKNUlDWmhiWEE3SUNaeGRXOTBPeVlqTURreU8wUmxj MnQwCmIzQXVhVzVwSm5GMWIzUTdMQ0FtY1hWdmREc3JTRk1tY1hWdmREc3BDaUFnSUNCSlppQkFaWEp5YjNJZ1ZHaGxiZ29nSUNB Z0lDQWdJQ0JUWlhSRmNuSnZjaWd3S1FvZ0lDQWcKSUNBZ0lGSmxkSFZ5YmlBd0NpQWdJQ0JGYkhObENpQWdJQ0FnSUNBZ1VtVjBk WEp1SURFS0lDQWdJRVZ1WkVsbUNrVnVaRVoxYm1NPS0tJiM2MjsmIzYwOyYjMzM7LS1lZw==--><!--eg ok there's a forum bug , just look at the quotes EDIT: i ve tryedn editing the first post but i cant... Edited June 20, 2007 by c4nm7 Link to comment Share on other sites More sharing options...
Valuater Posted June 20, 2007 Share Posted June 20, 2007 Not sure about that error ... but this should handle it Func _DirSetIcon($directory, $IconFileOrShell, $IconNumberOrNothing = 0, $foldertip = '') IniWriteSection($directory & "\Desktop.ini", ".ShellClassInfo", "ConfirmFileOp=0" & @CRLF & "NoSharing=1" & @CRLF & "IconFile=" & $IconFileOrShell & @CRLF & "IconIndex=" & $IconNumberOrNothing & @CRLF & "InfoTip=" & $foldertip) If Not FileSetAttrib($directory, "S") And Not FileSetAttrib($directory & "\Desktop.ini", "+HS") Then Return SetError(0, 0, 0) Return 1 EndFunc 8) Link to comment Share on other sites More sharing options...
Achilles Posted June 20, 2007 Share Posted June 20, 2007 ok there's a forum bug , just look at the quotesEDIT: i ve tryedn editing the first post but i cant...Something is very messed up with the autoit tags! My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list] Link to comment Share on other sites More sharing options...
Gif Posted June 20, 2007 Author Share Posted June 20, 2007 Something is very messed up with the autoit tags!i noticed that when i try to reply to a text with autoit tags or edit mine, the words become like before, also theautoit tags button is not working and the autoit favicon is missinginstead i see an IP.B faviconsomething is wrong! Link to comment Share on other sites More sharing options...
Valuater Posted June 20, 2007 Share Posted June 20, 2007 Something is very messed up with the autoit tags!I have had the same problem all day8) Link to comment Share on other sites More sharing options...
Gif Posted June 20, 2007 Author Share Posted June 20, 2007 I have had the same problem all day8)forums are updated to version 2.3.0, seems to be a problem with IP.B v2.3.0 Link to comment Share on other sites More sharing options...
MrCreatoR Posted June 20, 2007 Share Posted June 20, 2007 Nice idea, i think it should have some more error checking ... $Ret = _DirSetIcon("C:\Some Dir", @AutoItExe, 0, "Tip Text") ConsoleWrite($Ret) Func _DirSetIcon($Dir_Path, $IconFile, $IconIndex=0, $TipText="") If Not StringInStr(FileGetAttrib($Dir_Path), "D") Then Return SetError(1, 0, -1) Local $DirSetFile If StringMid($Dir_Path, 2, 1) = ":" Then $DirSetFile = $Dir_Path & "\Autorun.inf" FileSetAttrib($DirSetFile, "-R") IniWrite($DirSetFile, "Autorun", "icon", $IconFile & ", " & $IconIndex) Else $DirSetFile = $Dir_Path & "\Desktop.ini" FileSetAttrib($DirSetFile, "-R") IniWrite($DirSetFile, ".ShellClassInfo", "IconFile", $IconFile) IniWrite($DirSetFile, ".ShellClassInfo", "IconIndex", $IconIndex) IniWrite($DirSetFile, ".ShellClassInfo", "InfoTip", $TipText) EndIf FileSetAttrib($DirSetFile, "+R") If Not FileSetAttrib($Dir_Path, "S") Then Return SetError(2, 0, 0) If Not FileSetAttrib($DirSetFile, "+HS") Then Return SetError(3, 0, 0) Return 1 EndFunc This function also allow to set icon for the drive (the results are seen after renaming the label of drive or restart windows). Spoiler Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1 AutoIt Russian Community My Work... Spoiler Projects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize ProgramUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF Examples: ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating ) * === My topics === * ================================================== ================================================== AutoIt is simple, subtle, elegant. © AutoIt Team Link to comment Share on other sites More sharing options...
Gif Posted June 20, 2007 Author Share Posted June 20, 2007 Nice, using this script you create a pseudo-invisible folder #include "_DirSetIcon.au3" DirCreate("C:\tempfile") DirMove("C:\tempfile", @DesktopDir &"\ ", 0) _DirSetIcon(@DesktopDir &"\ ", "%SystemRoot%\system32\SHELL32.dll", 51) Exit the space here (&"\ ") is not real space, it's ALT + 255 Link to comment Share on other sites More sharing options...
SleepyXtreme Posted June 20, 2007 Share Posted June 20, 2007 (edited) c4nm7 that doesn't work for me, although i do get the invis icon, the directory doesn't copy to have a blank text Edited June 20, 2007 by SleepyXtreme Link to comment Share on other sites More sharing options...
Gif Posted June 20, 2007 Author Share Posted June 20, 2007 c4nm7 that doesn't work for me, although i do get the invis icon, the directory doesn't copy to have a blank textcreate a folder and while renaming it press ALT then 255(only num keys) and release ALT, an invisible symbol should be created andyou can name the folder after this...also instead of 255 try 0160 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now