multiscript-windows 1.0.2__tar.gz → 1.0.4__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.2
3
+ Version: 1.0.4
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
@@ -29,31 +29,33 @@ Now, you have three functions exposed to you.
29
29
 
30
30
  Those three functions are `batchscript`, `vbscript` and `commandlist`.
31
31
 
32
- The function `commandlist` gives you a list of commands that you can use in multiscript.
32
+ The function `commandlist` gives you a list of functions that you can use in multiscript.
33
33
 
34
- This includes the `batchscript` and `vbscript` commands and how to use them.
34
+ This includes all other commands and how to use them.
35
35
 
36
- Run this command for more information.
36
+ Run this function for more information.
37
37
 
38
- The `batchscript` command executes batch in a string.
38
+ The `batchscript` function executes batch in a string.
39
39
 
40
40
  Example:
41
41
 
42
42
  ```
43
43
  import multiscript
44
44
 
45
- batchscript(
45
+ prn = batchscript(
46
46
  r"""
47
47
  move test.txt .\destination
48
48
  del deleteme.png
49
49
  echo Test Complete!
50
50
  """
51
51
  )
52
+
53
+ print(prn)
52
54
 
53
55
  print("And we're still in python!")
54
56
  ```
55
57
 
56
- The `vbscript` command executes visual basic in a string.
58
+ The `vbscript` function executes visual basic in a string.
57
59
 
58
60
  Example:
59
61
 
