It is currently Sun Jul 21, 2024 10:20 am


All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 23 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: Help for ShellOut.py (and relative paths )
PostPosted: Mon May 16, 2011 11:47 am  (#1) 
Offline
GimpChat Member

Joined: Apr 12, 2010
Posts: 5870
RobA told time ago that the script should accept relative paths but for me didn't worked

I may have goofed somehow but i tried long with no joy...

To clear the point here a screenshoot of my "ShellOut" folder

Attachment:
Screenshot - 16_05_2011 , 17_31_55.png
Screenshot - 16_05_2011 , 17_31_55.png [ 39.08 KiB | Viewed 3757 times ]


ShellOut.py should call xnview.exe that is in a subfolder of the same folder

Attachment:
Screenshot - 16_05_2011 , 17_31_55.png
Screenshot - 16_05_2011 , 17_31_55.png [ 39.08 KiB | Viewed 3757 times ]

PM-ShellOut.py is a different version , modified to call a font manager.

that again is in a subfolder of the same folder

the idea is that if the path are relative, i may transfer easily everything without having to edit again all paths
in the py flie

i zipped the 2 script , ShellOut give me a error ,i suppose for the path
PM_ShellOut apparently doesn't work at all ,meaning that doesn't show up in the menu

if may help i may upload the whole folder

_________________
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


Share on Facebook Share on Twitter Share on Orkut Share on Digg Share on MySpace Share on Delicious Share on Technorati
Top
 Post subject: Re: Help for ShellOut.py (and relative paths )
PostPosted: Mon May 16, 2011 9:34 pm  (#2) 
Offline
Script Coder
User avatar

Joined: Jul 14, 2010
Posts: 697
Should work.

I just tried this:
  ["MS Paint", "\"..\\..\\..\\..\\WINDOWS\\system32\\mspaint.exe\"", "bmp"],


and it worked OK. That is the path to mspaint relative to the plugin folde

Try something like "\"XnView\\xnview.exe\""

or maybe "\".\\XnView\\xnview.exe\""

-Rob A>

_________________
Image
Fantasy Cartography and Mapping by RobA


Top
 Post subject: Re: Help for ShellOut.py (and relative paths )
PostPosted: Tue May 17, 2011 10:27 am  (#3) 
Offline
GimpChat Member

Joined: Apr 12, 2010
Posts: 5870
Thank my ADSL broke when i was editing my message and went back just now, i will try again following your suggestion

_________________
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
 Post subject: Re: Help for ShellOut.py (and relative paths )
PostPosted: Wed May 18, 2011 10:51 am  (#4) 
Offline
GimpChat Member

Joined: Apr 12, 2010
Posts: 5870
i tried both , no joy :gaah
not sure if the error message may be useful

Attachment:
Screenshot - 18_05_2011 , 17_17_46.png
Screenshot - 18_05_2011 , 17_17_46.png [ 58.96 KiB | Viewed 3675 times ]


i copy here my version of the script anyway i changed only the xnview entry (and i tried only with xmview option )
and the menu location...

And the other script the version you simplified to call a font manager did not even show in the menu :bawl

I tought the best way to understand what went wrong was upload a zip with everything:
once unzipped should be sufficent to add from gimp a path from preference to the folder to make it work...or hopefully to see what went wrong


LINK http://www.megaupload.com/?d=O04UKTRZ

_________________
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
 Post subject: Re: Help for ShellOut.py (and relative paths )
PostPosted: Wed May 18, 2011 11:34 am  (#5) 
Offline
GimpChat Member
User avatar

Joined: May 16, 2010
Posts: 14715
Location: USA
I am curious about the FM_Shellout.py script.Would you mind sharing it?
I didn't know that was possible to call out another font manager through Gimp.

_________________
Image
Edmund Burke nailed it when he said, "The only thing necessary for the triumph of evil is for good men to do nothing."


Top
 Post subject: Re: Help for ShellOut.py (and relative paths )
PostPosted: Wed May 18, 2011 12:42 pm  (#6) 
Offline
GimpChat Member

Joined: Apr 12, 2010
Posts: 5870
Rod wrote:
I am curious about the FM_Shellout.py script.Would you mind sharing it?
I didn't know that was possible to call out another font manager through Gimp.


It is inside the zip,but didn't work, here may be a error of copy and paste, the script didn't even show up in the gimp menu

_________________
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
 Post subject: Re: Help for ShellOut.py (and relative paths )
PostPosted: Wed May 18, 2011 12:55 pm  (#7) 
Offline
GimpChat Member

Joined: Apr 12, 2010
Posts: 5870
Rod wrote:
I am curious about the FM_Shellout.py script.Would you mind sharing it?
I didn't know that was possible to call out another font manager through Gimp.


originally i asked to call the gimp gimp theme switcher, then i tought was handy to call a font manager

Differ from the original shell out script because no image has or data has to be send and returned back, so is more simple

i just recover the original from the message of RobA i post below (just in case the copy i included in the zip in the first message went somehow mangled

#############################

#!/usr/bin/env python

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

def plugin_main(image, drawable):
# Command line - Change to match where the theme switcher binary is located
command = "\"C:\\Program Files\\GTK2 Themes\\xxxxxxx.exe\""
args = shlex.split(command)

# Invoke external command
pdb.gimp_progress_set_text ("run XnView...")
pdb.gimp_progress_pulse()
child = subprocess.Popen(args, shell=False)
child.communicate()



register(
"python_fu_runprog",
"Run a program",
"Run a program",
"Rob Antonishen",
"Copyright 2011 Rob Antonishen",
"2011",
"<Image>/Edit/GTK Theme Switcher",
"",
[],
plugin_main,
)

main()

############################

but i cannot even see it in the menu

_________________
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
 Post subject: Re: Help for ShellOut.py (and relative paths )
PostPosted: Wed May 18, 2011 1:17 pm  (#8) 
Offline
GimpChat Member
User avatar

Joined: May 16, 2010
Posts: 14715
Location: USA
I am not sure what you are trying to do other than call the font manager and XnView through the same folder, but here is what i did.
I added the folder to C directory, and renamed it "shell_out_Font_frenzy"
And added it to Shellout like this
  # Where what gets executed is command fileame so include and flags needed in the command.
  programlist = [
  ["XNView", "\"C:\\Program Files\\XnView\\xnview.exe\""],
  ["NeoPaint", "\"C:\\Program Files\\NeoPaint\\NeoPaint.exe\""],
  ["ASCII Gen", "\"C:\\Documents and Settings\\Compaq_Owner.FAMILY-ROOM\\Desktop\\DESKTOP\\Full Programs\\ascgen2-0.9.6\\Ascgen dotNET.exe\""],
  ["Anamorphe Me", "\"C:\\Program Files\\AnamorphMe\\AnamorphMe.exe\""],
  ["Dog Waffle Pro", "\"C:\\Program Files\\Project Dogwaffle Professional\\dogwaffle.exe\""],
  ["Photo Shop CS5", "\"C:\\Documents and Settings\\Compaq_Owner.FAMILY-ROOM\\Desktop\\DESKTOP\\Full Programs\\PhotoshopPortable\\App\\PhotoshopCS5\\Photoshop.exe\""],
  ["Imagelys", "\"C:\\Program Files\\Imagelys Picture Styles 7\\ips.exe\""],
  ["MS Paint", "\"C:\\WINDOWS\\system32\\mspaint.exe\""],
  ["Deep Paint", "\"C:\\Program Files\\DeepPaint\\deeppaint.exe\""],
  ["Font Frenzy", "\"C:\\shell_out_Font_frenzy\\shell_out\\FontFrenzy\\FontFrenzy.exe\""],


It works as long as you have a layer in your document.

_________________
Image
Edmund Burke nailed it when he said, "The only thing necessary for the triumph of evil is for good men to do nothing."


Top
 Post subject: Re: Help for ShellOut.py (and relative paths )
PostPosted: Wed May 18, 2011 1:19 pm  (#9) 
Offline
GimpChat Member
User avatar

Joined: May 16, 2010
Posts: 14715
Location: USA
Oh okay i see what you are trying to do now.
Every time i try and add two different call python scripts only one will show up in the menus.Must be something in the script calling the same two values maybe?

_________________
Image
Edmund Burke nailed it when he said, "The only thing necessary for the triumph of evil is for good men to do nothing."


Top
 Post subject: Re: Help for ShellOut.py (and relative paths )
PostPosted: Wed May 18, 2011 1:42 pm  (#10) 
Offline
GimpChat Member

Joined: Apr 12, 2010
Posts: 5870
The basic thing i was trying to do is make the script working with relative path, so i may use with my portable gimp

I can't use absolute paths because the HD may be C or even D and there is no way to predict the letter of the USB drive
so i can't indicate path as in "\"C:\\Program Files\\Project Dogwaffle Professional\\dogwaffle.exe\""

But if the absolute position may change the relative path will be always the same,

If the content of the folder (see screenshot in first message ) is no changed , whatver that folder will be moved or copied the relative path,that are f for subfolder(s) of the same directory, the same folder were is the script will remain always the same
...so path as "./XnView/ xnview.exe " should work (or //XnView//xnview.exe or
".//XnView//xnview.exe") SHOULD work

BUt in practice they don't work maybe for a my dumb error , anyway i need help to find the error , if in my paths or in the script or ...
Quote:
Every time i try and add two different call python scripts only one will show up in the menus.Must be something in the script calling the same two values maybe?



ah happens to you ,too

the scripts have 2 different procedure names , and 2 different registry paths so should not conflict
anyway i cannot use neither , one because give me error with relative paths, and the other because do not even show up

_________________
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
 Post subject: Re: Help for ShellOut.py (and relative paths )
PostPosted: Thu May 19, 2011 7:22 am  (#11) 
Offline
Script Coder
User avatar

Joined: Jun 22, 2010
Posts: 1171
Location: Here and there
@PhotoComix
I can't check everything as your link to the zip is in a banned place from behind the corporate firewall :gaah

But you have a mistake in the code you've posted. You have a square-bracket pair missing from the register block. It should be:

register(
   "python_fu_runprog",
   "Run a program",
   "Run a program",
   "Rob Antonishen",
   "Copyright 2011 Rob Antonishen",
   "2011",
   "<Image>/Edit/GTK Theme Switcher",
   "",
   [],
   [],
   plugin_main,
)


You also need to be sure that the "python_fu_runprog" is unique to each register block in ALL the python plug-ins. If you have the same thing in more than one of the plug-ins then you will only see one of them in the menu (the last one that gets loaded).

Kevin


Top
 Post subject: Re: Help for ShellOut.py (and relative paths )
PostPosted: Thu May 19, 2011 8:11 am  (#12) 
Offline
GimpChat Member

Joined: Apr 12, 2010
Posts: 5870
Kevin thank, i will correct the bracket, about the name i believe "python_fu_runprog" is unique the other script is called ""python_fu_shellout", and i can't see other with conflicting names

sorry you can't get the zip there is some other place where i may upload that will be no blocked by the firewall ?

anyway from the screenshoot the architetture should be visible
Do the error message i posted refer to a wrong path or was about something else ?

and bigger problem for me which should be the correct relative path?
i still get error with both the path indicatewd by RobA in his reply

_________________
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
 Post subject: Re: Help for ShellOut.py (and relative paths )
PostPosted: Thu May 19, 2011 9:33 am  (#13) 
Offline
Script Coder
User avatar

Joined: Jun 22, 2010
Posts: 1171
Location: Here and there
PhotoComix

Don't worry about putting your zip file somewhere else, I could get to it when I am at home.

But I think I know why it's not working with relative paths. The problem with relative paths is that they are relative to the current working directory. On Linux that may be the plug-ins directory, but on Windows it's not so simple.

If I start GIMP by double-clicking the executable C:/Program Files/Gimp-2.0/bin/gimp-2.0.exe, then the working directory is C:/Program Files/Gimp-2.0/bin/ and the paths are relative to there.

If I start GIMP from a short-cut, where the Start in field is set to "%USERPROFILE%\My Documents\My Pictures", then that is my working directory and paths are relative to that directory.

You will need to find out where the current working directory is and specify the relative path from there.
To find out the current working directory I added a line to your code before " # Invoke external command":
  raise NameError(os.getcwd())

Which generates an error:
NameError: C:\Program Files\GIMP-2.0\bin


Personally I'd opt to change the ShellOut plug-in to remove the paths and do it the same way the Photivo people did - first time prompt the user where the executable is and save the answer in gimprc (see the Gimp to Photivo section of http://photivo.org/photivo/download_and_setup/gimp)


Kevin


Top
 Post subject: Re: Help for ShellOut.py (and relative paths )
PostPosted: Thu May 19, 2011 10:02 am  (#14) 
Offline
GimpChat Member

Joined: Apr 12, 2010
Posts: 5870
Quote:
But I think to know why it's not working with relative paths. The problem with relative paths is that they are relative to the current working directory.


You hit the nail in the head !!
That was my first doubt try to use relative path:
relative to WHAT ?

But then i hoped that the most simple and logic , relative 1 of the 2 extremes , in this case relative to ShellOut.py and leading to the app to call so " ./XnView/xnview.exe"
(or "/XnView/xnview.exe" or ".//XnView//xnview.exe but anyway the starting point of the path was the active script that had to use the path )

I had some doubts (as...maybe was Python.exe to execute the script so the path should start from python.exe ?) but i was hoping for the best...i mean what the sense of a relative path if is so hard to guess know , to WHAT is relative ?

I really hope to clear this point and to solve, i am stuck here from a couple a weeks

_________________
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
 Post subject: Re: Help for ShellOut.py (and relative paths )
PostPosted: Fri May 20, 2011 6:55 pm  (#15) 
Offline
GimpChat Member

Joined: Apr 12, 2010
Posts: 5870
:bump

still lost with the realative path :gaah

_________________
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
 Post subject: Re: Help for ShellOut.py (and relative paths )
PostPosted: Fri May 20, 2011 7:24 pm  (#16) 
Offline
GimpChat Member
User avatar

Joined: May 16, 2010
Posts: 14715
Location: USA
PC are you trying to run Font Frenzy so Gimp will grab the font you want in Font Frenzy and use it?
Like Dynamic Text?
I like the idea of just being able to see the fonts bigger (that's nice).A much larger preview.
Using Font Frenzy called through the original ShellOut works for better previews of the font you plan to use.
I guess i am not still sure what you are trying to do.

Themes i can understand because those are built for Gimp, and other GTK programs.(Inkscape for instance)
Did you actually get Themes to work yet?I couldn't through this script.Only themes 1.0 works for me.

Sorry i do not understand what you are trying to accomplish.

_________________
Image
Edmund Burke nailed it when he said, "The only thing necessary for the triumph of evil is for good men to do nothing."


Top
 Post subject: Re: Help for ShellOut.py (and relative paths )
PostPosted: Fri May 20, 2011 7:56 pm  (#17) 
Offline
Script Coder
User avatar

Joined: Apr 23, 2010
Posts: 1553
Location: not from Guildford after all
In GNU/Linux, any path which does not start with slash ("/") is relative. If it starts with a slash then it is absolute, more commonly referred to as "fully qualified". Note that I am referring to the expanded pathname, if your pathname starts with a variable (e.g., $HOME/.gimp-2.6) then it is the pathname that results after the value of $HOME is substituted that determines whether the path is relative or fully qualified.

For GIMP, all relative paths are relative to the working directory at the time GIMP is started. If you are starting GIMP from a desktop icon then this working directory is usually specified as a property of the icon (in Windows, I believe there is a shortcut preference called "Start program in..." or somesuch).

It is possible that the ShellOut plug-in is changing the working directory before searching for the files (but I doubt it).

_________________
Any sufficiently primitive technology is indistinguishable from a rock.


Top
 Post subject: Re: Help for ShellOut.py (and relative paths )
PostPosted: Sat May 21, 2011 2:35 am  (#18) 
Offline
Script Coder
User avatar

Joined: Jun 22, 2010
Posts: 1171
Location: Here and there
This is getting very confused, let's see if a picture can help:
Image

Are my assumptions correct? If so then the relative paths are from the GimpPortable.exe:
"App\\gimp\\lib\\gimp\\2.0\\plug-ins\\FontFrenzy\\FontFrenzy.exe"
and
"App\\gimp\\lib\\gimp\\2.0\\plug-ins\\XnView\\XnView.exe"

I will say that I can't try this as I don't have Python installed with GimpPortable (is this possible?)

I also got the zip file downloaded and FM_shellout.py has a number of mistakes:
The missing [], line from the register block.
The command
  command = "\".\FontFrenz\FontFrenzy.exe\""

should have had double backslashes (see above) and the directory name is spelt wrong: FontFrenz
I think you should have:
  command = "\"App\\gimp\\lib\\gimp\\2.0\\plug-ins\\FontFrenzy\\FontFrenzy.exe\""


Kevin


Top
 Post subject: Re: Help for ShellOut.py (and relative paths )
PostPosted: Sat May 21, 2011 2:51 am  (#19) 
Offline
Script Coder
User avatar

Joined: Apr 23, 2010
Posts: 1553
Location: not from Guildford after all
PhotoComix wrote:
I can't use absolute paths because the HD may be C or even D and there is no way to predict the letter of the USB drive
so i can't indicate path as in "\"C:\\Program Files\\Project Dogwaffle Professional\\dogwaffle.exe\""

If that is all you need, just delete the C: -- your path will be fully specified to the particular drive you are on (unless Microsoft has changed things recently).

@Paynekj, why are Xnview and Fontfrenzy in the GIMP plug-ins folder? They are not plug-ins.

_________________
Any sufficiently primitive technology is indistinguishable from a rock.


Top
 Post subject: Re: Help for ShellOut.py (and relative paths )
PostPosted: Sat May 21, 2011 3:55 am  (#20) 
Offline
Script Coder
User avatar

Joined: Jun 22, 2010
Posts: 1171
Location: Here and there
saulgoode wrote:
@Paynekj, why are Xnview and Fontfrenzy in the GIMP plug-ins folder? They are not plug-ins.


Because I've got the impression from the original post that's where PhotoComix has put them on the USB drive.

Kevin


Top
Post new topic Reply to topic  [ 23 posts ]  Go to page 1, 2  Next

All times are UTC - 5 hours [ DST ]


   Similar Topics   Replies 
No new posts Attachment(s) Extended version ShellOut.

1

No new posts Find and fill paths if closed, convert closed paths to transparent

1

No new posts Paths Tool Help

1

No new posts Attachment(s) Users' Paths

2

No new posts Juxtapose exactly duplicate paths

2



* Login  



Powered by phpBB3 © phpBB Group