Skip to content

Instantly share code, notes, and snippets.

@chwnam
Created September 16, 2014 00:02
Show Gist options
  • Save chwnam/10698281040acfd57cfe to your computer and use it in GitHub Desktop.
Save chwnam/10698281040acfd57cfe to your computer and use it in GitHub Desktop.
batch_opener
# -*- coding: utf-8 -*-
# copyright: K. H. Nam ([email protected]) / Licensed under GPLv3 or higher version.
import wx
import os
import sys
import os.path
reload(sys)
sys.setdefaultencoding('cp949')
def file_open(f):
myf = open("my.bat","a")
myf.write(" "+str(f))
myf.close()
class MainFrame(wx.Frame):
def __init__(self, *args, **kwds):
kwds["style"] = wx.DEFAULT_FRAME_STYLE
wx.Frame.__init__(self, *args, **kwds)
dig = wx.FileDialog(None, message="Choose data files", style=wx.FD_MULTIPLE)
if dig.ShowModal() == wx.ID_OK:
if os.path.isfile("my.bat"):
myf = open("my.bat", "a")
else:
myf = open("my.bat", "w")
myf.write("C:\\Notepad\\notepad.exe")
myf.close()
for fn in dig.GetPaths():
file_open(fn)
class conv(wx.App):
def OnInit(self):
wx.InitAllImageHandlers()
main = MainFrame(None, -1, "")
self.SetTopWindow(main)
main.Show(True)
main.Show(False)
exit()
#return 1
if __name__ == "__main__":
conv = conv(0)
conv.MainLoop()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment