Community
    • Login

    How to schedule a python scripts in plugin manager?

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    2 Posts 2 Posters 245 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Hulu2007H
      Hulu2007
      last edited by

      Hello!
      I created a python scripts in plugin manager, to handle file encoding.
      I would like this script to be running repeatedly.

      Is there a way to achieve this?
      Any help is appreciate!

      import os;
      import sys;
      from Npp import notepad
      
      filePathSrc=r"\\mxns.loc\shares\use1-data\Global-SFTP\SFTP\Stage\s_lesters\toMXNS\in_bound" # Path to the folder with files to convert
      
      console.write(filePathSrc + "\r\n")
      
      for root, dirs, files in os.walk(filePathSrc):
      	for fn in files:
      		if fn[-4:] == '.csv' or fn[-4:] == '.inc' or fn[-4:] == '.css' or fn[-4:] == '.js' or fn[-4:] == '.htm' or fn[-5:] == '.html': # Specify file types, taking care to change the fn[number] to correspond to length of the file's extension including the .
      			notepad.open(root + "\\" + fn)
      			console.write(root + "\\" + fn + "\r\n")
      			notepad.runMenuCommand("Encoding", "Convert to ANSI")
      			notepad.save()
      			notepad.close()
      
      EkopalypseE 1 Reply Last reply Reply Quote 0
      • EkopalypseE
        Ekopalypse @Hulu2007
        last edited by Ekopalypse

        @hulu2007

        What does “repeated” mean in this case?
        Time-based, event-based, or other triggers?
        Because if you are the only one editing these files it
        might be better to run the script once and then use
        another script that ensures that files from that location
        use Ansi encoding.

        1 Reply Last reply Reply Quote 1
        • First post
          Last post
        The Community of users of the Notepad++ text editor.
        Powered by NodeBB | Contributors