Jump to content

All Activity

This stream auto-updates     

  1. Past hour
  2. Melba23, like your tag line. I'm in the mindset of "Old enough to know better, young enough to not worry"
  3. Actually as far as a Hotkey functionality with AutoIt I've done nothing as I don't seem to find anything helpful as a simple sample. The product I work with has default "Hotkeys" that allow the program to toggle between apps and also to trigger a VBA event that allows us to ingest data to pass on to the main program. The product and the connectivity tool they use are built as 32bit solutions and do not recognize 64 bit applications. The vendor has told me at this time they have no plans of implementing a 64bit connectivity module for Windows applications. As I said the problem is Windows 10 and bit-ness of desktop applications. If the application is 64bit the Hotkey simply posts to the window the actual key and not toggle windows or trigger the VBA event. My time constraints did not allow me much time, less than an hour to be honest, to resolve the problem. So when I found both AutoIt and another program that offer the HotKey element it was the fix I needed. AutoIt had both needs a HotKey and the ability to replace SendKeys in VBA, the other application seemed to only offer HotKey tooling. I quickly got AutoIt Dll working for the data return, found plenty of samples, but I could not find how to use AutoIt for the desktop hot key functionality the samples I found what seemed to be all kinds of things mostly too complex for my needs and difficult to break down with the time constraint. With the other hotkey app I found there was plenty on the desktop hotkey samples but nothing on VBA integration, it does not seem to be available. Now I have a bit of time, off the clock, to step back and try to figure out how to do the HotKey toggle and sending of keystrokes through AutoIt. The goal being to reduce long term support needs and overhead of multiple applications installed and running on a system. For simple reasons I'll use Chrome and Notepad++ as the 2 apps I'm toggling between and Notepad++ as the main app I want to send a keystroke to activate a Menu option in. Here is the other tools script that allows this to work. I removed obvious references to that hotkey program from the script. The script is loaded with the other app through Windows C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup folder entry. ;IF Numpad+ switch to Notepad++, push Ctrl{F1} to Notepad++ #ifwinactive class Chrome_WidgetWin_1 Numpadadd:: winactivate, class Notepad++ sendinput, ^{F1} return ;If = key toggle beween Chrome and Notepad++ #ifwinactive class Chrome_WidgetWin_1 =:: winactivate, class Notepad++ return #ifwinactive class Notepad++ =:: winactivate, class Chrome_WidgetWin_1 return Any help is most appreciated, thanks.
  4. Today
  5. MarkIT, As I posted when closing your completely unnecessary (although I know you were pointed there) Trac ticket - it is nothing to do with an AutoIt bug. If Symantec already agree it is a false positive then ask them to change their algorithm to prevent it being flagged - that has worked for me with other AV providers in the past. Thread locked. M23
  6. Your title is misleading, it has nothing to do with your question.
  7. Two remarks: When we ask for a reproducer script, that means that we should be able to run that on our own machine to be able to analyse what might be going wrong. What you posted is a mere "snippet" that doesn't do much, and certainly cannot run for hours, and doesnt help to study the problem. But... Since this part of your code allegedly does run for hours before the error occurs, I am guessing that you just keep creating new displays without ever cleaning up the old ones. So you simply run out of storage space for defining new displays. In the DigitalDisplay UDF, you can find the following above #endregion globals: ; list of specs per display unit Global $DigiDispSpecs[1000][10] $DigiDispSpecs[0][0]=0 #endregion Globals That number 1,000 defines 999 slots for such definitions (+1 for the total count), which should be plenty unless you would want to display over a thousand DigitalDislays at the same time on your screen. If you're going to keep defining new ones for hours on end, you'll need to clean up the old ones you're no longer using at some point, else you'll eventually run out of slots. If you study the UDF you'll see that calling _DD_Remove() clears one definition, but does not clear the slot in the list of DDs; for that you have to call _DD_RemoveAll(): Func _DigitalDisplay_Remove($displayID,$background=$GUI_Bk_Color) ; used slot is blanked, but remains in the queue until _DigitalDisplay_RemoveAll() ; otherwise all subsequent references would shift Of course, you could simply edit the $DigiDispSpecs array definition (in the previous code section I quoted) with a much higher number (up to about 16 million max), but that would merely defer the problem till a later time if your code runs for long enough. The proper way of handling this is to clean up the list often so it never reaches its ceiling.
  8. i was trying your script and im getting script paused problem please can you help me and i was traying to change the time to 3 min
  9. GUIGetMsg() returns pretty quickly. Just move your WinExists code into the while loop of your main script and use GUIGetMsg() as your Sleep(100). If you want you could put it into a Case $GUI_EVENT_NONE section but I don't think that is necessary. Another approach could be to use https://www.autoitscript.com/autoit3/docs/libfunctions/_Timer_SetTimer.htm but again: I would just copy your If and everything inside it into the while 1 loop in your main script.
  10. well, i will be very happy if you helped me i was trying all the scripts but im always having the script paused problem #include <Array.au3> #include <Timers.au3> #include <WinAPIProc.au3> Global $sProductFilePath = @WindowsDir Global $sProductFileName = "Notepad.exe" Global $sProductName = FileGetVersion($sProductFilePath & "\" & $sProductFileName, "ProductName") Global $hProcessWnd, $aProcessList, $idMsgBox Global $iTimerInit = TimerInit() Global $iIdleTime = _Timer_GetIdleTime() While 1 $aProcessList = ProcessList($sProductFileName) If $aProcessList[0][0] >= 2 Then $idMsgBox = MsgBox(48, $sProductName, "Multiple Licenses Detected" & @CRLF & @CRLF & "Due to license limitations only one copy of " & $sProductName & " is allowed." & @CRLF & @CRLF & "Please close additional copies of " & $sProductName) $iTimerInit = TimerInit() ContinueLoop EndIf $iProcessId = ProcessExists($sProductFileName) If $iProcessId Then $iIdleTime = _Timer_GetIdleTime() $hProcessWnd = _GetHwndFromPID($iProcessId) If WinActive($hProcessWnd ) Then $iTimerInit = TimerInit() EndIf ;~ If the timer is more than 40 minutes then send message to user and close the process, otherwise it closes within 5 minutes If TimerDiff($iTimerInit) >= 40 * 60 * 1000 Or $iIdleTime >= 40 * 60 * 1000 Then $idMsgBox = MsgBox(48, $sProductName, $sProductName & " has been idle for more than 40 minutes and will be closed in 5 minutes if no activity is detected.", 300) If $idMsgBox = -1 Then ProcessClose($sProductFileName) EndIf EndIf Sleep(100) WEnd ;Function for getting HWND from PID Func _GetHwndFromPID($_iProcessId) Local $_hProcessWnd Local $iWinList, $_aWinList = WinList() For $i = 1 To $_aWinList[0][0] If $_aWinList[$i][0] <> "" Then $iWinList = WinGetProcess($_aWinList[$i][1]) If $iWinList = $_iProcessId Then $_hProcessWnd = $_aWinList[$i][1] ExitLoop EndIf EndIf Next Return $_hProcessWnd EndFunc;==>_GetHwndFromPID
  11. Works great!! Ive changed $in = "text text tex text 123x 2x34 345@CRLF@" & _ "text text tex text 123 23x4 3x45@CRLF@" & _ "text text tex text 123 2x34 345" for $in = ClipGet() And its perfect THNKS!!
  12. Opt("ExpandVarStrings", 1) $in = "text text tex text 123x 2x34 345@CRLF@" & _ "text text tex text 123 23x4 3x45@CRLF@" & _ "text text tex text 123 2x34 345" $in = StringSplit(StringStripCR($in), @LF) $out = "" For $i = 1 To $in[0] $out &= StringLeft($in[$i], StringInStr($in[$i], ' ') + 0) & @LF Next ConsoleWrite($out) I would use StringSplit.
  13. I come from here: https://www.autoitscript.com/forum/topic/36064-string-delete-after-character/ Im trying to copy some multiline text like this from clipboard: text text tex text 123x 2x34 345 text text tex text 123 23x4 3x45 text text tex text 123 2x34 345 So I need to remove any character after "spaces" in every line and putit into clipboard with this format: text text tex text text text tex text text text tex text Im using StringLeft and I it's alright for one line. Is possible to make it multiline? $String = ClipGet() $OutPut = StringLeft($String, StringInStr($String, ' ') + 0) ClipPut ($OutPut) Thank you!
  14. ShellExecuteWait returns the exit code of the program. You know.. like the number between 0 and 255 that says if it errored or not. You read stdout like this: #include <AutoItConstants.au3> Opt("ExpandVarStrings", 1) Local $pid = Run("@ComSpec@ /C echo test", "", Default, $STDOUT_CHILD) ProcessWaitClose($pid) Local $out = StdoutRead($pid) StdioClose($pid) ConsoleWrite($out); test Check the docs for StdoutRead.
  15. Thanks, setting it in the capabilities did the trick. Fantastic. _WD_LoadWait, perfect. I overlooked it, sorry. It wasn't part of the listed helper functions on the readme 😃 I have a case where I fail to download the image with _WD_DownloadFile, might you know why? It displays fine in the browser. Here is the example: #include "wd_core.au3" #include "wd_helper.au3" $file = 'https://az534923.vo.msecnd.net/image.ashx?guid=59f690b7-0d5d-ef67-5389-9159e28f1034&w=-1&h=-1&rm=2&ac=10&mw=1024&mh=1024' _WD_DownloadFile($file, @ScriptDir & "\test.jpg") Instead of the image the function retrieves the "404 - File or directory not found" response. _InetGet works fine: #include <InetConstants.au3> #include <MsgBoxConstants.au3> #include <WinAPIFiles.au3> $file = 'https://az534923.vo.msecnd.net/image.ashx?guid=59f690b7-0d5d-ef67-5389-9159e28f1034&w=-1&h=-1&rm=2&ac=10&mw=1024&mh=1024' Local $sFilePath = @ScriptDir & "\testInetGet.jpg" Local $hDownload = InetGet($file, $sFilePath, $INET_FORCERELOAD, $INET_DOWNLOADBACKGROUND) Thanks
  16. Hi All, I am very new to the autoit scripting and want to know how to created costume include script example #include "WinHttp.au3" when I am using above one I am getting below error can't open include file "WinHttp.au3".
  17. This is the program folder: As the code in cmd runs good with: I have changed the code to: $iC = 'C:\Program Files\ImageMagick-7.0.9-Q16\compare' instead \convert $iC = 'C:\Program Files\ImageMagick-7.0.9-Q16\compare' $Commandline = "C:\Users\CAIO\Downloads\x.bmp C:\Users\CAIO\Downloads\y.bmp -metric RMSE -subimage-search 2>diff.txt" $D = ShellExecuteWait($iC, $Commandline, "", "", @SW_HIDE) ConsoleWrite("D = "&$D&@CRLF) Now instead receive 1 on console i receive 2, what it means? @markyrocks if you could download imagemagick heres the link: Then just add two image same size on download folder and run the command in cmd "compare C:\Users\CAIO\Downloads\x.bmp C:\Users\CAIO\Downloads\y.bmp -metric RMSE -subimage-search" I have found this comment if it can help in something:
  18. Bc it reads the output file...I'm assuming that the output file is created by whatever program you're using. What does the screen look like? Maybe not do this with the window hidden until it works.
  19. I need run the code by command line to know the % between two images, based on % continue the rest of my code. I dont understand how this code you post could help.
  20. #include <File.au3> #include <Array.au3> _filereadtoarray($filepath,$sReturn) If isarray($sReturn) then  _arraydisplay($sReturn) Else  Exit Endif For $x=1 to ubound($sReturn)-1    if stringinstr($sReturn[$x],"whatever") then    ;do whatever    endif Next ....untested but it really doesn't get any easier than that edit sry edit edit...
  21. #RequireAdmin $iC = 'C:\Program Files\ImageMagick-7.0.9-Q16\convert.exe' $Commandline = "magick compare C:\Users\CAIO\Downloads\x.bmp C:\Users\CAIO\Downloads\y.bmp -metric RMSE -subimage-search 2>diff.tmp" $D = ShellExecuteWait($iC, $Commandline, "", "", @SW_HIDE) ConsoleWrite("D = "&$D&@CRLF) ;; MsgBox(0,"",$D) $Commandline2 = "magick compare C:\Users\CAIO\Downloads\x.bmp C:\Users\CAIO\Downloads\y.bmp -metric RMSE -subimage-search" $Z = RunWait(@ComSpec & " /C " & $iC & $Commandline2 & " > C:\output.txt") ConsoleWrite("Z = "&$Z&@CRLF) Console: D = 1 Z = 1 And i got a blank output.txt 😓
  22. So using _arraydisplay() I get only one instance of any program open. It seems to ignore the specified window title (Changed from [active]). If I focus Notepad 1 it shows the proper handle, then when I focus Notepad 2 it shows that handle as well. But not both instances like I presume it should. Global $aWinList = WinList(WinGetTitle("Notepad.exe")) _arraydisplay($aWinList) My guess is that you're right in the array being out of bounds because it does not find the 2nd one. Using some error checks and the IF ubounds statement it does not proceed through the code.
  23. why do you need to do the comparison in the command prompt can't you just do whatever comparison from the download folder and then do whatever you need to do in the cmd prompt after the fact? maybe this will help as well https://www.autoitscript.com/autoit3/docs/functions/StdoutRead.htm
  24. .tmp also dont worked, about controlgettext wouldnt help, those command are from a software ImageMagick, the commands are to compare and get difference from img, i will use it in a loop to compare many images, and when img found continue, so each ms will cost. Using the commands direclty on cmd everything is working fine 🤔
  25. Sry, use .tmp. they seem to be more friendly if you must use a file. But I apologize for earlier if the info tool shows the text on the window you can get it in controlgettext(). In your script it doesn't show any file read. Once you make the file us fileopen and _readfiletoarray() and sort through it. Use stringinstr() to see if what your looking for is in there. If true then do whatever you have to do to get the data out. Control get text is probably the easier route. If that option is available
  26. Can you post a pic of the error and use _arratdisplay($winlist) and see what's in there. Post that pic too. Check this out. Win active only returns one window. Out of bounds is when an array exceeds the memory that is allocated to it. That's why its critical to use ubound()-1 bc it determines the out of bounds range. The -1 puts you at the last element of the array. If the ubound ($winlist)-1 is only equal to 2 trying to access the 3rd element will return an out of bounds error bc nothing is their and it exceeds the range of the array. Use wingettitle(""). Should return every window on the screen even if its hidden. Just get all the windows and sort through the array. Using a loop.
  1. Load more activity
  • Create New...