Opening the user's home folder? - xul

My XULRunner application has a button named "Show Recordings". Pressing it should result in Windows Explorer opening the folder for the user. How can I achieve this?
I can't find it in the File I/O documentation, perhaps I'm looking in the wrong place.
Edit
The problem is not finding the path, but telling the system to open the folder. I can't seem to find a "openFolder" function.

You're looking for the reveal() method on nsILocalFile.

Do you mean:
%HOMEPATH%
And by that I mean, if you want a global variable to get the current user's home directory path, use %HOMEPATH%. I guess you have to set that button to this value. For a list of Windows environment variables, start at the wiki article.

Related

Focus/open folder for a file in nw.js

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

How do I open a file with a specific application rather than its default application?

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.

SWT DirectoryDialog - get last selected folder

I'm using the org.eclipse.swt.widgets.DirectoryDialog for folder selection. I'm not setting the filter path and I notice the the dialog somehow remembers the last selection. When I select a folder, and then reopen the dialog - it points to the last selected folder.
My question is - can I get this "remembered" last selected folder somehow in SWT or plain Java?
Thanks!
Dinko
No there is nothing for this.
DirectoryDialog is just a thin wrapper around the native open directory dialog. It is the native dialog that is remembering (if it does, this may vary on different platforms).
Looking at the macOS version of DirectoryDialog there is nothing in the Java code that knows about the previous selection.

how do i change default sources folder in Netbeans 7.1.2

Does anybody know how to change the default sources folder in Netbeans 7.1.2
I've looked through the files but can't seem to locate where the default directory is stored - I have been through the forums but can't find anything useful..?
currently C:\Users\wayne\Documents\NetBeansProjects\PhpProject7
I have read that if you select a different directory then that becomes the default - this is not the case on my installation
Thanks
If you are using Windows 7 or vista, you are gonna find it here C:\Users\YourUserName\AppData\Roaming\NetBeans\7.1.2\config\Preferences\org\netbeans\modules\projectui.properties.
However if you you are using windowsXP remember the USERPROFILE enviromental variable is not Users but rather Documents and Settings. Enviromental variables change depending on the operating system you are using. To know whats the USERPROFILE variable for yours just open a command prompt window and type SET USERPROFILE. Or you can simply type %USERPROFILE%\AppData\Roaming\NetBeans\$ENTER_YOUR_NETBEANS_VERSION_NUMBER_HERE\config\Preferences\org\netbeans\modules\projectui.properties and that will send you to the correct directory.
It's actually pretty simple.
"C:\Users\wayne\.netbeans\7.1.2\config\Preferences\org\netbeans\modules there is a file called projectui"
is right on the money, but he forgot one detail that you need to keep in mind for changing the directory. If you want to set the default project folder to (in my case):
"C:\Program Files\glassfish-3.1.2.2\glassfish\domains\domain1\docroot"
then you have to double the slashes. Instead of the above link you have to put:
"C:\\Program Files\\glassfish-3.1.2.2\\glassfish\\domains\\domain1\\docroot"
without spaces. I had it that way originally but it hid one of each of them.
In newer versions, right-click on the project you want to move in the 'Projects' tab, and then click 'Move'. This will allow you to move the project to a new directory.
Tip! I found (on Windows 7) that the AppData folder is hidden, so doesn't appear in windows explorer files by default .
To make it visible, open a window for the USERPROFILE directory as above, and use
Organize ->
Folder and Search Options ->
View (tab) ->
Advanced settings list ->
Hidden files and folders radio button to show them.
(Or you can open it via search or run if you type it right)
I hope that saves you the several hours it cost me...

system.diagnostic.process.start problem

Im trying to create an application launcher using vb.net. I'm trying to launch desktop shortcuts that are hidden because I want my desktop to be free of mess. Those shortcuts are created through nircmd :http://www.nirsoft.net/utils/nircmd.html
I used this code:
System.Diagnostics.Process.Start("E:\Documents and Settings\Rew\Desktop\SpeakClipboard.exe")
And it returned the error that the path specified cannot be found.
I tried launching an application in program files using this method and it worked well.
Is there a problem with shortcuts? I cannot specify the path for the file where the shortcut is linked because its a shortcut in the desktop and doesn't point to anything except the nircmd.exe that is on : F:\NIRCMD
But I also tried using this path for system.diagnostic.process.start:
F:\NIRCMD\nircmd.exe cdrom open g:
But still no luck.
If I understand correctly SpeakClipboard.exe is actually a shortcut? If so it probably has a hidden .lnk extension. So you should specify SpeakClipboard.exe.lnk or SpeakClipboard.lnk if it doesn't actually have .exe in the name.
There is a property on the ProcessStartInfo object that allows you to specify an argument.
eg your command would be "F:\NIRCMD\nircmd.exe" and the arguments would be "cdrom open g:"
Does that work?