It is currently Tue May 21, 2013 10:47 pm


Latest GIMP Scripts & Plug-ins

All times are UTC - 5 hours [ DST ]




Post new topic Reply to topic  [ 12 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: Open the book help (in pdf format) from Gimp menu
PostPosted: Sun Feb 26, 2012 5:39 am  (#1) 
Offline
GimpChat Member

Joined: Jan 13, 2011
Posts: 521
Location: Poland
GIMP Version: 2.6.11
Operating System: Windows
OS Version: XP - SP3
GIMP Experience: Beginner Level



There are a lot of guidance in pdf format for Gimp.
Only for convenience call (open pdf in another program)

For example: G'MIC The Handbook
http://gmic.sourceforge.net/gmic_reference.pdf

Place gmic_handbook.bat and gmic_handbook.pdf in the catalog C:\Gmic - or edit the path in Gmic_handbook.py and gmic_handbook.bat and Adobe Reader.

gmic_handbook.bat

Code:
@echo off
echo *** Do Not Close this Window ***
echo Temp File: %1
start "c:\\Program Files\\Adobe\\Reader 10.0\\Reader\\AcroRd32.exe" "c:\\Gmic\\gmic_handbook.pdf" %1


Gmic_handbook.py

Code:
#!/usr/bin/env python
# -*- coding: utf-8 -*-


from gimpfu import *
import shlex
import subprocess
import os, sys

def plugin_main(img, drawable):
  command = "\"C:\\Gmic\\gmic_handbook.bat\""  #<<--EDIT
  args = shlex.split(command)
  child = subprocess.Popen(args, shell=True)

register(
        "python_fu_gmic_handbook",
        "gmic_handbook",
        "gmic_handbook",
        "GimpChat",
        "MrQ",
        "2012",
        "<Image>/Help/G'MIC: The Handbook",
        "*",
        [],
        [],
        plugin_main,
        )

main()


Attachments:
Gimp help pdf.zip [838 Bytes]
Downloaded 20 times
Location.png
Location.png [ 2.01 KiB | Viewed 719 times ]
In menu.png
In menu.png [ 13.22 KiB | Viewed 719 times ]
Share on Facebook Share on Twitter Share on Orkut Share on Digg Share on MySpace Share on Delicious Share on Technorati
Top
 Profile  
 

 Post subject: Re: Open the book help (in pdf format) from Gimp menu
PostPosted: Sun Feb 26, 2012 7:15 am  (#2) 
Offline
Global Moderator
User avatar

Joined: Nov 16, 2011
Posts: 1704
Location: Metro Vancouver, BC
It works fine, just needed to change gmic_handbook.pdf to gmic_reference.pdf in the .bat file. Oh and open a file in Gimp first.

One more thing, I use Evince for PDFs even though I left the path to Adobe Reader, Evince opened no problem (Vista).

_________________
Image
Gimp 2.8.4, Vista 32, Ubuntu 12x, median user
Gimp Chat Tutorials Index


Top
 Profile  
 
 Post subject: Re: Open the book help (in pdf format) from Gimp menu
PostPosted: Sun Feb 26, 2012 2:48 pm  (#3) 
Offline
GimpChat Member
User avatar

Joined: Jul 14, 2010
Posts: 500
Odinbc wrote:
It works fine, just needed to change gmic_handbook.pdf to gmic_reference.pdf in the .bat file. Oh and open a file in Gimp first.

One more thing, I use Evince for PDFs even though I left the path to Adobe Reader, Evince opened no problem (Vista).



If you replace the "*" in the register with "" then it will work with no image open.

(that parameter is the image type, "*" means any image type, but an image is required)

-Rob A>

_________________
Image
Fantasy Cartography and Mapping by RobA


Top
 Profile  
 
 Post subject: Re: Open the book help (in pdf format) from Gimp menu
PostPosted: Sun Feb 26, 2012 3:15 pm  (#4) 
Offline
Global Moderator
User avatar

Joined: Nov 16, 2011
Posts: 1704
Location: Metro Vancouver, BC
Thanks Rob,
You learn something new everyday.
So I had already changed gmic_handbook.bat to,
Code:
@echo off
echo *** Do Not Close this Window ***
echo Temp File: %1
start "c:\\Program Files\\Adobe\\Reader 10.0\\Reader\\AcroRd32.exe" "c:\\Gmic\\gmic_reference.pdf" %1


And now Gmic_handbook.py to,
Code:
#!/usr/bin/env python
# -*- coding: utf-8 -*-


from gimpfu import *
import shlex
import subprocess
import os, sys

def plugin_main(img, drawable):
  command = "\"C:\\Gmic\\gmic_handbook.bat\""  #<<--EDIT
  args = shlex.split(command)
  child = subprocess.Popen(args, shell=True)

register(
        "python_fu_gmic_handbook",
        "gmic_handbook",
        "gmic_handbook",
        "GimpChat",
        "MrQ",
        "2012",
        "<Image>/Help/G'MIC: The Handbook",
        "",
        [],
        [],
        plugin_main,
        )

main()


Works like a charm!

_________________
Image
Gimp 2.8.4, Vista 32, Ubuntu 12x, median user
Gimp Chat Tutorials Index


Top
 Profile  
 
 Post subject: Re: Open the book help (in pdf format) from Gimp menu
PostPosted: Sun Feb 26, 2012 7:24 pm  (#5) 
Offline
GimpChat Member

Joined: Apr 12, 2010
Posts: 4957
but why use a script to open a pdf ?
file/open would not work ?

_________________
My 3D Gallery on Deviantart http://photocomix2.deviantart.com/
Main gallery http://www.flickriver.com/photos/photocomix-mandala/
Mandala and simmetry http://www.flickriver.com/photos/photocomix_mandala/

Image

Mrs Wilbress


Top
 Profile  
 
 Post subject: Re: Open the book help (in pdf format) from Gimp menu
PostPosted: Sun Feb 26, 2012 8:20 pm  (#6) 
Offline
Global Moderator
User avatar

Joined: Nov 16, 2011
Posts: 1704
Location: Metro Vancouver, BC
Quote:
but why use a script to open a pdf ?
file/open would not work ?

file/open is a script. ;)

_________________
Image
Gimp 2.8.4, Vista 32, Ubuntu 12x, median user
Gimp Chat Tutorials Index


Top
 Profile  
 
 Post subject: Re: Open the book help (in pdf format) from Gimp menu
PostPosted: Mon Feb 27, 2012 2:52 am  (#7) 
Offline
Global Moderator
User avatar

Joined: May 16, 2010
Posts: 9001
Location: "Looking for my eraser" =P
Cool idea. :)
Though i use GSView not Adobe Reader.
http://pages.cs.wisc.edu/~ghost/gsview/

_________________
Image
Gimp Rocks Blog
Simply Gimp Tutorials
"Once your in the cloud, you're in the net"
____________
OK, . . . . so what's the speed of dark?


Top
 Profile  
 

 Post subject: Re: Open the book help (in pdf format) from Gimp menu
PostPosted: Mon Feb 27, 2012 12:42 pm  (#8) 
Offline
GimpChat Member

Joined: Jan 13, 2011
Posts: 521
Location: Poland
Tutorials can be in different format *.doc,*.odt, *.htm, *.txt, and of course *.pdf.
Only for convenience - you can all these different types of documents call of the Gimp menu (by editing the file: bat and py).

For Win XP (regardless of the path "exe" in the bat file) opens the target file in combination - so the bat file can be reduced to writing:
Code:
@echo off
echo *** Do Not Close this Window ***
echo Temp File: %1
start "exe" "c:\\XYZ\\xyz.odt" %1

where xyz is the directory and file name.


Top
 Profile  
 
 Post subject: Re: Open the book help (in pdf format) from Gimp menu
PostPosted: Mon Feb 27, 2012 1:30 pm  (#9) 
Offline
GimpChat Member

Joined: Apr 12, 2010
Posts: 4957
i must try

_________________
My 3D Gallery on Deviantart http://photocomix2.deviantart.com/
Main gallery http://www.flickriver.com/photos/photocomix-mandala/
Mandala and simmetry http://www.flickriver.com/photos/photocomix_mandala/

Image

Mrs Wilbress


Top
 Profile  
 
 Post subject: Re: Open the book help (in pdf format) from Gimp menu
PostPosted: Mon Feb 27, 2012 4:40 pm  (#10) 
Offline
Global Moderator
User avatar

Joined: Nov 16, 2011
Posts: 1704
Location: Metro Vancouver, BC
This script was working fine for me yesterday. Today I see the following dialog pop-up if I don't have an image open first in Gimp.
Attachment:
gmic_handbook _error.png
gmic_handbook _error.png [ 13.35 KiB | Viewed 533 times ]

I have the code changed to Robs suggestion in "gmic_handbook.py".
Code:
register(
        "python_fu_gmic_handbook",
        "gmic_handbook",
        "gmic_handbook",
        "GimpChat",
        "MrQ",
        "2012",
        "<Image>/Help/G'MIC: The Handbook",
        "",
        [],
        [],
        plugin_main,
        )

_________________
Image
Gimp 2.8.4, Vista 32, Ubuntu 12x, median user
Gimp Chat Tutorials Index


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 12 posts ]  Go to page 1, 2  Next

All times are UTC - 5 hours [ DST ]


Who is online

Users browsing this forum: bilbo9955 and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  

* Login   * Subscribe to RSS Feed


Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group