opening a file inside a program

Does anybody know how to open a file with a program that you opened with Python, say Word?

thanks

Comments

  • : Does anybody know how to open a file with a program that you opened with Python, say Word?

    I don't understand the question. Are you saying you used Python to start MSWord, and you want the Python code to make MSWord open a particular file?


    [size=5][italic][blue][RED]i[/RED]nfidel[/blue][/italic][/size]

    [code]
    $ select * from users where clue > 0
    no rows returned
    [/code]

  • : : Does anybody know how to open a file with a program that you opened with Python, say Word?
    :
    : I don't understand the question. Are you saying you used Python to start MSWord, and you want the Python code to make MSWord open a particular file?
    :
    :
    : [size=5][italic][blue][RED]i[/RED]nfidel[/blue][/italic][/size]
    :
    : [code]
    : $ select * from users where clue > 0
    : no rows returned
    : [/code]
    :
    :

    yes, that is what I was asking, sorry for the badly worded message.
  • : : : Does anybody know how to open a file with a program that you opened with Python, say Word?
    : :
    : : I don't understand the question. Are you saying you used Python to start MSWord, and you want the Python code to make MSWord open a particular file?
    : :
    : :
    : : [size=5][italic][blue][RED]i[/RED]nfidel[/blue][/italic][/size]
    : :
    : : [code]
    : : $ select * from users where clue > 0
    : : no rows returned
    : : [/code]
    : :
    : :
    :
    : yes, that is what I was asking, sorry for the badly worded message.
    :

    Most programs, if you call it from the cmdline, its first argument is a file to open. I forgot Python's equivalent of the system() call in C, but you can use that to call msword then concat the filename you want to open.

    Search the docs for the sys package, the function u need should be there.
    {2}rIng
  • : : : Does anybody know how to open a file with a program that you opened with Python, say Word?
    : :
    : : I don't understand the question. Are you saying you used Python to start MSWord, and you want the Python code to make MSWord open a particular file?
    :
    : yes, that is what I was asking, sorry for the badly worded message.

    Ok, how did you open MSWord? Using the automation library ("Word.Application" or something like that) via the win32com python module?


    [size=5][italic][blue][RED]i[/RED]nfidel[/blue][/italic][/size]

    [code]
    $ select * from users where clue > 0
    no rows returned
    [/code]

  • : : : : Does anybody know how to open a file with a program that you opened with Python, say Word?
    : : :
    : : : I don't understand the question. Are you saying you used Python to start MSWord, and you want the Python code to make MSWord open a particular file?
    : :
    : : yes, that is what I was asking, sorry for the badly worded message.
    :
    : Ok, how did you open MSWord? Using the automation library ("Word.Application" or something like that) via the win32com python module?
    :
    :
    : [size=5][italic][blue][RED]i[/RED]nfidel[/blue][/italic][/size]
    :
    : [code]
    : $ select * from users where clue > 0
    : no rows returned
    : [/code]
    :
    :
    Yes, I opened Word with win32com
  • [b][red]This message was edited by Moderator at 2006-6-30 10:13:10[/red][/b][hr]
    : Yes, I opened Word with win32com

    Ok, then you'll need to look up the Word API somewhere, probably on MSDN I would guess. There's probably a .Open method on the application object or something like that.

    You can just call the Word methods on your python object, something like:

    [code]
    w = Dispatch("Word.Application")
    d = w.Open("C:TEMPResume.doc")
    [/code]

    The win32com stuff is pretty magical.

    [size=5][italic][blue][RED]i[/RED]nfidel[/blue][/italic][/size]

    [code]
    $ select * from users where clue > 0
    no rows returned
    [/code]



  • : [b][red]This message was edited by Moderator at 2006-6-30 10:13:10[/red][/b][hr]
    : : Yes, I opened Word with win32com
    :
    : Ok, then you'll need to look up the Word API somewhere, probably on MSDN I would guess. There's probably a .Open method on the application object or something like that.
    :
    : You can just call the Word methods on your python object, something like:
    :
    : [code]
    : w = Dispatch("Word.Application")
    : d = w.Open("C:TEMPResume.doc")
    : [/code]
    :
    : The win32com stuff is pretty magical.
    :
    : [size=5][italic][blue][RED]i[/RED]nfidel[/blue][/italic][/size]
    :
    : [code]
    : $ select * from users where clue > 0
    : no rows returned
    : [/code]
    :
    :
    :
    :
    Thanks for all the help, I've got it figured out now
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories