Jump to content

Jfish

Active Members
  • Posts

    918
  • Joined

  • Last visited

  • Days Won

    8

Jfish last won the day on November 15 2022

Jfish had the most liked content!

Profile Information

  • Location
    Boston

Recent Profile Visitors

1,508 profile views

Jfish's Achievements

  1. I don't want to pimp my own book, but you can download it here and it has pretty good material for someone starting out:
  2. Why not just loop through the array to get the values you want and return them with whatever type suits you?
  3. [this was a reply to a message that was subsequently deleted - won't let me delete the reply for some reason] Yes. it can code and it can also debug code. It isn't always 100% accurate but over time it has the potential to radically change so many things - including software development.
  4. @rudi - I was digging around a bit, I think it may have a dependency on the paid Foxit SDK. It appears you can get a free trial on their site but then you need to pay after the trial. So not sure if this is a work thing ... if so may still be worth investigating. Then (untested) something like this: Dim foxitApp As Object Set foxitApp = CreateObject("FoxitReader.SDK.CommonUIAutomation")
  5. I have not tested this (I don't have Foxit), but I was curious what Chat GPT-4 would say when asked about possible solutions to best automate reader. I asked it specifically about using a COM API (Foxit does have an API). It barfed up the following tester which may or may not work. Either way, the API reference docs can be found here. I would think the API would be more reliable then sending commands to the GUI. ; Create a FoxitReader COM object $foxit = ObjCreate("FoxitReader.Application") ; Open a PDF file $doc = $foxit.Open("C:\example.pdf") ; Set the zoom level to 100% $viewer = $doc.GetViewer() $viewer.Zoom = 100 ; Save the document $doc.Save() ; Close the document and quit Foxit $doc.Close() $foxit.Quit()
  6. CHAT GPT is taking over ... so I asked it to help me code a call to itself from AutoIt. It did pretty well - but ultimately I had to turn to the docs to realize that it was calling its own deprecated endpoint that I needed to update (AI has limits I guess). Anywho, if anyone wants to play around with it here is a working example: #include <WinHttp.au3> #include <Json.au3> ; Set up WinHttp object $oHttp = ObjCreate("WinHttp.WinHttpRequest.5.1") $oHttp.Open("POST", "https://api.openai.com/v1/completions", false) $oHttp.SetRequestHeader("Content-Type", "application/json") $oHttp.SetRequestHeader("Authorization", "Bearer <YOUR API KEY HERE>"); you will need to get an API key and place it here ; Set up request data params can be seen here https://platform.openai.com/docs/api-reference/completions/create ; tokens dictate length $sData = '{"model": "text-davinci-003", "prompt": "what day is it?", "max_tokens": 10}' ; change the prompt to whatever you want ; Send request and get response $oHttp.Send($sData) ; Check if request was successful If $oHttp.Status <> 200 Then MsgBox(0, "Error", "WinHttp request failed with status code: " & $oHttp.Status) Exit EndIf $sResponse = $oHttp.ResponseText ; Parse response and display $aJson = _Json_Parse($sResponse) $sText = $aJson.choices[0].text MsgBox(0, "Response", $sText)
  7. @Uemlue my book has a chapter on automating other applications and covers some of the basics for the Excel UDF (link below). There is also excellent wiki coverage here: https://www.autoitscript.com/wiki/Excel_UDF
  8. Not sure why this is an autoit question or why you are not using OpenSSL to decrypt but see these examples: https://stackoverflow.com/questions/16056135/how-to-use-openssl-to-encrypt-decrypt-files
  9. I recommend the excel UDF functions to read the value from excel for your compare instead of sending ctrl+c for a generic copy.
  10. What application are you trying to automate? Lots of questions in your post but the coordinates within a given control are relative to the control when you use ControlClick (as opposed to MouseClick). ControlClick has optional X,Y parameters that allow for clicking on a specific spot in the control. If you are intending to interact with a WPF control under Windows 10 it may not work with these methods as it may require UI Automation (see below post).
  11. I haven't tested the code but out of pure curiosity - is your laptop plugged in when you run the code (if so, consider unplugging)? Also, confirming you are not using an emulator? "When debugging on a device emulator, the BatteryReport object returns null to the capacity and rate properties."
  12. You should test on another machine but as previously mentioned, the coordinates for the controlclick function are relative to the control as compared to mousemove that is relative to the screen. We seem to be just repeating the same info at this point so I am going to wish you the best with the project.
  13. In reading the notes on Win32_battery it says the design capacity property is the capacity expressed in milliwatt-hours. Trying to understand why that is not what you are after from reading your post?
  14. Didn't it work on your machine / monitor when you ran the code? You said "I don't know why, but your code works as I wanted." Did you have to adjust anything to make it work? I already answered the other thread you posted (please keep posts/threads separate) you should try the approach I linked.
  15. Because I adjusted X. We are not using MouseMove which you have referenced a couple of times in the code. We are using parameters as part of the ControlClick function that tell the code where to click within the targeted control. X is one of those parameters. Not sure what you are seeing about the mouse moving outside the control, I don't see that. If your code has MouseMove then that could cause that issue because it is not relative to the control per se, rather to the screen.
×
×
  • Create New...