experts. what I want is like this: I create a folder named RootDir, then I double click the folder in Finder , I hope I can intercept the action and trigger specific action such as mounting this RootDir to another folder named MountDir and then open MountDir, not RootDir.
How should I do it (Using objective-c)?
my platform is mountain lion (osx10.8) and I've tried using fsevent to monitor, but i don't think i can catch the action of folder open/close....
And is it the only way for me to use Finder injection to achieve this function?
any suggestions would be appreciated.
You can associate AppleScript scripts with folders. Take a look at Folder Actions Reference
A Folder Action script is executed when the folder to which it is
attached is opened or closed, moved or resized, or has items added or
removed.
Related
I'm working on an app that generates a report, giving you a "View folder" button to view the file within its folder once generated.
What is the best way in nw.js to focus explorer if that folder if open in explorer or open explorer if not?
I know I could open a new explorer window each time with something like
require('child_process').exec('start "" "c:\\MyPath"');
...but I'm not sure that's the best way. (If that's the way to go, I'm passing in a path variable like C:\MyPath and need to figure out how to escape \ as \\ etc. so that start will accept the path variable.)
Don't use child_process, use the method built-in to NW.js: https://nwjs.readthedocs.io/en/latest/References/Shell/#shellshowiteminfolderfile_path
I am trying to open files using a specified executable; just like as if you were to right mouse click on a file then scroll to "Open with"
I tried what kaymaf said and reviewed the docs, but I cannot seem to get this to work.
Dim FI As New FileInfo(GetFileNameFromListViewItem(ListViewCollection.SelectedItems(0)))
Dim GetExif As Process = System.Diagnostics.Process.Start("C:\Users\*username*\Downloads\exiftool.exe", FI.FullName)
This just ends up open the executable and rather than opening the file with the executable.
You would like to open a file with your program using the Windows context menu; and do you want to get an entry in that menu? If that is not correct, the answer can be deleted.
I found this in a German forum, and they refer to this site:
This is the translated text:
One possibility would be that you register your file extension and your program in the system to open this file extension. As soon as the system knows everything, you only need to right-click on the file(s) and in the context menu, in addition to the standard entries, another menu item for opening these files is displayed. If you select this menu item, your program will start automatically if it has not yet started, and you can read out / determine the path to this file or several files in your program and process it accordingly. How it all works is described here: ookii.org/Blog/opening_files_via_idroptarget_in_net
On this page there is also a sample for download (start text files with your own program via an additional entry in the context menu / display paths to the files). It is not a VB, but it should be translatable without any problems. Corresponding information on the page and the comments should be observed.
I'm using GTK#(Newbie) on Xamarin Studio Community version 6.3, on Windows.
Recently, I was trying to build a Total Commander application. During the construction, I used the File Chooser Widget and found some issue that I can't solve:
1- When I click on a folder in Places box, a few buttons will appear: \ <icon button with a pen and a paper> enter image description here. When I click on the Icon Button, a Location Entry will show up. However, I don't know how to use that entry like opening a folder, folder path will show up on Location entry or enter folder path, folder will open on the widget. My temporary solution is create a entry:
FileChooserWidget fcw1 = new global::Gtk.FileChooserWidget(((global::Gtk.FileChooserAction)(0)));
Entry e1 = new Entry();
e1.Text = fcw1.CurrentFolder;
I hope to find the way to capture that Location Entry and use it.
2- On the workplace I have a problem in open a file by using Double-Click Event. My code:
[GLib.ConnectBefore]
protected void OnFcw1ButtonPressEvent(object o, ButtonPressEventArgs args)
{
if (((Gdk.EventButton)args.Event).Type == Gdk.EventType.TwoButtonPress)
{
entry1.Text = fcw1.Filename;
if (File.Exists(fcw1.Filename))
Process.Start(fcw1.Filename);
}
}
3- The same problem of find The use of the Search and Recently Used that Could not start the search process
The program was not able to create a connection to the indexer daemon. Please make sure it is running.
Please help me find the solution and teach me how to find the name of all these widgets. Thank you very much!
To answer #1 there's a Action property on the FileChooser widget which will allow you to set it up for what you want it to do (Open, Create, Select Folder etc). The Location field contains the filename (that you select if browsing, or can type in if creating a new file).
On #2, default behaviour for double-clicks on FCW is to drill-through on folders and select for files. Because you've got a Glib.ConnectBefore attribute your event handler will run before the default handler. Maybe whatever problem you have in #2 is related to the handlers?
On #3 sounds like an issue on your dev machine. The FCW will allow you to search the file system so long as it can connect to the daemon so it looks like that's not running. I've not had an issue with that in Windows, Mac OSX, Ubuntu or RHEL on other machines.
I am working on Finder Sync extension to apply badges on files and folders ...
I want to refresh icon for particular file/folder in Finder application.
is there any way to refresh a finder window programmatically on mac OS Yosemite ???
Apart from creating and deleting a file...
I had this problem too. I had a .app i wanted to change the icon of.
Structure of my .app:
...noida.app/
...noida.app/Contents/
...
...noida.app/Contents/Resources
...noida.app/Contents/Resources/myicon.icns
...noida.app/Contents/MacOS
...
...noida.app/Contents/plist.Info
Now I would change the icon in the resources folder. Then I made new files in all folders. It wouldn't work. The only place that i could make a new file tha twould update the icon was in the ...noida.app/ so i made new file at ...noida.app/junk folder and then it updated.
Very interesting.
Anybody know a workaround for this problem described under:
"When you add the folder as a reference ("blue folder") it adds that folder to your bundle and not just the files in that folder. This means that when you want to reference a file in that folder, you have to reference it by doing foldername/myfile.png (because you have to dive into that folder, instead of just files in the root of the bundle).
I haven't found a way around this, so if you need to reference a file in a folder like that - be it in IB or a method like imageNamed: you need to do foldername/filename otherwise it won't be found."
It works when I create groups instead of folder references though.
Oh and I was wondering, if I add a folder with pictures in it with "Create groups for any added folders" selected, is all the structure going to be lost and everything will be on the root in my app bundle on the phone? Because if I go with the finder in my dev project, I can see that xcode copied my folder with all the pictures in it. But if it's true and no structure is kept, it means that I can't have two images with the same name in different folders in my dev project, correct? and even if all my images are in a folder "images" in my dev project, I still access them directly (foo.png not images/foo.png) in xcode, right?
EDIT
OK after adding the User paths (thanks to #Matthew Frederick) I can now see the filename of my images in the dropdown of IB and they show up on the interface! Problem is, it does not add the folder in the dropdown (I only see filename.png not images/filename.png), so when I compile, it looks for filename.png instead of "images/filename.png", so it does not work. I have to put images/filename.png manually in the IB dropdown, but then the image does not show in IB...
Interface Builder will only look for potential graphics/media in your target's header search paths, so if you want access to anything that's not loose in your project folder you'll need to add those paths.
Fortunately it's easy.
In the Project Navigator click on your project, and then in the main area click on your target.
Click the Build Settings tab and scroll down to the Search Paths section.
In the User Header Search Paths subsection double-click on the area in the Project column (3rd column over) and a small dialog will appear:
Click the + button, then type the path to your added folders, relative to the project's base folder, then click Done. The paths should be specified in the form of /yourPathName.
Poof, now IB can see the graphics inside the folder, and will present them as "folderName/imageName" in it's various dropdown menus and such.
Note: This is also true for .h and .m files and anything else inside a folder inside your project's folder: adding paths tells the compiler other places to look (hence the folders you see in my screenshot, "Human Data Classes" and "Machine Data Classes," where I keep my Core Data class files as created by mogenerator).