camilla Posted September 7, 2013 Share Posted September 7, 2013 hello everybody, as you see i'm newbie and i'm learning about autoit commands such as " Associate file type" i did thid script , but it didn't work for me ;I am learning _Associate (".jpg", "JPGFile", "%1") Func _Associate($EXT , $FileType, $FileName) RegWrite ("HKCR" & $EXT & "", $FileType) RegWrite ("HKCR" & $FileType & "", "MY file") RegWrite ("HKCR" & $FileType & "DefaultIcon", $FileName) RegWrite ("HKCR" & $FileType & "shellopencommand", $FileName & " %1") EndFunc it didn't change anything, while this code RegWrite('HKCR.jpeg', '', 'REG_SZ', 'jpegfiles') RegWrite('HKCRjpegfilesshellopencommand', '', 'REG_SZ', "%1") works but the icon of the changed extension does not appear as an jpg icon i want to keep the same icon ,but run any changed exe to jpj thank you in advance Link to comment Share on other sites More sharing options...
AZJIO Posted September 7, 2013 Share Posted September 7, 2013 (edited) Path and parameters must be enclosed in quotation marks. RegWrite("HKCR\" & $FileType & "\shell\open\command\", '"' & $FileName & '" "%1"') Edited September 7, 2013 by AZJIO My other projects or all Link to comment Share on other sites More sharing options...
guinness Posted September 7, 2013 Share Posted September 7, 2013 In my signature there is a UDF called _ShellFile(). UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 Link to comment Share on other sites More sharing options...
camilla Posted September 7, 2013 Author Share Posted September 7, 2013 i think i must put a folder for the "DefaultIcon" and put an icon of jpg in it ? Link to comment Share on other sites More sharing options...
camilla Posted September 7, 2013 Author Share Posted September 7, 2013 AZJIO it doesn't work In my signature there is a UDF called _ShellFile(). not like this i will explain more i did it and associate the "jpg" extension to "exefile" and i can run any exe file after changing it's extention to "jpg" , but the problem is in the icon of the changed "exe" it doesn't appear as an icon of jpg file that's it i just want to fix the problem of the icon association Link to comment Share on other sites More sharing options...
AZJIO Posted September 7, 2013 Share Posted September 7, 2013 camilla i just want to fix the problem of the icon association 1. I'm not sure that is supported jpg. Try ico, dll. 2. ; engine ; http://www.autoitscript.com/forum/topic/70433-rebuild-shell-icon-cache/page__view__findpost__p__531242 _RebuildShellIconCache() ; only WinXP 3. DllCall("shell32.dll", "none", "SHChangeNotify", "long", '0x8000000', "uint", '0x1000', "ptr", '0', "ptr", '0') My other projects or all Link to comment Share on other sites More sharing options...
camilla Posted September 7, 2013 Author Share Posted September 7, 2013 thank you ,but i need the script for all os not only xp can you wirte the full script if you test it Link to comment Share on other sites More sharing options...
camilla Posted September 7, 2013 Author Share Posted September 7, 2013 (edited) i can rewrite my question like this create new file type extension Example (tmpx) with the icon of a (jpeg)? by means the system any OS will show (tmpx) exactly as a (jpeg) file. after associating the extension to it Edited September 7, 2013 by camilla Link to comment Share on other sites More sharing options...
willichan Posted September 7, 2013 Share Posted September 7, 2013 Just out of curiosity, why do you want to make an icon look like it is something that it isn't? That example of renaming an EXE to JPG, to look like a JPG, but still execute is a little worrisome to me. My UDFs: Barcode Libraries, Automate creation of any type of project folder, File Locking with Cooperative Semaphores, Inline binary files, Continue script after reboot, WinWaitMulti, Name Aggregator, Enigma, CornedBeef Hash Link to comment Share on other sites More sharing options...
camilla Posted September 7, 2013 Author Share Posted September 7, 2013 do not worry this is just a test in my machine i mean OS and as i said i'm just learning i get this idea and try to make it .. i don't know about how to use dll files i want to see if i can add a new file extension with any icon example jpg icon if you can help post an answer Link to comment Share on other sites More sharing options...
willichan Posted September 7, 2013 Share Posted September 7, 2013 You can try looking at this article. http://www.winhelponline.com/blog/change-file-type-icon-windows-7-vista/ I can't guarantee that it will work on XP also. Since they handle a lot of things differently, there is often no one size fits all solution. My UDFs: Barcode Libraries, Automate creation of any type of project folder, File Locking with Cooperative Semaphores, Inline binary files, Continue script after reboot, WinWaitMulti, Name Aggregator, Enigma, CornedBeef Hash Link to comment Share on other sites More sharing options...
camilla Posted September 7, 2013 Author Share Posted September 7, 2013 You can try looking at this article. http://www.winhelponline.com/blog/change-file-type-icon-windows-7-vista/ thank you for your answer,but i want to do that through an autoit script i posted here i did this but it doesn't help RegWrite('HKCR.tmpx', '', 'REG_SZ', 'tmpxfile') RegWrite('HKCRtmpxfileDefaultIcon' "", "REG_SZ", "c:icon.ico ,1");icon.ico is an jpeg ico RegWrite('HKCRtmpxfileshellopencommand', '', 'REG_SZ', "%1") any idea? Link to comment Share on other sites More sharing options...
willichan Posted September 7, 2013 Share Posted September 7, 2013 The article I referenced gives you the registry entries that need to be made. You just need to put it into RegRead and RegWrite statements. If you read the article, and the help file on RegRead and RegWrite, I am sure you will figure it out. You won't learn anything if I do it for you. My UDFs: Barcode Libraries, Automate creation of any type of project folder, File Locking with Cooperative Semaphores, Inline binary files, Continue script after reboot, WinWaitMulti, Name Aggregator, Enigma, CornedBeef Hash Link to comment Share on other sites More sharing options...
camilla Posted September 7, 2013 Author Share Posted September 7, 2013 :shifty: i wil try to do it if i didn't succeed i will send you mssage to do it for me you know i'm new to autoit :shifty: Link to comment Share on other sites More sharing options...
camilla Posted September 7, 2013 Author Share Posted September 7, 2013 Note: If the DefaultIcon key does not exist by default, you need to create it manually. 7. In the right-pane, double-click (default) and mention the path to your custom icon (.ico file or reference to an icon resource from a EXE/DLL file) i think i did it in the script above RegWrite('HKCRtmpxfileDefaultIcon' ,"", "REG_SZ", "c:icon.ico ,1");icon.ico is an jpeg ico but nothing changed Link to comment Share on other sites More sharing options...
TheSaint Posted September 8, 2013 Share Posted September 8, 2013 You have a space between .ico and the comma, which may make a difference? And have you tried another number other than '1' after the comma? Perhaps it needs to be zero '0' Where did you get the icon file from? Is it a legitimate icon file, as recognized by Windows? Try another file, a Windows one, that you know has icon images in it (i.e. dll or exe). I presume you've pre-tested things manually, before using code to do it for you? In some of your code in posts above, I see the odd missing key, value or comma, etc. Make sure brain is in gear before opening mouth! Remember, what is not said, can be just as important as what is said. Spoiler What is the Secret Key? Life is like a Donut If I put effort into communication, I expect you to read properly & fully, or just not comment. Ignoring those who try to divert conversation with irrelevancies. If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it. I'm only big and bad, to those who have an over-active imagination. I may have the Artistic Liesense to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage) Link to comment Share on other sites More sharing options...
Developers Jos Posted September 8, 2013 Developers Share Posted September 8, 2013 do not worry this is just a test in my machine i mean OS and as i said i'm just learning i get this idea and try to make it .. i don't know about how to use dll files i want to see if i can add a new file extension with any icon example jpg icon if you can help post an answer We do worry when things could be used in a malicious way! So please keep that in mind when having these type of questions, Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. 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