lol, I tried a number of different syntaxes, but nothing like that!

So now I've got:

tag_name = "vlc"
tag_program = """\"C:\Program Files\VideoLAN\VLC\vlc.exe\""""

Unfortunately though I still get the same problem. Command prompt pops
up and vanishes and nothing happens...

Can anyone else get it to work?

On Nov 18, 5:56 pm, Peter Bienstman <[email protected]> wrote:
> Have a look at this file for information on how to correctly specify the paths
> under windows:
>
> ##############################################################################
> #
> # custom_tag.py <[email protected]>
> #
> ##############################################################################
>
> import os
> from mnemosyne.core import *
>
> tag_name = "my_tag"
> tag_program = "/bin/cat"
>
> #tag_name = "video"
> #tag_program = """\"C:\Program Files\Windows Media Player\wmplayer.exe\""""
> #tag_program = """\"C:\Program Files\QuickTime\QuicktimePlayer.exe\""""
>
> ##############################################################################
> #
> # Plugin to intercept a custom tag of the form <my_tag src="filename"> in
> # the question and answer text, and open its content in a separate program.
> #
> # This plugin will run several times when a card is displayed, so we need to
> # make sure that we run the program only once per card.
> #
> ##############################################################################
>
> class CustomTag(Plugin):
>
>     def __init__(self):
>         Plugin.__init__(self)
>         self.last_filename = None
>
>     def description(self):
>         return "Intercept a custom tag."
>
>     def load(self):
>         register_function_hook("filter_q", self.custom_tag)
>         register_function_hook("filter_a", self.custom_tag)
>
>     def unload(self):
>         unregister_function_hook("filter_q", self.custom_tag)
>         unregister_function_hook("filter_a", self.custom_tag)
>
>     def custom_tag(self, text, card):
>
>         i = text.lower().find(tag_name + " src")
>
>         while i != -1:
>
>             start = text.find("\"", i)
>             end   = text.find("\"", start+1)
>
>             if end == -1:
>                 return text
>
>             filename = text[start+1:end]
>
>             if filename == self.last_filename:
>                 return text
>
>             try:
>                 os.system(tag_program + " " + filename)
>             except:
>                 print "Unable to open", filename
>
>             self.last_filename = filename
>
>             i = text.lower().find(tag_name + " src", i+1)
>
>         return text
>
> p = CustomTag()
> p.load()
>
> ------------------------------------------------
>
> > On Wed, Nov 18, 2009 at 4:45 PM, gholland <[email protected]> wrote:
> >  In order to keep it open try running Mnemosyne
>
> > > from the command line. To do so, open up a command prompt (Start ->
> > > Run -> type 'cmd') then navigate to the folder which contains the
> > > Mnemosyne executable.
>
> > I tried doing this and got no output.  I added print statements to the
> > plug in to
> > trace the execution but again to output.  It appears that the plug in
> > is never called but something is going wrong when Mnemosyne
> > tries to process the content of the answer card.
>
> > Charles
>
> > --
>
> > You received this message because you are subscribed to the Google Groups
> >  "mnemosyne-proj-users" group. To post to this group, send email to
> >  [email protected]. To unsubscribe from this group,
> >  send email to [email protected]. For more
> >  options, visit this group at
> >  http://groups.google.com/group/mnemosyne-proj-users?hl=.
>
> ------------------------------------------------
> Peter Bienstman
> Ghent University, Dept. of Information Technology
> Sint-Pietersnieuwstraat 41, B-9000 Gent, Belgium
> tel: +32 9 264 34 46, fax: +32 9 264 35 93
> WWW:http://photonics.intec.UGent.be
> email: [email protected]
> ------------------------------------------------

--

You received this message because you are subscribed to the Google Groups 
"mnemosyne-proj-users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/mnemosyne-proj-users?hl=.


Reply via email to