Jump to content

Search the Community

Showing results for tags 'python'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • General
    • Announcements and Site News
    • Administration
  • AutoIt v3
    • AutoIt Help and Support
    • AutoIt Technical Discussion
    • AutoIt Example Scripts
  • Scripting and Development
    • Developer General Discussion
    • Language Specific Discussion
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • AutoIt Team
    • Beta
    • MVP
  • AutoIt
    • Automation
    • Databases and web connections
    • Data compression
    • Encryption and hash
    • Games
    • GUI Additions
    • Hardware
    • Information gathering
    • Internet protocol suite
    • Maths
    • Media
    • PDF
    • Security
    • Social Media and other Website API
    • Windows
  • Scripting and Development
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Member Title


Location


WWW


Interests

Found 20 results

  1. Readability is a Python Library that emulates the "Reading Mode" used by Browsers, ie it takes an input URL, and returns the simplified HTML. It removes headers, footers and scripts. I made a simple server out of it, which takes CLI arguments for server IP and server Port to start the server. Default IP and port are 127.0.0.1:8900 Example requests that can be made: http://127.0.0.1:8900?url=https://google.com&output_type=TITLE http://127.0.0.1:8900?url=https://google.com&output_type=SHORT_TITLE http://127.0.0.1:8900?url=https://google.com&output_type=CONTENT http://127.0.0.1:8900?url=https://google.com&output_type=SUMMARY http://127.0.0.1:8900/health (to check if the server is running) import http.server import requests import re import logging import sys from readability import Document # Set up logging logging.basicConfig(level=logging.INFO, format="%(asctime)s - %(levelname)s - %(message)s") class RequestHandler(http.server.BaseHTTPRequestHandler): def do_GET(self): # Log the request logging.info(f"Received request: {self.path}") # Regular expression to match URLs URL_REGEX = re.compile(r"^https?://.+$") # Allowed output types ALLOWED_OUTPUT_TYPES = ["TITLE", "SHORT_TITLE", "CONTENT", "SUMMARY"] if self.path == "/health": # This is a health check request, return a 200 status code self.send_response(200) self.send_header("Content-type", "text/plain") self.send_header("User-Agent","Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:108.0) Gecko/20100101 Firefox/108.0") self.end_headers() self.wfile.write(b"OK") else: # Parse the query string to get the URL and output type query_string = self.path[2:] query_params = query_string.split("&") url = query_params[0].split("=")[1] output_type = query_params[1].split("=")[1] # Validate the input if not URL_REGEX.match(url): # URL is invalid self.send_response(400) self.send_header("Content-type", "text/plain") self.end_headers() self.wfile.write(b"Invalid URL") elif output_type not in ALLOWED_OUTPUT_TYPES: # Output type is invalid self.send_response(400) self.send_header("Content-type", "text/plain") self.send_header("User-Agent","Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:108.0) Gecko/20100101 Firefox/108.0") self.end_headers() self.wfile.write(b"Invalid output type") else: # Input is valid, proceed with processing the request try: doc = Document(requests.get(url).content) output = { "TITLE": doc.title(), "SHORT_TITLE": doc.short_title(), "CONTENT": doc.content(), "SUMMARY": doc.summary() }[output_type] # Send the response self.send_response(200) self.send_header("Content-type", "text/plain") self.end_headers() self.wfile.write(output.encode()) except Exception as e: # Log the error logging.error(f"Error: {e}") # Return an error message to the client self.send_response(500) self.send_header("Content-type", "text/plain") self.end_headers() self.wfile.write(b"An error occurred while processing the request") # Get the server IP and port from the command line arguments server_ip = sys.argv[1] if len(sys.argv) > 1 else "127.0.0.1" server_port = int(sys.argv[2]) if len(sys.argv) > 2 else 8900 # Create the server and run it indefinitely server_address = (server_ip, server_port) httpd = http.server.HTTPServer(server_address, RequestHandler) # Log an info message when the server starts logging.info("Server started") httpd.serve_forever() Note: make sure you have the readability library https://github.com/buriy/python-readability before using this pip install readability-lxml
  2. Yesterday I wrote a quick AutoIt script that uses the EditDistance python library by first writing the .py script and then converting it to exe, then passing arguments to it from AutoIt via command line. Link: I use AutoIt for 90% of my work, and it's quite adequate for almost anything. However, it falls short in one area: libraries related to data processing. This is fine, I understand AutoIt wasn't built to be a language for that purpose. However, it would be interesting if AutoIt would have ways of interacting with python scripts etc so existing python libraries for data analytics etc could be used. So far, the only way I've managed to do this is: 1. Write .py script, make it accept command line arguments, and print output 2. Compile .py into an exe file 3. Write autoit script that uses Run() to execute the exe file, and catches the cmd console output in a variable. Is this the only way to go about it? This is a little inconvenient, in that I have to compile the .py into an exe every time I make changes to the python script.
  3. Hi, I am using python to call the Autoit function. I found a interesting problem. env: win10 64bit python3.6.4 x86、 python3.8.6 x64 autoit v3.3.16.0 code: #filename: demo.py from ctypes import windll dll = windll.LoadLibrary(r"D:\it_tools\autoit\AutoIt3\AutoItX\AutoItX3_x64.dll") # or AutoItX3.dll dll.AU3_Send("#r", 0) Behaviour: (1) run with the "python.exe" it will not open the run dialog, but input a "r" in the cmd window. (2) run with xxxxxx.exe (renamed from python.exe, you can rename whatever you like) work success I dont know why it happened. I think it shoule be related to Python and Autoit. So I came here... Can someone give me some advices. Thanks a lot. (by the way, My English is not very well... I wish I have provided the enough information... If you need more details, please contact me )
  4. Hi, everyone. I have python code for kill window, but sometimes it does not working . My code is : import subprocess import time import ctypes au3_dll = ctypes.windll.LoadLibrary(r'D:\AutoIt\AutoItX3.dll') def close_ie(title): subprocess.Popen(f"C:/Program Files (x86)/Internet Explorer/iexplore.exe https://cn.bing.com/?mkt=zh-CN") time.sleep(2) au3_dll.AU3_Opt("WinTitleMatchMode", 2) ret = au3_dll.AU3_WinKill(title, "") print(ret) if __name__ == '__main__': title = '必应 - Internet Explorer' for i in range(10): close_ie(title) My expectation is that all IE windows will be closed, but there will always be a few windows still there. My env: win10 64bit python3.6.4 autoit v3.3.14.2 Any suggestions would be appreciated
  5. 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?
  6. I've been working for quite a while on an automated installer for python3.8.3 and Thonny3.2.7 and encountered a pretty strange problem - automated python install work perfectly. However using pip to install esptool returns error code 1. The strange thing is if i manually install it after running the python installer it does indeed install correctly (returns 0 instead). The code i was using: Local Const $sInstallerPath = @ScriptDir & "\python-3.8.3.exe" Local $PythonResult = RunWait($sInstallerPath & " /quiet") Local $ESPToolResult = RunWait(@ComSpec & " /c " & "pip install esptool") MsgBox(0, "Installer returns", "Python result: " & $PythonResult & @CRLF & "esptool result: " & $ESPToolResult) Than I thought that maybe python installer fires off multiple processes during installation and tried : Local Const $sInstallerPath = @ScriptDir & "\python-3.8.3.exe" Local $iPID = Run($sInstallerPath & " /quiet") Local $PythonResult = ProcessWaitClose($iPID) Local $ESPToolResult = RunWait(@ComSpec & " /c " & "pip install esptool") MsgBox(0, "Installer returns", "Python result: " & $PythonResult & @CRLF & "esptool result: " & $ESPToolResult) However, The problem still remains. some-why esptool install refuses to be automated with python but if i comment out the python install part it does work ?! (note that i comment it out after the script already installed python and did not manually install it myself). Any idea why this happens ? NOTE: I added the unattend.xml file im using but python.exe was too big - I'm using python3.8.3 for compatibility with thonny and the unattend files makes a minimal install just for thonny to work (target platform esp32 with micopython) unattend.xml
  7. Hi Guys, I am trying to convert a python script to AutoIT, but it is not returning any data. My aim is to eventually have a script which sends me an email whenever a goal is scored in the English Premiership. Is there any guru who can have a quick look over the below script and see if there are any obvious errors? To use a football analogy, I think that I have hit the bar a couple of times, but not yet found the back of the net! #cs ---------------------------------------------------------------------------- PYTHON CODE: import requests import json endpoint = "https://api.betfair.com/exchange/betting/rest/v1.0/" header = { 'X-Application' : 'APP_KEY_HERE', 'X-Authentication' : 'SESSION_TOKEN_HERE' ,'content-type' : 'application/json' } json_req='{"filter":{ }}' url = endpoint + "listEventTypes/" response = requests.post(url, data=json_req, headers=header) print json.dumps(json.loads(response.text), indent=3) #ce ---------------------------------------------------------------------------- #include <WinHttp.au3> Opt("MustDeclareVars", 1) Opt("TrayIconDebug", 1) Global $sAddress = 'https://api.betfair.com/exchange/betting/json-rpc/v1/' Global $sPostData = 'https://api.betfair.com/exchange/betting/json-rpc/v1/listEventTypes/' Global $sAppKey = '4YpsEhdsgtedjd' Global $sSession_key = 'BhKl7Ijdu4E3pzHhKu7K5fQrvzf9p3wq/diRMt7bZka7' Global $sjson_req = '{"filter":{ }}' Global $hOpen = _WinHttpOpen() ; Get Session handle ; ##### CHECKED AND VALID HANDLE IS RETURNED ##### Global $hConnect = _WinHttpConnect($hOpen, $sAddress) ; Get connection handle ; ##### CHECKED AND VALID HANDLE IS RETURNED ##### Global $hRequest = _WinHttpOpenRequest($hConnect, 'POST') ; Make a request ; ##### CHECKED AND VALID HANDLE IS RETURNED ##### ; Add header fields to the request _WinHttpAddRequestHeaders($hRequest, 'X-Application: ' & $sAppKey) _WinHttpAddRequestHeaders($hRequest, 'X-Authentication: ' & $sSession_key) _WinHttpAddRequestHeaders($hRequest, 'Accept: application/json') _WinHttpAddRequestHeaders($hRequest, 'Content-Type: application/json') _WinHttpSendRequest($sPostData, 'Data=' & $sjson_req, $hRequest) ; Send it _WinHttpReceiveResponse($hRequest) ; Wait for the response ; Check if there is a response Global $sHeader, $sReturned If _WinHttpQueryDataAvailable($hRequest) Then $sHeader = _WinHttpQueryHeaders($hRequest) MsgBox(64, 'Header', $sHeader) Do $sReturned &= _WinHttpReadData($hRequest) Until @error ConsoleWrite($sReturned) ; Print returned Else ConsoleWriteError('!No data available.' & @CRLF) MsgBox(48, 'Failure', 'No data available.') ;##### <==== ALWAYS FAILS HERE! ##### EndIf ; Close handles _WinHttpCloseHandle($hRequest) _WinHttpCloseHandle($hConnect) _WinHttpCloseHandle($hOpen) I am sure that I have probably missed out a vital line, but for the life of me I can't see the wood for the trees anymore. Anyone got any suggestions? Many thanks, Pete
  8. I only found that AutoIt can actually execute the entire python script or execute the .exe (converted to .exe from .py) But what if I just want call the particular function? If that possible to do so? This is because python can't create fancy GUI like AutoIT does. So my plan is use AutoIT to have fancy GUI. Then each buttons will trigger specific function in the python script or .exe file. For instances: btnSum - trigger function in python script or .exe file (funcSum) btnMinus - trigger function in python script or .exe file (funcMinus) Thanks for advance information.
  9. Hello mates. I would like to share simple but very important function required durning code many *au3 files. Such as function is used by a few scripts developers on forum but most of users waste a lot of time to make his functions/tool free from errors and bugs. How is working? This function do not check errors like Scite debugger. You can be able to make something like call exceptions in Python. Think about this and think when you ran some code, no error but also do nothing. 0 information and you have to jump into own or other script to find out reason. Function: Updated 2018-02-04, 08:47 (fixed AutoIt problem with dedection @ScriptName) ;============================================================================================================================================================== ; Function: Exception ([ $sInfo = "" [, $vReturnValue = Null [, $vExtended = @extended [, $iErrorNr = @error [, $iErrorLine = @ScriptLineNumber ]]]]]) ; ; Description: Call exceptions in different *au3 files located in this same Folder. ; ; Parameter(s): $sInfo - Information about exception in code, created by yourself. ; $vReturnValue - (Default=Null) Set value to return durning exception. ; $iErrorNr - (Default=@error) Set the error manually by adding a number. ; $vExtended - (Default=@extended) Set extended manually. ; $iErrorLine - Internal use do not change! ; ; Return Value(s): $vReturnValue, ; Additional: Output string in Scite Console about debug trace. ; ; Author (s): Who cares? ;============================================================================================================================================================== Func Exception($sInfo="", $vReturnValue = Null, $iErrorLine = @ScriptLineNumber, $iErrorNr = @error, $vExtended = @extended) Dim $aArray[0] Local $sScriptPath = @ScriptFullPath Local $sCurrentScriptLine = StringLower(FileReadLine($sScriptPath, $iErrorLine)) If Not StringInStr($sCurrentScriptLine, "exception") Then Local $aInclude = FileReadToArray($sScriptPath) For $sItem In $aInclude Local $sLowerLine = StringLower($sItem) If StringInStr($sLowerLine, "#include") Then Local $sIncludeName = StringTrimLeft($sItem, 8) Local $sConvertedName = "" Local $bAdd = False Local $aDelimeter = ["<", ">"] If StringInStr($sIncludeName , "'") Then $aDelimeter[0] = "'" $aDelimeter[1] = "'" ElseIf StringInStr($sIncludeName , '"') Then $aDelimeter[0] = '"' $aDelimeter[1] = '"' EndIf Local $aSplitInclude = StringSplit($sIncludeName, "") For $sSign In $aSplitInclude If $sSign = $aDelimeter[0] And Not $bAdd Then $bAdd = True ContinueLoop ElseIf $sSign = $aDelimeter[1] And $bAdd Then ReDim $aArray[UBound($aArray) + 1] $aArray[UBound($aArray) - 1] = $sConvertedName ExitLoop EndIf If $bAdd Then $sConvertedName &= $sSign Next EndIf Next EndIf If UBound($aArray) > 0 Then For $sName In $aArray Local $sPath = @ScriptDir & "\" & $sName If FileExists($sPath) Then $sCurrentScriptLine = StringLower(FileReadLine($sPath, $iErrorLine)) If StringInStr($sCurrentScriptLine, "exception") Then $sScriptPath = $sPath ExitLoop EndIf EndIf Next EndIf Local $aFile = FileReadToArray($sScriptPath) Local $sFunctionName, $sLine Local $bFound = False For $i = 0 To $iErrorLine - 1 If $bFound Or $iErrorLine <= 0 Then ExitLoop $sLine = StringReplace($aFile[$iErrorLine - $i], @TAB, "") If StringInStr(StringLower($sLine), "func ") Then Local $aSortLine = StringSplit($sLine, '') $sLine = "" For $h = 1 To $aSortLine[0] - 1 Local $sLowerSort = StringLower($aSortLine[$h]) If $sLowerSort = "(" Then $bFound = True ExitLoop ElseIf $sLowerSort <> @TAB And $sLowerSort <> " " Then If $sLowerSort = "f" Or $sLowerSort = "u" Or $sLowerSort = "n" Or $sLowerSort = "c" Then $sLine &= $aSortLine[$h] Else If Not StringInStr($sLine, "func") Then $sLine = "" ExitLoop Else $sLine &= $aSortLine[$h] EndIf EndIf EndIf Next EndIf Next If StringLeft(StringLower($sLine), 4) <> "func" Then $sLine = "" EndIf $sFunctionName = StringTrimLeft($sLine, 4) If StringLen($sFunctionName) < 1 Then $sFunctionName = "not recognized" Else $sFunctionName &= " ( ... )" EndIf If StringLen($sInfo) < 1 Then $sInfo = "nothing about" EndIf $vRet = $vReturnValue If $vRet = Null Then $vRet = "Null" ElseIf IsArray($vRet) Then $vRet = "an Array with " & UBound($vRet) & " items" ElseIf IsBinary($vRet) Then $vRet = "binary " & $vRet ElseIf IsBool($vRet) Then $vRet = "bool " & $vRet ElseIf IsDllStruct($vRet) Then $vRet = "dll struct " & $vRet ElseIf IsFloat($vRet) Then $vRet = "float " & $vRet ElseIf IsHWnd($vRet) Then $vRet = "hwnd " & $vRet ElseIf IsInt($vRet) Then $vRet = "int " & $vRet ElseIf IsKeyword($vRet) Then $vRet = "keyword " & $vRet ElseIf IsNumber($vRet) Then $vRet = "number " & $vRet ElseIf IsObj($vRet) Then $vRet = "object " & $vRet ElseIf IsPtr($vRet) Then $vRet = "ptr " & $vRet ElseIf IsString($vRet) Then If $vReturnValue = "" or StringReplace($vRet, " ", "") = "" Then $vRet = 'empty string ""' Else $vRet = 'string "' & $vRet & '"' EndIf EndIf Local $sStruct $sStruct &= "! Exception = {" & @CRLF $sStruct &= "!" & @CRLF $sStruct &= "!" & @TAB & '"date" = ' & @YEAR & "-" & @MON & "-" & @MDAY & ", " & @HOUR & ":" & @MIN & ":" & @SEC & ", " & @MSEC & "ms," & @CRLF $sStruct &= "!" & @TAB & '"path" = ' & $sScriptPath & "," & @CRLF $sStruct &= "!" & @TAB & '"line" = ' & $iErrorLine & "," & @CRLF $sStruct &= "!" & @TAB & '"func" = ' & $sFunctionName & "," & @CRLF $sStruct &= "!" & @TAB & '"retn" = ' & $vRet & "," & @CRLF $sStruct &= "!" & @TAB & '"exten" = ' & $vExtended & "," & @CRLF $sStruct &= "!" & @TAB & '"error" = ' & $iErrorNr & "," & @CRLF $sStruct &= "!" & @TAB & '"info" = ' & $sInfo $sStruct &= @CRLF $sStruct &= "!" & @CRLF $sStruct &= "! }" & @CRLF & @CRLF ConsoleWrite($sStruct) Return $vReturnValue EndFunc ;==> Exception How to use? - Example 1 Func Example() Local $sFile = FileOpen(@ScriptDir & "\example.py") If $sFile = -1 Then Return Exception("Failed to open 'example.py', File not exist!") EndIf ; continue working EndFunc Example() Example 1 Output in Scite console: Example 2 Func Example2() Local $oHttp = ObjCreate("WinHttp.WinHttpRequest.5.1.Fake") ; added .Fake to make object wrong. If Not IsObj($oHttp) Then Return Exception("Failed to create Object in variable $oHttp.", 2.2) EndIf ; continue working EndFunc Local $vRet = Example2() ConsoleWrite("$vRet = " & $vRet & @CRLF) Example 2 Output in Scite console:
  10. KemyKo

    AUTOIT WITH PYHTON

    I recently discovered these: https://pypi.python.org/pypi/PyAutoIt https://github.com/jacexh/pyautoit I guess any python developer knows what these are. The problem is that I`m on a 64bit version of Windows and i can`t use neither pip install -U pyautoit nor python setup.py install to install the package Is there anyone who has the same problem like me? Suggest your suggestions *(nice joke right there )* Problem solved -> Apparently when i run the setup.py file from github it worked.
  11. Hello m trying to learn python m interested in knowing if there is koda like gui designer for python please also help me what all additional modules i require like ones which are famous i have already done with 1.Scrapy 2.Openpyxl 3.twister 4.selenium 5.Requests 6.pdfrw
  12. I want to run a python script from autoit. I know we can do this with shellexecute or run , but this python script takes 3 cmd line arguments. How to pass them from autoit script? I tried many ways. Following solution also not working e.g. RunWait( 'fullpath\Python.exe Scriptpath\ReadLog.py  -f "file.log" -k "key" -e "errMsg" ') Found solution: RunWait( 'fullpath\Python.exe ReadLog.py -f "file.log" -k "key" -e "errMsg" ', 'Working_directory_path') PFB description: https://stackoverflow.com/questions/45757834/how-to-pass-command-line-arguments-to-a-python-script-anyscript-while-executin
  13. Hi all, I want to return string from autoit script to the python code. Autoit: Exit("22 FE 45") -> not working Exit(1) -> Working Exit(0) -> Working python: import os res=os.system(autoitmine.exe) print "res",res I got some hint of @ExitCode macro, but dont know how to use it to get the string in python variable 'res'. Please resolve this issue for me if anyone knows about this.
  14. Got this idea a long time ago to create a really neat project using a raspberry pi, camera, some custom python code, and a monitor I pulled from an old laptop. The idea is to create an interactive and informational display using the monitor and it will hang on my wall. Custom code will display the time, date, weather forecast, and current events. Has a temperature/humidity for the room (also shown on the display) and a motion censor. Censor will be enabled when I enter the pin for when I leave my room, and turned off when I come back and re-enter the pin. Once the censor is enabled (my security feature is enabled) it will activate the camera, taking a snapshot as soon as it's triggered, email me the screenshot, and then continue to snap pictures every second. Once the person has left my room, zips everything up and then emails me the zip file. Figured it was a good way to play with python, play with the raspberry pi, and make sure anyone coming to my room isn't doing anything sneaky (since I live in the dorms) Started the code today and had to figure out how to draw a string like _GDIPlus_GraphicsDrawStringEx. Because I wanted to define movable areas to render all of my text (so the position of the text is dynamic, and can be moved around and the position changed whenever I want to). Since pygame doesn't have anything like that, and it doesn't support multi-line text, let alone aligned text, I had to come up with how to allow multi line, then moved onto alignment, and make sure everything fit inside the defined area, not drawing any extra text that would "bleed" outside the rect Here's the progress of the text. The greetings text has the left alignment, top line alignment. Time and date have center and center, and fps actually has the whole screen as the rect but uses right alignment + bottom line alignment, making it show in the bottom right corner Source can be found on github for anyone interested This is way incomplete, probably gonna take months to get to the final product, but I predict I'll need to draw text in a defined area a lot.
  15. _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
  16. Hello everyone, Finally I decide to ask hard question about one of the project which I currently maintain: Big World Setup aka mod installer for infinity engine games like BG, IWD, PST etc Project page: https://bitbucket.org/BigWorldSetup/bigworldsetup/overview More screenshot: https://forums.beamdog.com/discussion/44476/tool-big-world-setup-bws-mod-manager-for-baldurs-gate-enhanced-edition-trilogy-for-windows/p1 General Features downloading mods (please see remarks!) easy mod installation correct install order of mods/components handle mod and components conflicts and auto solve them easy backup creation/restoring ability to add you own mods Internal Features (every single feature which you see here is already working in autoit) It look as simple GUI application but it has quite complicated logic regarding "handle mod and components conflicts and auto solve them" - this is most important feature of the app. This app needs to be converted into multi-platform GUI application because Enhanced Editions of the game can be played on OSX and Linux also. But for the past 6 years, there wasn't a single gamer/developer who would try to convert this app using multi-platform language and GUI. This is the moment when I'm asking for help: - Which language would suit the best for multi-platform GUI application? c#,python,java or other? - Is there any general approach for such conversion? - Does autoit community/developer have some experience with converting autoit GUI applications into multi-platform GUI app by using multi-platform language like c#,python,java - Is there someone who isn't scared by looking at the source code of the application and feature list to help me with converting or even begin with creating multi-platform GUI app template which will just simply run the same commandline for every system ? If there is something else which you would know, pleas ask and I will try to answer my best.
  17. 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
  18. 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
  19. JohnOne

    Python total noob

    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.
  20. 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.
×
×
  • Create New...