Default Open Folder
-
After closing Sketchup and then re-opening, Sketchup defaults to the folder that is indicated in the System Preference, files. Would it be possible to make a button, that after saving, you click on the button, and Sketchup will save the last folder used as the System Preference, files. So when I open Sketchup the next time, and go to file open, it will now default to the new location?
Thanks in advance
Ken
-
HKEY_CURRENT_USER\Software\Google\SketchUp8\File Locations\Models
is the file path to the default 'Models' folder set in 'Preferences > Files'; it is written to the Registry.
There's no API way of reading or writing this key/value - the space in the path, and/or its data-type seems to cause issues.
You can't leave it blank either - it defaults to the user's Documents folder, even if you make the Registry entry "" by manual editing.
You could try to write a Ruby [run from a button] that would make a short 'cmd' file [which the Ruby then would run from a temp folder, which then deletes itself on completion] it would rewrite that Registry entry with the current File.dirname(model.path) ? The problem then is that as Sketchup closes it rewrites the Registry value from its memory and so the change is never used. The only way to effect is when Sketchup is closed, which rather defeats the object...
So as far as I can see you can't change this value within Sketchup itself via the API, only manually from the Preferences options... -
TIG
Thanks for the reply. Just wondering is there a way to write a Ruby that would save the last folder accessed, and when you opened Sketchup again, you click on this button and it opened up that folder, allowing you to access the files to open at this location.
I guess there would be two buttons, one to save the location, and one to access the locations.
Just a thought. Way beyond my skills.
However, thank you again for the reply.
Ken
-
not quite but....
-
Rich
Thanks for the info. The plugin you suggested almost does the trick. However, it brings the Sketchup file in as an insert, so I lose the file name. Going to dig to see if I can change how the file is opened.
Close but no cigar.
Thanks Rich for your reply. It is amazing how many plugins there are out there and hidden from view.
Ken
-
I tested this on Windows 7, and it appears to work the same as on XP.
(When the SketchUp path is set to a non-existent folder, the Windows MRU paths take over.) -
It's a clever trick.
Manually setting it to "" [by editing the registry with regedit] doesn't work as Sketchup then assumes the user's Documents folder!
You could set it to a non-existence folder that way and the existing part of the path will become the default ?
Rather than the mess of making a folder, linking to it and then deleting the folder etc, you could run afixdir.cmd
file to add a non-existent folder path?REG ADD "HKCU\Software\Google\SketchUp8\File Locations" /v "Models" /d "C;\[.]" /f pause
Of course you mustn't have a folder named "
[.]
" in that location!
It will then set "C:
" as the default location when the folder is not found, but it will use the last used folder during that session otherwise.
So if you'd prefer your desktop as the default folder try"C:\Users\YourID\Desktop\[.]"
etc... -
This was written in 2012 for SketchUp v8 when Windows 7 was current. Please do not PM me in 2019 and tell me it does not work for current SketchUp versions. Things change as OSes and applications are revised.
The trick is to let MS Windows MRU filetypes handle what folder will be opened to select a file (of the extension asked for.)
So you'll have to make your own toolbar button (or assign a hotkey to,) the following command:
Sketchup.open_file UI.openpanel('*.skp')
Windows itself will search it's own MRU list that it maintains (no matter what application is or was in use,) when that filetype was last saved. (MRU is an acronym for Most Recently Used.) If Windows has not yet logged a particular filetype, it's likely it will open either in "My Documents" or in the "Desktop" folder. Once a non-cancelled save has occured, an attribute with a path value, will be written into Windows MRU key.
Subsequent calls using the MS Common Filesave and Fileopen dialogs, (which
UI.openpanel
andUI.savepanel
uses,) with just the filetype, will use the paths stored in the MRU key attributes.
This was written in 2012 for SketchUp v8 when Windows 7 was current. Please do not PM me in 2019 and tell me it does not work for current SketchUp versions. Things change as OSes and applications are revised.
-
This was written in 2012 for SketchUp v8 when Windows 7 was current. Please do not PM me in 2019 and tell me it does not work for current SketchUp versions. Things change as OSes and applications are revised.
Hold up a min! I Found a workaround to force SketchUp to use Windows MRU paths...
...[ drumroll ]...
1) Open a File Explorer and create a "dummy" folder "C:/dummy"
2) Open SketchUp.. goto "Preferences" > "Files" panel.
Click the browse Folder button and choose this empty folder.
Your Models path should say: "**C:\dummy**"3) Close SketchUp.
4) Delete the "C:\dummy" folder.
5) Restart SketchUp. It will now use MS Windows saved MRU paths for "*.skp" filetype.
.. No custom button or menuitem needed.
This was written in 2012 for SketchUp v8 when Windows 7 was current. Please do not PM me in 2019 and tell me it does not work for current SketchUp versions. Things change as OSes and applications are revised.
Advertisement