To be honest and straight, i’m looking for someone who can help me to finish my plugin.
So what i planed to do, is:
- create a new file with a random name
- send some text into the new file
- if i close the file (on_close(view) ?) delete the file from the drive
UPDATE:
I managed to do 1) and 3). Anyone can help me out with 2) ?
import sublime, sublime_plugin, random, os, re
class TempfileCommand(sublime_plugin.WindowCommand):
def run(self):
rand = random.randrange(1,1000000)
path = "N:/ahk work/" + str(rand) + ".ahk"
v = self.window.open_file(path)
class TempfileEvent(sublime_plugin.EventListener):
def on_close(self, view):
fullpath = view.file_name()
match = re.match('.+\\d+.ahk$', fullpath)
if match:
os.remove(fullpath)