Ok I tried this on my Xp box with 2.43. :
The “os.system” call for some reason has a ~30-45 second delay before Adobe Acrobat actually gets launched, while the webbrowser and os.startfile calls both work pretty much instantly, so (on my system anyway), “os.system” doesn’t seem to be useable.
When I run the system method from a command line though using the python interpreter there is no delay. Weird. :eek:
#!BPY
"""
Name: 'QuickStart PDF (web/system/startfile)'
Blender: 243
Group: 'Help'
Tooltip: 'Blender quickstart'
"""
__author__ = ""
__url__ = ("blender", "blenderartists")
__version__ = "1.0"
__bpydoc__ = """\
This script opens the quickstart file.
"""
#### the 'stuff' ###########
import Blender,os,webbrowser
from os import *
from webbrowser import *
##
## this 'pdfDir' thing works with windows "X:\Blender\ ..... probably won't with other OS's
##
###
homedir = Blender.Get('homedir')
pdfDir = homedir[:11]
pdf = pdfDir + "BlenderQuickStart.pdf"
###
###################3
#
# only 1 of the next 3 calls is neccesary. All 3 are here for testing purposes, comment out the one you don't want.
#
########## launch with system call ##################
#print 'BlenderQuickStart (system) PDF launch : attempting to launch Quickstart pdf from "'+pdf+'"'
##### the launch command #####
# os.system(pdf)
###########
##########################################
##### launch with 'webbrowser' call ###############
print 'BlenderQuickStart (webbrowser) PDF launch : attempting to launch Quickstart pdf from "'+pdf+'"'
##### the launch command #####
pdf = "file://" + pdfDir + "BlenderQuickStart.pdf"
webbrowser.open(pdf)
#####
##########################################
##### launch with 'startfile' call ###############
#print 'BlenderQuickStart (openfile) PDF launch : attempting to launch Quickstart pdf from "'+pdf+'"'
##### the launch command #####
# os.startfile(pdf)
####
Cool… is that group behavior actually documented anywhere ?
I might start adding my own “non-help” often used scripts to the Help menu
Actually it should be pretty easy (???) to just add a “User” Menu beside the help menu that utilizes the same “group hook” shouldn’t it?
While I was thinking of that, I had another “brilliant” brainstorm and just split my User Preferences vertically and put the Scripts window on the far left corner and shrunk the window down (moved the split over) so just the “Scripts” label/button is visible. It does cutoff the La:0 and Mem fields (what does La:0 mean ??? anyway). I think that would make a good default layout
EDIT* Not so briliant for scripts that use a Gui … The window needs to be maximized in order to see the gui
As I mentioned above, the webbrowser does open the pdf file (by launching the “system PDF” app (Abobe acrobat) on my (XP) system.
I also tried a test to launch a web page, that works too. I guess if that JPG were embedded in a web page, then it would be one less application (on Windows at least) being launched.
If you do a “chmod + x BlenderQuickStart.pdf” on Linux, and then trying to “launch” the pdf by just typing it’s name, does that work? If so, then after chmod’ing it, maybe the os.startfile(<filename>) or webbrowser.open(<filename>) variations will then work on the file.
I wonder if that’s even necessary on current Linux systems. I haven’t run Linux for a couple of years, so I don’t know how / if it uses “file associations”.
Mike