Browse Source

Initial commit

Clindo 7 years ago
commit
d36ad860e7
8 changed files with 76 additions and 0 deletions
  1. 1 0
      .gitignore
  2. 9 0
      FirstPython.iml
  3. 10 0
      app.py
  4. 21 0
      automate.py
  5. 19 0
      conf.py
  6. 5 0
      configuration.xml
  7. 4 0
      hello.py
  8. 7 0
      pywinTest.py

+ 1 - 0
.gitignore

@@ -0,0 +1 @@
+.idea/

+ 9 - 0
FirstPython.iml

@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<module type="PYTHON_MODULE" version="4">
+  <component name="NewModuleRootManager" inherit-compiler-output="true">
+    <exclude-output />
+    <content url="file://$MODULE_DIR$" />
+    <orderEntry type="inheritedJdk" />
+    <orderEntry type="sourceFolder" forTests="false" />
+  </component>
+</module>

+ 10 - 0
app.py

@@ -0,0 +1,10 @@
+from automate import Automate
+
+Paths=[]
+Files=[]
+Auto = Automate()
+Paths=Auto.Init()
+
+Files=Auto.GetFiles(Paths)
+
+print (Files)

+ 21 - 0
automate.py

@@ -0,0 +1,21 @@
+from conf import PathConfig
+import os
+
+
+class Automate:
+    'Initialization Class for Automation'
+
+    files = []
+
+    def Init(self):
+        Path = PathConfig( );
+        FolderPaths = []
+        Path.SetPath( );
+        FolderPaths = Path.getPath( );
+        return FolderPaths
+        # print (FolderPaths)
+
+    def GetFiles(self, paths):
+        for file in os.listdir( paths[0] ):
+            Automate.files.append( file )
+        return Automate.files

+ 19 - 0
conf.py

@@ -0,0 +1,19 @@
+import xml.etree.ElementTree as ET
+
+class PathConfig:
+    'Configuration Class for File Paths'
+
+    filePaths=[]
+
+    def SetPath(self):
+        tree = ET.parse('configuration.xml')
+        root = tree.getroot()
+        for path in root:
+            PathConfig.filePaths.append(path.get('value'))
+           # print(path.get('value'))
+
+
+    def getPath(self):
+        return PathConfig.filePaths
+
+

+ 5 - 0
configuration.xml

@@ -0,0 +1,5 @@
+<?xml version="1.0"?>
+<RootPath>
+    <Path value="D:\Master Studies\WS16-17\TKPraktikum\Python Tutorial\test"> </Path>
+    <ConvertedPath value="D:\Master Studies\WS16-17\TKPraktikum\Python Tutorial\test\ConvertedFiles"> </ConvertedPath>
+</RootPath>

+ 4 - 0
hello.py

@@ -0,0 +1,4 @@
+import os
+for file in os.listdir("D:/Master Studies/WS16-17/TKPraktikum/Python Tutorial/test"):
+   # if file.endswith(".*"):
+        print(file)

+ 7 - 0
pywinTest.py

@@ -0,0 +1,7 @@
+from pywinauto.application import Application
+app = Application().start("notepad.exe")
+app.UntitledNotepad.TypeKeys("%FadfojhuaifhasidfhsiudX")
+app.UntitledNotepad.MenuSelect("File->SaveAs")
+app.SaveAs.ComboBox5.Select("UTF-8")
+app.SaveAs.edit1.SetText("Example-utf8.txt")
+app.SaveAs.Save.Click()