SHBrowseForFolder text edit - windows-shell

I have some questions regarding SHBrowseForFolder(). I am using it with BIF_USENEWUI, BIF_RETURNONLYFSDIRS and BIF_VALIDATE. I am mainly having problems with the edit box. I'd like it to function a bit differently.
Let us assume, I am at a valid directory "C:\path". If I type in a non-existing folder (Let us call it "Folder1") into the textbox and then press OK, then the path I receive is "C:\path". Is there a way to have it so that when I press OK, it creates "Folder1" in "C:\path" and gives me the path "C:\path\Folder1"? (Without having to use the Make New Folder button)
Currently, I can click on "Make New Folder", which creates a new folder that I can rename. In the text edit, it appears as New Folder (its default name). After I rename the folder, it still appears as New Folder in the text edit, unless I click on another folder and then click back on the newly named folder. Is there a way for the text edit to be updated as soon as I rename the folder?

1 install an application-defined callback function and specify the BIF_VALIDATE flag, then handle BFFM_VALIDATEFAILED and try to create the folder there.
2 you can subclass the dialog and the text edit in BFFM_INITIALIZED and look for TVN_BEGINLABELEDIT and TVN_ENDLABELEDIT from the tree control, then change the text in the edit control based on the change to tree node text when the user finishes editing. The dialog id for controls on the browse folder dialog is not documented, so there is a compatibility risk you need to consider. I won't be surprised if your code breaks after a Windows update/upgrade, but as a user, this is not a feature I would miss anyway.

Related

Automatic sorting of new folders Windows

I know about setting sorting for parent folders and stuff.
But when creating a new folder in Windows, sorting is by name. Is it possible to change some value in the registry or create some script for the action of creating a folder - so that sorting by date is automatically set.
That is, I would like it to be without any additional actions, well, there must be system settings somewhere in Windows? Even setting for all folders in the system of such a value will do.
Thanks.
1.Open file explorer
2.Open any folder, then select View from the top menu
3.Click on Date modified to sort by most recent
4.Select Options from the far right top menu then choose Change folder and search options
5.Select View tab, Apply to all folders
6.Create a test folder and refresh to see if it gets sorted by date
You can also refer to this answer
https://superuser.com/questions/49591/how-do-i-change-the-default-sort-order-on-windows-explorer-and-the-file-dialogs

How to edit file name in file inspector?

There are multiple discussions on how to programmatically edit a file name in the file inspector. However, if I simply want to manually change the name of this file in the file navigator.
I have tried clicking on it, then waiting, then clicking again. That seems to work sometimes, but with this xib file I can't seem to get it to work.
This seems to happen intermittently, so I can't provide repeatable steps. I'm looking for an alternative to clicking, waiting, then clicking again guaranteed way to rename a file in the Toolbar/File Navigator.
Like in Finder.app:
Select the file, tap Enter.
Or using the File Inspector (right panel):
Select the file, View/Inspector/File, change the name there.
Like here

How can I add a new folder in Sublime Text?

I'm in Sublime working on a project that I need to add a folder in; when I right click to try "Add Folder.." I type in name, press enter and nothing happens. It will still allow me to add a file no problem, but that's not what I need just yet.
You can add files and folders on the sidebar in Sublime Text. First, go to Project -> Add Folder to Project and select whatever your parent folder is. That'll put your parent folder in the sidebar. Then you can right click on any of the folders in the sidebar to create child files and folders.
I was having the same problems, not being able to create folders in the sidebar. Luckily, this method worked for me:
I typed in the name field the full path of one random file:
foldername-1/foldername/filename.php
The folders got created automatically.
I thought I had the same issue, but I've realised that when you click on create New Folder, appears a bar at the bottom asking you for the Folder Name. Once you give it a name, the folder will be added.
I may have the same problem with you.
When I press Enter, it actually gives me a newline.
I can't apply the rename/add folder action through sidebar.
This github issue may be related.

Standard way to rename xcode project

After I create a project name for example Proj11, I'd like to change the name to Proj12.
So I use Project->Rename, then the name of the project to Proj12
But the project still contains several folders name Prlj11, and after I change the folders' name, the project can't been loaded.
So what is the standard way to rename my project as well as folder name.
Click on the project folder (blue folder with your app name on the top of the project navigator). Pull up the utilities (right pane), then file inspector. Your project name is there, change it to whatever you want. Then it will ask to save, keep all the files it selected for you selected, then press rename
The best answer I found was on the apple developer site. Imagine that? You can follow the link below, but essentially it is:
1) click on the target in xcode, on the right in "Identify and Type" under name change the name and press the ENTER button on your keyboard.
2)a window will appear confirming the change and what it will change. Once you confirm it will make the changes.
https://developer.apple.com/library/ios/qa/qa1625/_index.html
OR ANOTHER WAY AND EVEN EASIER:
left-click on the name project and rename. As soon as you rename it will ask you if you want to rename:
The folders you see in XCode navigators are not an actual folder/directories, these are virtual folders only to group your files.
And the folders you see in Finder, the path you manually set for the project, you need to rename them manually.

Changing the name of a Finder context menu item based on current selection using Applescript

When programming I find it convenient to use Finder to explore directories. In the past I would often find myself wanting an easy way to copy the complete path of the selected file or files to the pasteboard (clipboard) which is (as of OSX v10.8.2) a facility that Finder lacks. So being a programmer, I added the desired functionality by adding an Automator Workflow that launches a simple Applescript to the file context menu that appears when a selected file is right-clicked in Finder.
The script works great! It adds the desired functionality and is convenient to use. However, there is a piece of behavior that I'd like to add to the script that I haven't yet been able to figure out how to do. The name of the Finder context menu item that launches the Workflow is "Copy Filename" which is fine when there is only one file selected but when multiple files are selected I'd like the name menu item to change to "Copy Filenames" or perhaps "Copy "+(The # of selected files)+" Filenames".
So my question is this: How do I, using Applescript, dynamically set the name of an item in the file context menu that appears when a selected file is right-clicked in Finder based on the number of selected files?
There is some precedent for this type of behavior. It can be seen when copying selected files in Finder. If only one file is selected the copy menu item in the context menu will read, Copy "somefile.txt" but if five files are selected the copy menu item will read, Copy 5 Items.
You can’t. Well, you could, but it’s really gross and probably not worth the effort. The name shown in the menu is stored in an Info.plist file inside the workflow, so in theory you could write a monitor script that watches the Finder selection and twiddles that file appropriately, and then calls the magic function NSUpdateDynamicServices(), for which you’ll need AppleScriptObjC. (Or you could kill and relaunch Finder, but doing that every time you change the Finder selection would be, shall we say, impractical.)
An interesting enhancement request would be a way to name Service workflows such that the name reflects the selection, so you name your workflow, say, “Copy Path from %”, and the system would substitute “foo.txt” or “5 items” or what have you automatically.
It’s also worth noting that Finder actually does deal in full paths to some extent. Try dragging files into a plain text document -- you’ll get the paths. Or try copying and pasting into Terminal, which knows about the “furl” flavor on the pasteboard.

Resources