Community

    • Login
    • Search
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search

    How to schedule a python scripts in plugin manager?

    Help wanted · · · – – – · · ·
    2
    2
    91
    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.
    • Hulu2007
      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()
      
      Ekopalypse 1 Reply Last reply Reply Quote 0
      • Ekopalypse
        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
        Copyright © 2014 NodeBB Forums | Contributors