Renderer Posted January 18, 2019 Posted January 18, 2019 Hello everyone! I'm currently working on a small program and I got stuck on a problem. I need to know how to associate a file extension to an AutoIT Program. I've also tried this: RegWrite("HKEY_CLASSES_ROOT\",".extension","REG_SZ","E:\Program.exe") , but it does not work. I assume, I need first to register the program into the Registry, before i could associate it to a file extension. Has someone any idea about how can I do this in a right way? Thanks in advance!
FrancescoDiMuro Posted January 19, 2019 Posted January 19, 2019 @Renderer Take a look at assoc command Click here to see my signature: Spoiler ALWAYS GOOD TO READ: Forum Rules Forum Etiquette
Renderer Posted January 19, 2019 Author Posted January 19, 2019 8 hours ago, FrancescoDiMuro said: @Renderer Take a look at assoc command I have created a small application in AutoIT and i want to assosciate it to a file extension. I have compiled it and put it in E:\Program.exe Then I tried manually to create a file association in the Registry Editor like bellow: HKEY_CURRENT_USER\Software\Classes\AppName.file.ext\DefautIcon DefaultIcon = E:\Icon.ico HKEY_CURRENT_USER\Software\Classes\AppName.file.ext\Shell\Open\Command Command = E:\Program.exe HKEY_CURRENT_USER\Software\Classes\.ext\(Standard) (Standard) = AppName.file.ext And It does not work.
Earthshine Posted January 19, 2019 Posted January 19, 2019 (edited) Uoh Let’s think. Hmmm I’ll get back to this when at a pc Have you at least tried logging off and back on to see if it loads it in the registry? Edited January 19, 2019 by Earthshine My resources are limited. You must ask the right questions
BrewManNH Posted January 19, 2019 Posted January 19, 2019 @Renderer Did you even look at the link provided to you about the assoc command in Windows? It works much easier than trying to manipulate the registry, as its intended function is to do it for you. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator
Nine Posted January 19, 2019 Posted January 19, 2019 Can you tell us what is the exact extension you want to link to your program.exe ! “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Debug Messages Monitor UDF Screen Scraping Round Corner GUI UDF Multi-Threading Made Easy Interface Object based on Tag
Renderer Posted January 19, 2019 Author Posted January 19, 2019 (edited) I have done it. I have managed to create a new extension and to associate it to my AutoIT program. Now I have to make the program recognize when the file is open and eventually get some data from the file and display it into a GUI. To be more specific, let's think about Notepad. It has the "txt" file associated to it. When you open a "txt" file, the data is being displayed in the Notepad app. The same I want to do with my program. At this moment I could create a file extension and associate it to the program I want, but I do not know how to make them fully work together. I hope I brought you a good understanding upon what I mean. Edited January 19, 2019 by Renderer
FrancescoDiMuro Posted January 19, 2019 Posted January 19, 2019 (edited) 13 minutes ago, Renderer said: I hope I brought you a good understanding upon what I want I mean. Just create a GUI, a menu through which the user can select a file (filtering your custom extension), open it, read it, and pass the content of the file to a Edit/Rich Edit control in your GUI Edited January 19, 2019 by FrancescoDiMuro Click here to see my signature: Spoiler ALWAYS GOOD TO READ: Forum Rules Forum Etiquette
Nine Posted January 19, 2019 Posted January 19, 2019 I find it very intriguing why you always evade on not revealing the extension ! “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Debug Messages Monitor UDF Screen Scraping Round Corner GUI UDF Multi-Threading Made Easy Interface Object based on Tag
Renderer Posted January 24, 2019 Author Posted January 24, 2019 On 19.1.2019 at 11:42 PM, Nine said: I find it very intriguing why you always evade on not revealing the extension ! I work on a text editor. I have created a new file extension (.text) in the Registry and associated it to my program.exe. All I want to do is to create a link between the program.exe and the extension (.text) so that the when I open a file.text, it could be fully operated through program.exe. Think about Notepad. You do not need to go to File > Open in order to open a file, you just click the file you want in order to open it and read it. The same I wanted to make for my program. I would be something like: click file.text < open through> [program.exe] -> dispaly Content of file.text . In short, the program.exe must be capable to get the content of a file associated to it.
Nine Posted January 24, 2019 Posted January 24, 2019 (edited) Ok, if you want to create a new ext, then you will have to add a new key (like .text), associate it with a default generic definition then create the new generic definition and associate it the commands you allow it. Edit : Look at .au3 setup, it is clearly similar Edited January 24, 2019 by Nine “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Debug Messages Monitor UDF Screen Scraping Round Corner GUI UDF Multi-Threading Made Easy Interface Object based on Tag
Renderer Posted January 24, 2019 Author Posted January 24, 2019 44 minutes ago, Nine said: Ok, if you want to create a new ext, then you will have to add a new key (like .text), associate it with a default generic definition then create the new generic definition and associate it the commands you allow it. Edit : Look at .au3 setup, it is clearly similar At this moment it looks like that: Registry: HKEY_CLASSES_ROOT\TextEditor.text\DefaultIcon\Standard (REG_SZ) : E:\Icon.ico HKEY_CLASSES_ROOT\TextEditor.text\Shell\ Standard (REG_SZ) : Open HKEY_CLASSES_ROOT\TextEditor.text\Shell\Open\Command\ Standard (REG_SZ) : "E:\TextEditor.exe" --started-from-file "%1" TextEditor.exe > code: global $GUI = GUICreate("Text Editor",550,450) global $GUI_Edit = GUICtrlCreateEdit("",0,0,550,450) GUISetState() while True Switch GUIGetMsg() Case -3 ExitLoop EndSwitch WEnd When I create a file (ex: Sample.text) the TextEditor.exe is opened but it displays "Text Editor" as title and no data into Edit. I guess the main problem is the TextEditor.exe . I need to code it, so that, when I open Sample.text it shows me "Sample.text" as title and the Text inside the Edit.
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