Automatic Materials Library Installer
-
Am trying to make an installer that will install a materials library to the right location on the user's computer. Here is an example but it doesn't seem able to deal with different windows/sketchup versions.
It would need to be able to handle
- 32 bit and 64 bit configurations
- Windows XP, Vista, 7, 8 and hopefully 10
- Back to Sketchup 6
There are a number of options but many are inadequate.
- zip installer seems to have no ability to deal with different folder locations
- This may be useful but seems to have a learning curve and a price tag: http://www.advancedinstaller.com/
- This doesn't appear to have the ability to deal with different folder locations: http://www.wikihow.com/Create-a-Self-Extracting-.Exe
Does anyone have experience with this? I can't imagine it is very complicated with the right tools.
Thanks in advance
-
use ruby...
Sketchup knows where the material folder lives on all versions, and can move file using rename...john
-
Thanks John,
Can you give me any directive on where to start with this?
For user friendliness it basically needs to be a package that can be downloaded and run once and everything is complete - I'm not confident that a plugin is easily usable by elementary Sketchup users.
-
In case anyone else wants to achieve something like this:
This can kinda be done with WINRAR but you'll need to make a separate installer for each sketchup version.
- Once WinRAR is installed, select and right click the texture files you want to use.
- Click "Add To Archive"
[*[Under the "general" tab check "Create SFX archive" - this will make the file .exe - Under "Advanced" tab click SFX Options and on the general tab enter the path to the sketchup materials folder
- Click "OK"
- Under the "Files" tab change "File Paths" to "Do Not Store Paths"
- Hit "Ok"
Now your installer will place the files you originally selected in the sketchup materials folder on the user's computer but you will have to make a separate installer for each version of sketchup as the path to the materials folder changes
If you want to have separated folders within the sketchup materials folder (to organize your new library nicely on the user's computer then you will have to organize everything into folders before you add to archive at the beginning.
Super simple but makes things a lot easier for your users.
If only I could find a way to detect the latest version of SU on the user's computer and install accordingly in the appropriate folder.
-
sorry for late reply, we're on different timezones...
Your Materials should be going into the 'Users' Materials directory...
Any installer will need to check if that one exists, and create it if it doesn't...
As PC users can specify anywhere for this User directory, it would require a search for the folder Name and a check for its sub-content containing .skm files...
IMHO, installing a Plugin is a well documented procedure for all SU versions...
the plugins Ruby can be used to check for a user library...
it can create one if it doesn't already exist...
and it can move a 'self contained' folder of materials into the user directory, and then delete itself...on next restart of SU, you have the Materials and the Plugin is gone...
john
-
here's some code I tested on my mac...
module JcB module Add_Skm def self.skm_loader # current best practice puts any added content in the User space # so first we get a handle for that [is this cross platform?]... user= ENV["HOME"].dup # then we look for SU's default folder... materials_path = Sketchup.find_support_file("Materials") # and the plugins folder plugins_path = File.dirname(__FILE__) # because the rbz will instal in Plugins, so will our skm's new_mats = File.join(plugins_path, "move_mats") # check if the user has ever made a material... usr_mats = materials_path.include? user # check if Plugins are in user land... usr_plugins = plugins_path.include? user # using the true/false returns from those if usr_plugins and not usr_mats # if we have a User plugins folder. but no User materials folder, we can just change our folder name to 'move' all it's contents... File.rename(new_mats,(new_mats.sub("Plugins/move_mats", "Materials"))) # then delete this script... File.delete(__FILE__) else # if we don't have a user plugins folder or we do a user materials folder, we need to rename individual skms Dir.glob("#{new_mats}/*").each do|f| File.rename(f, f.sub("Plugins/move_mats", "Materials")) end # but that leave an empty folder, so we remove it... Dir;;rmdir(new_mats) # then delete this script... File.delete(__FILE__) end end end end # this is a hack to make it run the same on all versions I tested v8+ result = UI.messagebox("ready to load new skm's?", MB_YESNO) if result == IDYES JcB;;Add_Skm.skm_loader UI.messagebox("Skm's have been added to \n#{Sketchup.find_support_file('Materials')}") end # I'm surprised it runs when it does, but it works for me and the skms are available from the materials Browser without a restart...
and a test rbz to see if it runs on you PC...just adds one of the xtra skm folder from your example...
it could be extended to add a help menu item Add Skm Collection, or similar...
I think it's easier to modify then worrying about all the different versions of Windows and SU an installer would need.I can't even run SU v6 or v7 on any of my machines so I don't cater for them [although this may work on them]...
For this to add a set of subfolder in a parent folder, it would need a PC conditional, as that won't work on a mac...
john
Advertisement