@@ -70,6 +72,24 @@ vbscript(
70
72
  print("And we can still use more python!")
71
73
  ```
72
74
 
75
+ The `javascript` function executes javascript in a string.
76
+
77
+ Example:
78
+
79
+ ```
80
+ import multiscript
81
+
82
+ print(
83
+ javascript(
84
+ """
85
+ WScript.Echo("Hello, World!")
86
+ """
87
+ )
88
+ )
89
+
90
+ print("All within python!")
91
+ ```
92
+
73
93
  ## Licensing
74
94
 
75
95
  Licensed under the GNU General Public License v3 (GPLv3).
@@ -86,7 +106,15 @@ Fixed a bug where enabling `showreturncode` for the `vbscript` function would ca
86
106
 
87
107
  ## 1.0.2
88
108
 
89
- Fixed a bug where running two of the same script at the same time would overwrite temp file A with temp file B.
109
+ Fixed a bug where running two of the same function at the same time would overwrite temp file A with temp file B.
110
+
111
+ ## 1.0.3
112
+
113
+ Added the `javascript` function.
114
+
115
+ ## 1.0.4
116
+
117
+ Fixed a bug in `__init__.py` where it would not import nor export the `javascript` function.
90
118
 
91
119
  ## Some Extra
92
120
 
@@ -13,31 +13,33 @@ Now, you have three functions exposed to you.
13
13
 
14
14
  Those three functions are `batchscript`, `vbscript` and `commandlist`.
15
15
 
16
- The function `commandlist` gives you a list of commands that you can use in multiscript.
16
+ The function `commandlist` gives you a list of functions that you can use in multiscript.
17
17
 
18
- This includes the `batchscript` and `vbscript` commands and how to use them.
18
+ This includes all other commands and how to use them.
19
19
 
20
- Run this command for more information.
20
+ Run this function for more information.
21
21
 
22
- The `batchscript` command executes batch in a string.
22
+ The `batchscript` function executes batch in a string.
23
23
 
24
24
  Example:
25
25
 
26
26
  ```
27
27
  import multiscript
28
28
 
29
- batchscript(
29
+ prn = batchscript(
30
30
  r"""
31
31
  move test.txt .\destination
32
32
  del deleteme.png
33
33
  echo Test Complete!
34
34
  """
35
35
  )
36
+
37
+ print(prn)
36
38
 
37
39
  print("And we're still in python!")
38
40
  ```
39
41
 
40
- The `vbscript` command executes visual basic in a string.
42
+ The `vbscript` function executes visual basic in a string.
41
43
 
42
44
  Example:
43
45
 
@@ -54,6 +56,24 @@ vbscript(
54
56
  print("And we can still use more python!")
55
57
  ```
56
58
 
59
+ The `javascript` function executes javascript in a string.
60
+
61
+ Example:
62
+
63
+ ```
64
+ import multiscript
65
+
66
+ print(
67
+ javascript(
68
+ """
69
+ WScript.Echo("Hello, World!")
70
+ """
71
+ )
72
+ )
73
+
74
+ print("All within python!")
75
+ ```
76
+
57
77
  ## Licensing
58
78
 
59
79
  Licensed under the GNU General Public License v3 (GPLv3).
@@ -70,7 +90,15 @@ Fixed a bug where enabling `showreturncode` for the `vbscript` function would ca
70
90
 
71
91
  ## 1.0.2
72
92
 
73
- Fixed a bug where running two of the same script at the same time would overwrite temp file A with temp file B.
93
+ Fixed a bug where running two of the same function at the same time would overwrite temp file A with temp file B.
94
+
95
+ ## 1.0.3
96
+
97
+ Added the `javascript` function.
98
+
99
+ ## 1.0.4
100
+
101
+ Fixed a bug in `__init__.py` where it would not import nor export the `javascript` function.
74
102
 
75
103
  ## Some Extra
76
104
 
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "multiscript-windows"
7
- version = "1.0.2"
7
+ version = "1.0.4"
8
8
  authors = [
9
9
  { name="KingTheCoder", email="kingjd490@gmail.com" },
10
10
  ]
@@ -0,0 +1,2 @@
1
+ from .multiscript import batchscript, commandlist, vbscript, javascript
2
+ __all__ = ["batchscript", "commandlist", "vbscript", "javascript"]
@@ -26,6 +26,10 @@ vbscript(script, showerrorcode, showreturncode, usewscript)
26
26
  Runs a visual basic script.
27
27
  If not specified, showerrorcode, showreturncode and usewscript will be set to False.
28
28
  The usewscript argument controls if cscript or wscript is used to execute.
29
+ javascript(script, showerrorcode, showreturncode, usewscript)
30
+ Runs a javascript program.
31
+ If not specified, showerrorcode, showreturncode and usewscript will be set to False.
32
+ The usewscript argument controls if cscript or wscript is used to execute.
29
33
  """
30
34
  )
31
35
  def vbscript(scr, err=False, rcd=False, wsc=False):
@@ -42,4 +46,20 @@ def vbscript(scr, err=False, rcd=False, wsc=False):
42
46
  if rcd:
43
47
  rtn = (rtn + "\n" + str(snd.returncode))
44
48
  os.remove(fname)
45
- return rtn
49
+ return rtn
50
+ 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
+ if wsc:
55
+ snd = subprocess.run(["wscript.exe", "//E:jscript", fname], capture_output=True, text=True)
56
+ 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
65
+
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: multiscript-windows
3
- Version: 1.0.2
3
+ Version: 1.0.4
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
@@ -29,31 +29,33 @@ Now, you have three functions exposed to you.
29
29
 
30
30
  Those three functions are `batchscript`, `vbscript` and `commandlist`.
31
31
 
32
- The function `commandlist` gives you a list of commands that you can use in multiscript.
32
+ The function `commandlist` gives you a list of functions that you can use in multiscript.
33
33
 
34
- This includes the `batchscript` and `vbscript` commands and how to use them.
34
+ This includes all other commands and how to use them.
35
35
 
36
- Run this command for more information.
36
+ Run this function for more information.
37
37
 
38
- The `batchscript` command executes batch in a string.
38
+ The `batchscript` function executes batch in a string.
39
39
 
40
40
  Example:
41
41
 
42
42
  ```
43
43
  import multiscript
44
44
 
45
- batchscript(
45
+ prn = batchscript(
46
46
  r"""
47
47
  move test.txt .\destination
48
48
  del deleteme.png
49
49
  echo Test Complete!
50
50
  """
51
51
  )
52
+
53
+ print(prn)
52
54
 
53
55
  print("And we're still in python!")
54
56
  ```
55
57
 
56
- The `vbscript` command executes visual basic in a string.
58
+ The `vbscript` function executes visual basic in a string.
57
59
 
58
60
  Example:
59
61
 
@@ -70,6 +72,24 @@ vbscript(
70
72
  print("And we can still use more python!")
71
73
  ```
72
74
 
75
+ The `javascript` function executes javascript in a string.
76
+
77
+ Example:
78
+
79
+ ```
80
+ import multiscript
81
+
82
+ print(
83
+ javascript(
84
+ """
85
+ WScript.Echo("Hello, World!")
86
+ """
87
+ )
88
+ )
89
+
90
+ print("All within python!")
91
+ ```
92
+
73
93
  ## Licensing
74
94
 
75
95
  Licensed under the GNU General Public License v3 (GPLv3).
@@ -86,7 +106,15 @@ Fixed a bug where enabling `showreturncode` for the `vbscript` function would ca
86
106
 
87
107
  ## 1.0.2
88
108
 
89
- Fixed a bug where running two of the same script at the same time would overwrite temp file A with temp file B.
109
+ Fixed a bug where running two of the same function at the same time would overwrite temp file A with temp file B.
110
+
111
+ ## 1.0.3
112
+
113
+ Added the `javascript` function.
114
+
115
+ ## 1.0.4
116
+
117
+ Fixed a bug in `__init__.py` where it would not import nor export the `javascript` function.
90
118
 
91
119
  ## Some Extra
92
120
 
@@ -1,2 +0,0 @@
1
- from .multiscript import batchscript, commandlist, vbscript
2
- __all__ = ["batchscript", "commandlist", "vbscript"]