Question regarding Jaffob's new Commandline object
Hey, folks!
I started playing around with Jaffob's new Commandline object... I wanted to ask whether I was using it properly, as it seems that it only functions if one item is selected to be opened; if more than one item is selected to be opened, only the last item selected is imported.
So, here's how I'm using it:
Start of Frame
-->Commandline object: CommandLine$ (Parse Command Line)
-->Start Loop "Add Commandline Items" Commandline object's "File Count" of times
On Fastloop "Add Commandline Items"
-->Add a line to the list with Commandline object's "File at 'Add Commandline Items' Fastloop index number
The Fastloop works fine, but somehow it seems to only add one line (the last selected item to be opened).
It seems that Jaffob designed the Commandline object to handle multiple selected items to be opened via the Commandline, so I suspect I'm doing something wrong. Any ideas?
Thanks for your help!
Most appreciatively...
RGBreality
Re: Question regarding Jaffob's new Commandline object
Could you upload your MFA file? The code you've described should work, so it would help to take a look at it to make sure it's right. :)
Re: Question regarding Jaffob's new Commandline object
Hey, Jaffob!
You may download the latest iteration of my MFA file here:
View MFA
While you're at it, could you take a look at your Power System object's "Set Default Association" action, and see if I'm using it correctly? Whenever I use this action in a build, the application crashes during run-time. To test this for yourself in a build, use the keystroke CTRL+Q to bring up a dialog box to specify which file extensions to set as default associations; when the dialog box closes (and the "Set as default association" action executes for each selected file type), the application crashes on my two test computers. If those actions are removed, it won't crash. (Taking LB's advice regarding using Number keypad spaces instead of Space bar spaces, I still get these results.)
Thank you very much for your help with this! I very much appreciate your expertise and your time!
Most graciously...
RGBreality
Re: Question regarding Jaffob's new Commandline object
I'm not sure what's going wrong with the command line for you; on my computer your app works just fine as it is. I tested this by building your application, then dragging three audio files onto the icon of its built EXE. I then opened the "Playlist" file in notepad and all the filenames were there. Were you testing the built app (it only works properly when built as an EXE)? Perhaps you selected three files and right-clicked to open all of them? Windows doesn't allow you to open multiple files in the same program by doing that.
As for the file associations, that works completely fine for me too. I tested by registering a few filetypes with your dialog. I then created files of that type on the desktop and they opened with your app (again, it does have to be built though). Looking at your code, I did notice you doing something like this (I'll use the FLV format as an example):
Code:
--Add Association "FLV" for extension "flv"
--Set Default Association of "flv" to "FLV Media Format"
Set Default Association in this case should be given the association name, i.e. "FLV". You seem to be setting the extension's description as a default association, when you should be using the association's name.
None of this should cause a crash though. Perhaps your computer is restricting your app's access to the registry in some way? Try making a few harmless changes with the Registry2 or Registry++ objects, just to test if your app can access important system files. Otherwise I'm not sure of the cause of this.
Re: Question regarding Jaffob's new Commandline object
Hey, Jaffob! Thank you very much for looking at this!
Well, you definitely taught me something new today: I didn't realize that one couldn't open multiple files from Windows Explorer (by right-clicking on them and selecting "Open"). That was, in fact, how I was testing the Commmand line functionality.
Regarding the file association functionality, let me ask you a few more short questions. For whatever reason, the built application still crashes when using the Set Default Association action. I'll have to play with that some more.
1.) What might you recommend I change in the Registry (using the Registry object), just to test whether the computer allows me to change Registry entries?
2.) Even once I set up a file extension association, when I either (a) right-click on a file with a supported file extension, or (b) view the "Select which program to open this file with" dialog box, I only see the application icon in the list; however, I don't see the name of the application (it's just blank). How can I get the application's name displayed? Or do you not get that when run on your computer?
3.) When a file type has been associated with the application, the application's icon isn't displayed with files of that file extension; I only see the "unknown icon" icon associated with such files. When setting up the "associate file extension" actions, I did specify to use the application's icon (which is MMF2's out-of-the-box icon). Do I need to set the icon index to "0" or to a different number? (I was a little confused by the documentation which number I should use.)
Okay, these questions did not end up being very short, were they?... :)
Thank you again for your help!
Most appreciatively...
RGBreality
Re: Question regarding Jaffob's new Commandline object
1. Well thinking about it, that's probably not the problem if you can register file types on your computer. It seems like the problem is likely with Set Default Association only.
2. The name displayed next to the icon is the application's description. You can change this in the right-most tab of the application properties. When your app is built, that name will appear when Windows "talks about" your application, for example when on the open with list, or when you hover your mouse over the EXE.
While doing that will get the job done, I recommend downloading Resource Hacker to fix a small problem with MMF. For some reason, MMF adds a long string of spaces after your description name, which can look pretty ugly when displayed to the user.
3. Perhaps an explanation of file types would help. Windows stores all registered file types in the registry. Every file type comes with its extension (for example, ".TXT"), a description ("Text Document"), an icon (the Notepad symbol), perhaps some other stuff, and associations. These pieces of information are specific to the entire file type; the file type's associations are independent of the description, icon, etc.
You can think of associations as another one of these pieces of information about a file type. Associations are essentially pairings of names to applications. You can imagine them like this:
Open ---> C:\Folder\MyGame.exe
Edit ---> C:\Folder\MyEditor.exe
Email ---> C:\Windows\Outlook.exe
The associations are what tell Windows which programs can be used to open the file, and are displayed in the menu when the file is right-clicked. The default association is which one of these will be run when the file is double-clicked.
That being said, the icon is specific to the file type, not a particular association of it. Use the "Set Icon" action, or alternatively use the parameters of the "Create/Setup File Type" action. Give the action the path of your EXE, and then the index of the icon stored within it.
Hope that helps. :)
Re: Question regarding Jaffob's new Commandline object
Hey, Jaffob!
Thanks for that detailed clarification. It was indeed helpful! I found that if I used the "Create/Setup File Type" action, that icons would properly display next to associated file types. (Though for some reason despite making changes to the "About" and "Description" fields in the MMF2 application properties, the application name is not displaying in Windows Explorer, though it does display in "crash" dialog boxes.)
I got to thinking: Since I have been having problems (for whatever reason) with the "Set default association" action, suppose I were to use the Registry object to specify the same action. Are not the file type assocations stored in HKEY_LOCAL_MACHINE\Software\Classes (to affect file types for all users)? I'm not sure what the value would be to specify my MMF2 application as the default program to open for each file type.
Thank you again for your assistance and feedback!
Most appreciatively...
RGBreality
Re: Question regarding Jaffob's new Commandline object
File associations are stored in HKEY_CLASSES_ROOT of the registry. In there you'll find a long list of keys named after all the file extensions (e.g. ".txt"). Each of these keys' default values will point to another key which is where information will be stored. For .txt files, this is the key "txtfile".
These 2nd key names can be anything really. Power System Object creates these names the same way every time: "pso.fileext". Take a look through the registry (Start Menu -> Run -> "regedit"), see if you can figure out how to change the default association. :)
Re: Question regarding Jaffob's new Commandline object
Hey, Jaffob!
I'm afraid I'm a little confused--but the learning process is good!
I have tracked down how to view all the "shell" keys from each created file type in HKEY_CLASSES_ROOT. When I look at "txtfile" as an example, I see that there is a value called "Default" with the string value "Open" (which I take to mean that of all the sub-keys under "shell"--when one right-clicks on a text file--that the shell option "open" is the default).
So, following that idea, I manually adjust the HEY_CLASSES_ROOT\pso.mp3\shell's key "(Default)" to "Play with my MMF application". When I go to Windows Explorer and right-click on an MP3 file, it is not the default application choice to open an MP3 file. But my MMF2 application is the first application choice when I view the applications under the "Open With..." context menu.
When I look at the "txtfile" key, I see there is a key value called "FriendlyTypeName," which I initially thought was the key used to specify the default application. But when I added this key to the "pso.mp3" key, this changed the description of the MP3 file extension type when viwed from Windows Explorer's "Folder Options."
So, I'm afraid I'm still a bit lost. Could you give me another hint?
(As a side note, I find that both you and LB are excellent teachers with MMF2! Both of you don't just "hand out the answers," but offer enough to let me learn for myself--which ultimately helps me learn the product better. So kudos to you!)
Thanks again for all your help!
Most appreciatively...
RGBreality
Re: Question regarding Jaffob's new Commandline object
I didn't mention this before, but file associations actually have three components to them. They have the "system name" for the association (hidden from the user), the "display name" (what appears on the right-click menu in Explorer) and the file to open. The system name is the name of the association's key under the "shell" key. The display name is stored as the default value of this key. The EXE to run is the default value of the "command" sub-key.
The default association setting uses the system name. To change the default association, set the default value of the "shell" key to the system name of the association you want.
Hope that helps. :)