Associate folders to application ?

Hi,

I need to associate a bunch of folders (one at a time) to an application, so when I click in that “folder”, my application is run and open that said “folder”.

This have to run on OS X and Windows platforms. [Is it possible to do that on Windows ?]

Help is badly needed to achieve that (I really do not understand how I can do that).

TIA,

Emile

PS: I know how to associate a file type to an application.

I don’t think this is possible on OS X (don’t know about Windows). And if it were possible it would break the Apple Human Interface Guidelines badly.

I think what you are looking for are Folder Actions: Folder Actions

On OSX you can make a new service with Automator.
Then you’ve got it in the right click menu in Finder.

in Automator add AppleScript

tell application "Finder" to set myfile to selection as text
tell application "MyApp" to activate
tell application "MyApp" to open myfile

What you put as “myfile” is a fully qualified path, like /Volumes/MyDrive/MyFile, in quotes?

myfile is the folder you selected in Finder.

for example - open the selected folder with my app Mplayer

[quote=104560:@Emile Schwarz]I need to associate a bunch of folders (one at a time) to an application, so when I click in that “folder”, my application is run and open that said “folder”.

This have to run on OS X and Windows platforms. [Is it possible to do that on Windows ?]

Help is badly needed to achieve that (I really do not understand how I can do that).[/quote]

This was discussed at length in
https://forum.xojo.com/10928-folder-that-opens-an-app

Most of the solutions discussed are, as usual, for Mac.

For all platforms, I would create a small app with a folder icon that sole purpose is to :

  • Open a folder (which can be next, or elsewhere)
  • Open the associated program

Alternatively, you could use a document with a type that launches your app, which opens a folder by the same name, and the associated program. But this means you have to set the file associations on your system, which is not necessary with solution 1.

As you will see in the older thread, there was some debate about the Apple guidelines dogma about that :wink:

Hi all,

Thank you for your answers. I will check / read them later today.

As far as I recall, FCP (Final Cut Pro and childs…) use a folder to save a the contents of a project.

Nota: I never used FCP nor saw any of its project(s) file(s).

Oh ! EyeTV use that too: the .eyetv files holds three xml files, one mp4 and two tiff images (the current image in two resolutions: standard and retina).

So, definitively, this exists on OS X.

What about Windows ?

Oh you are looking for a bundle. I’m on my phone now so I can’t help directly, but you use a key in your Info.plist to signify a document type is a bundle. Google might be able to help.

On Windows and Linux, there is nothing similar.

Thank you Thom, I will investigate.

On Windows and Linux, there is nothing similar.
How do they achieve the same feature then ?
I wonder.

The Bundle advantage is that everyone can add a new bundle / display a bundle contents (via contextual menu on the Finder).

Sometimes I take an EyeTV image from the .eyetv bundle.

They do not.

Thank you Thom, I will investigate.

On Windows and Linux, there is nothing similar.
How do they achieve the same feature then ?
I wonder.

The Bundle advantage is that everyone can add a new bundle / display a bundle contents (via contextual menu on the Finder).

Sometimes I take an EyeTV image from the .eyetv bundle.

Tim:

“What a Shame” (50 years and counting…)

So, if I implement the bundle shema, the OS X version will be “far better” than the Windows one…

This do not pleased me.

What a shame indeed. As usual, there seems to be a fair amount of Mac prejudice at work here. Because a specific under the hood feature like the bundle does not exist in Windows does not mean the metaphor cannot be emulated. I find it rather harsh to say a feature cannot be achieved just because it is Windows.

What do you want to achieve, Emile ? If I understood right, double click on a folder opens both the folder content and an associated app. This is possible the way I described above without bundle. If you want, I can create a small Windows project to demonstrate.

S’il est besoin d’expliquer plus en dtails, je suis ta disposition en canal Franais :slight_smile:

Emile, I just did a quick research on Windows. Seems you do not even need a Xojo program to do what you want :

  • Create a batch file , for instance test.bat :

explorer c:\\Users\\Michel\\Desktop\\myfolder notepad.exe

What this batch does it to open both the folder myfolder, and launch Notepad. Replace by any folder and any program of your choice.

  • Right click test.bat and select “Create shortcut”
    This creates a shortcut to the batch file.
  • Change the name of the shortcut to whatever you want ; for instance ‘myfolder’ without the .bat
  • Right click the test.bat shortcut, select Properties
  • In the ‘Shortcut’ tab, click ‘Change icon’
  • Select a folder icon

Now you got an icon of a folder shortcut called ‘myfolder’ which opens both myfolder, and the Notepad program. By modifying the bat file, you can open as many folders and as many programs as you want.

The myfolder directory can be placed in the application support, document or elsewhere.

