multiscript-windows 1.0.7__tar.gz → 1.0.8__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: multiscript-windows
3
- Version: 1.0.7
3
+ Version: 1.0.8
4
4
  Summary: A lightweight wrapper to run Batch and VBScript within Python.
5
5
  Author-email: KingTheCoder <kingjd490@gmail.com>
6
6
  License: GPL-3.0-only
@@ -124,6 +124,14 @@ Fixed unclear wording in `README.md`.
124
124
 
125
125
  Fixed examples in `README.md`.
126
126
 
127
+ ## 1.0.7
128
+
129
+ Changed homepage to https://github.com/KingTheCoder314/multiscript-windows.
130
+
131
+ ## 1.0.8
132
+
133
+ Changed `multiscript.py` to use one template for script functions.
134
+
127
135
  ## Some Extra
128
136
 
129
137
  Hey, thanks for reading all the way to the end!
@@ -108,6 +108,14 @@ Fixed unclear wording in `README.md`.
108
108
 
109
109
  Fixed examples in `README.md`.
110
110
 
111
+ ## 1.0.7
112
+
113
+ Changed homepage to https://github.com/KingTheCoder314/multiscript-windows.
114
+
115
+ ## 1.0.8
116
+
117
+ Changed `multiscript.py` to use one template for script functions.
118
+
111
119
  ## Some Extra
112
120
 
113
121
  Hey, thanks for reading all the way to the end!
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "multiscript-windows"
7
- version = "1.0.7"
7
+ version = "1.0.8"
8
8
  authors = [
9
9
  { name="KingTheCoder", email="kingjd490@gmail.com" },
10
10
  ]
@@ -2,12 +2,12 @@ import os, subprocess, uuid
2
2
 
3
3
  def gentempname(ext):
4
4
  return "tmp_" + uuid.uuid4().hex[:16] + ext
5
-
6
- def batchscript(scr, err=False, rcd=False):
7
- fname = gentempname(".bat")
5
+
6
+ def scriptexec(scr, err, rcd, ext, cmd):
7
+ fname = gentempname(ext)
8
8
  with open(fname, "w") as batfile:
9
9
  batfile.write(scr)
10
- snd = subprocess.run(["cmd.exe", "/c", fname], capture_output=True, text=True)
10
+ snd = subprocess.run(cmd + [fname], capture_output=True, text=True)
11
11
  rtn = snd.stdout
12
12
  if err:
13
13
  rtn = (rtn + "\n" + snd.stderr)
@@ -15,6 +15,9 @@ def batchscript(scr, err=False, rcd=False):
15
15
  rtn = (rtn + "\n" + str(snd.returncode))
16
16
  os.remove(fname)
17
17
  return rtn
18
+
19
+ def batchscript(scr, err=False, rcd=False):
20
+ return scriptexec(scr, err, rcd, ".bat", ["cmd.exe", "/c",])
18
21
  def commandlist():
19
22
  print(
20
23
  """
@@ -33,33 +36,13 @@ The usewscript argument controls if cscript or wscript is used to execute.
33
36
  """
34
37
  )
35
38
  def vbscript(scr, err=False, rcd=False, wsc=False):
36
- fname = gentempname(".vbs")
37
- with open(fname, "w") as vbsfile:
38
- vbsfile.write(scr)
39
39
  if wsc:
40
- snd = subprocess.run(["wscript.exe", fname], capture_output=True, text=True)
40
+ return scriptexec(scr, err, rcd, ".vbs", ["wscript.exe"])
41
41
  else:
42
- snd = subprocess.run(["cscript.exe", "//Nologo", fname], capture_output=True, text=True)
43
- rtn = snd.stdout
44
- if err:
45
- rtn = (rtn + "\n" + snd.stderr)
46
- if rcd:
47
- rtn = (rtn + "\n" + str(snd.returncode))
48
- os.remove(fname)
49
- return rtn
42
+ return scriptexec(scr, err, rcd, ".vbs", ["cscript.exe", "//Nologo"])
50
43
  def javascript(scr, err=False, rcd=False, wsc=False):
51
- fname = gentempname(".js")
52
- with open(fname, "w") as jsfile:
53
- jsfile.write(scr)
54
44
  if wsc:
55
- snd = subprocess.run(["wscript.exe", "//E:jscript", fname], capture_output=True, text=True)
45
+ return scriptexec(scr, err, rcd, ".js", ["wscript.exe", "//E:jscript"])
56
46
  else:
57
- snd = subprocess.run(["cscript.exe", "//Nologo", "//E:jscript", fname], capture_output=True, text=True)
58
- rtn = snd.stdout
59
- if err:
60
- rtn = rtn + "\n" + snd.stderr
61
- if rcd:
62
- rtn = rtn + "\n" + str(snd.returncode)
63
- os.remove(fname)
64
- return rtn
47
+ return scriptexec(scr, err, rcd, ".js", ["cscript.exe", "//Nologo", "//E:jscript"])
65
48
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: multiscript-windows
3
- Version: 1.0.7
3
+ Version: 1.0.8
4
4
  Summary: A lightweight wrapper to run Batch and VBScript within Python.
5
5
  Author-email: KingTheCoder <kingjd490@gmail.com>
6
6
  License: GPL-3.0-only
@@ -124,6 +124,14 @@ Fixed unclear wording in `README.md`.
124
124
 
125
125
  Fixed examples in `README.md`.
126
126
 
127
+ ## 1.0.7
128
+
129
+ Changed homepage to https://github.com/KingTheCoder314/multiscript-windows.
130
+
131
+ ## 1.0.8
132
+
133
+ Changed `multiscript.py` to use one template for script functions.
134
+
127
135
  ## Some Extra
128
136
 
129
137
  Hey, thanks for reading all the way to the end!