Altor

Is possible read output python script?

2 posts in this topic

Hi to all.

My question is if is it possible read with Autoit a output value of python script and load it for example in a array.

My first idea is execute a python script and load the result in a file and then read whith Autoit whith FileReadToArray.

I don't know if this way is the best.
 
Thank's to all

 

Share this post


Link to post
Share on other sites



You could use Run to start the python script and grab any output written to the console using StdOutRead.

1 person likes this

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (2016-08-18 - Version 1.4.6.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2016-12-04 - Version 1.2.2.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now

  • Similar Content

    • nmontec
      [python] controlclick not working when window is minimized
      By nmontec
      Dear All,
      I am having some trouble in automating a window. Everything is fine is I may use the couple WinActivate/WinWaitActive but it is not working if the window is minimized.
      I need to click a button and I tried the following:
      I declared in an object a reference like this:
      self.autoit=win32com.client.Dispatch('AutoItX3.Control') self.autoit.AutoItSetOption('WinTitleMatchMode',2) self.autoit.AutoItSetOption("WinDetectHiddenText", 1) And a t a certain point I press the Exit button
      self.autoit.ControlClick('Dome','','[CLASSNN:WindowsForms10.BUTTON.app.0.378734a15]') self.autoit.ControlClick('Dome','','[NAME:ButtonExit]') self.autoit.ControlClick('Dome','','[CLASS:WindowsForms10.BUTTON.app.0.378734a; INSTANCE:15]') Now, If the window is active and screen is not locked all is ok.But if window is minimized and/or screen is locked the command does not have any effect on the window. As far as I know controlclick should work also on these situations. Am I wrong?
      Thanks a lot for your help
      Nicola
    • JohnOne
      Python total noob
      By JohnOne
      I fancy having a go at python.
      Looking for advice for what environment I need, good web resources etc...
      Ultimate goal is to create a kodi video addon.
    • leegold
      Run Python from Autoit Help
      By leegold
      Hi,
      I run the file:
      #include <Constants.au3> RunWait('python f:\walk2.py > c:\zz.txt') But nothing happens, no content inside zz.txt. It works OK from the XP command line.  Wondered what I'm doing wrong(?) I eventually want to send a .py script values/parameters and get output/"return".
      Thank You.
    • Decipher
      Array Slice UDF
      By Decipher
      _ArraySlice() its similar to list[n:n] in Python. I was converting a python script to autoit and was bored afterwords so I decided to create this UDF.


      #AutoIt3Wrapper_Au3Check_Parameters=-q -d -w 1 -w 2 -w 3 -w- 4 -w 5 -w 6 -w- 7 ; #FUNCTION# ==================================================================================================================== ; Name...........: _ArraySlice ; Description ...: Returns the specified elements as a zero based array. ; Syntax.........: _ArraySlice(Const ByRef $avArray[, $iStart = 0[, $iEnd = 0[, $iStep = 1]]]) ; Parameters ....: $avArray - Array to Slice ; $iStart - [optional] Index of array to start slicing ; $iEnd - [optional] Index of array to stop slicing ; $iStep - [optional] Increment can be negative ; Return values .: Success - Array containing the specified portion or slices of the original. ; Failure - "", sets @error: ; |1 - $avArray is not an array ; |2 - $iStart is greater than $iEnd when increment is positive ; |3 - $avArray is not an 1 dimensional array ; |4 - $iStep is greater than the array ; Author ........: Decipher ; Modified.......: ; Remarks .......: ; Related .......: StringSplit, _ArrayToClip, _ArrayToString ; Link ..........: ; Example .......: Yes ; =============================================================================================================================== #include <Array.au3> ; Needed for _ArrayDisplay only. Example() Func Example() Local $MyArray[10] $MyArray[0] = 9 $MyArray[1] = "One" $MyArray[2] = "Two" $MyArray[3] = "Three" $MyArray[4] = "Four" $MyArray[5] = "Five" $MyArray[6] = "Six" $MyArray[7] = "Seven" $MyArray[8] = "Eight" $MyArray[9] = "Nine" Local $MyNewArray = _ArraySlice($MyArray, 9, 0, -2) _ArrayDisplay($MyNewArray) $MyNewArray = _ArraySlice($MyArray, 1) _ArrayDisplay($MyNewArray) $MyNewArray = _ArraySlice($MyArray, 1, 5) _ArrayDisplay($MyNewArray) $MyNewArray = _ArraySlice($MyArray, 5) _ArrayDisplay($MyNewArray) $MyNewArray = _ArraySlice($MyArray, 1, 3, 1) _ArrayDisplay($MyNewArray) EndFunc ;==>Example Func _ArraySlice(Const ByRef $avArray, $iStart = 0, $iEnd = 0, $iStep = 1) If Not IsArray($avArray) Then Return SetError(1, 0, 0) If UBound($avArray, 0) <> 1 Then Return SetError(3, 0, "") Local $iNew = 0, $iUBound = UBound($avArray) - 1 ; Bounds checking If $iStep > $iUBound Then Return SetError(4, 0, "") If $iEnd < 0 Or $iEnd > $iUBound Or $iEnd <= 0 And $iStep > 0 Then $iEnd = $iUBound If $iStart < 0 Then $iStart = 0 If $iStart > $iEnd And $iStep >= 1 Then Return SetError(2, 0, "") Local $aNewArray[$iUBound] For $i = $iStart To $iEnd Step $iStep ; Create a new zero based array $aNewArray[$iNew] = $avArray[$i] $iNew +=1 Next ReDim $aNewArray[$iNew] Return $aNewArray EndFunc ;==>_ArraySlice _ArraySlice.au3
    • ryushi5
      AutoIt and Python - Limited Functions
      By ryushi5
      I'm using Python to call AutoIt functions, but some functions don't work. Is there a reason for this? If so, can I fix it?


      from win32com.client import Dispatch Auto = Dispatch("AutoItX3.Control") def autoTest(): print Auto.MsgBox('')
      When I run it I get this error:


      line 516, in __getattr__ raise AttributeError("%s.%s" % (self._username_, attr)) AttributeError: AutoItX3.Control.MsgBox
      It seems like it's reading 'MsgBox' as an attribute and not a function. Any thoughts?