The very same principle can be applied to a Xojo program with an icon of a folder, which would folder.launch each item.

There. No need for a Mac bundle. This is Windows and it works perfectly :confused:

Michel: merci.

All I want is to have a way to “hide” the contents of a folder (I will put data into it that will be displayedby my aplication) and when I click in that folder, he will be opened by my application and that application will display data by itself.

Data are today inside a master folder full of folders. Imagine you have the xDev books and want to put all covers and table of contents inside a master folder: you will create as many folder as needed (on for each xDev issue), place specific issue data in that folder, add some service data files in the master data and you’re done.

A typical user do not care on how things are done underway: all (s)he needs is a way to read the data.
A master folder creator will use the full version of the application (not the reader) or create the master folder and populates it by itself (using ctrl-click --> Display contents).

I will read the suggestions later today; now it is my time to eat something before my stomach will cry… loud ! ;-:slight_smile:

[quote=105020:@Emile Schwarz]Michel: merci.

All I want is to have a way to “hide” the contents of a folder (I will put data into it that will be displayedby my aplication) and when I click in that folder, he will be opened by my application and that application will display data by itself.

Data are today inside a master folder full of folders. Imagine you have the xDev books and want to put all covers and table of contents inside a master folder: you will create as many folder as needed (on for each xDev issue), place specific issue data in that folder, add some service data files in the master data and you’re done.

A typical user do not care on how things are done underway: all (s)he needs is a way to read the data.
A master folder creator will use the full version of the application (not the reader) or create the master folder and populates it by itself (using ctrl-click --> Display contents).

I will read the suggestions later today; now it is my time to eat something before my stomach will cry… loud ! ;-:)[/quote]

Let me see if I understand what you want to do ;

  • User double clicks on a folder icon
  • Instead of opening the folder itself, it opens your app which displays only the content you want to show

This can be done by simply giving your app a folder icon ; when user opens that “folder”, your app is launched and it presents the content in a window as you describe.

On Windows use a shortcut instead of the app itself because the app needs its lib folder next to it to work.

If I understood right, looks simple enough.

It is also really, really, really bad user interface design.

When I click on a folder I expect a folder to open.

Giving an app a folder icon is what malware does and is not to be recommended.

Emile, why don’t you simply use a database for your data and give it a filetype that you associate with your app? A database does not have to be called db.sqlite but could be called butterflies.wonderfile … as long as your app knows what it is and how to open it nobody cares about the extension.

[quote=105025:@Markus Winter]It is also really, really, really bad user interface design.

When I click on a folder I expect a folder to open.

Giving an app a folder icon is what malware does and is not to be recommended.

Emile, why don’t you simply use a database for your data and give it a filetype that you associate with your app? A database does not have to be called db.sqlite but could be called butterflies.wonderfile … as long as your app knows what it is and how to open it nobody cares about the extension.[/quote]

Tsk tsk. Dogmatic again :confused:

What do you think DropBox does ? What is at heart the Google drive folder ?

There is a HUGE difference between malware, and applying the desk metaphor through what LEGITIMATE applications allow.

If Emile application displays a window that presents the interface of a folder and behaves like a folder, there will be no break in the desk metaphor.

Sigh. It is so difficult to think out of the box ?

Michael, no that is not what Emile is looking for. The initial description was poor.

On the Mac, a bundle is a folder which the system treats as a single file. All applications are bundles, and some document types are. To the user, they are nearly indistinguishable from true files. Bring them to Windows though, and they appears as just folders.

To emulate the behavior on Windows would require an Explorer plugin. Not sure that would affect the open dialog though. For a most applications, such a plugin is impractical.

[quote=105051:@Thom McGrath]Michael, no that is not what Emile is looking for. The initial description was poor.

On the Mac, a bundle is a folder which the system treats as a single file. All applications are bundles, and some document types are. To the user, they are nearly indistinguishable from true files. Bring them to Windows though, and they appears as just folders.

To emulate the behavior on Windows would require an Explorer plugin. Not sure that would affect the open dialog though. For a most applications, such a plugin is impractical.[/quote]

I know what bundles are, Thom, thank you. I also know they do not exist on Windows.

Here is the initial question, which to me can be synthesized as ‘when user clicks on the “folder” (with quotes), his application is run which opens the said “folder” (with quotes)’.

[quote=104560:@Emile Schwarz]I need to associate a bunch of folders (one at a time) to an application, so when I click in that “folder”, my application is run and open that said “folder”.

This have to run on OS X and Windows platforms. [/quote]

All I said is that bundles are not necessary to do what Emile wanted to do, under Windows.

His latest explications seem to indicate he does not want to open the actual folder at all, but rather to present through his app an open folder looking interface with fewer elements. It probably requires some additional informations to go from there.