-
Posts
398 -
Joined
-
Last visited
-
Days Won
1
Everything posted by aa2zz6
-
Restarting multiple processes
aa2zz6 replied to StickyChopstix's topic in AutoIt General Help and Support
If he has admin access couldn't he stop the service in Services and start the service at a later time? -
Restarting multiple processes
aa2zz6 replied to StickyChopstix's topic in AutoIt General Help and Support
Maybe this link answers ur question: -
Download and upload on google drive
aa2zz6 replied to Belini's topic in AutoIt General Help and Support
Have you tried using the google drive API? -
I don't mean to be rude but if you don't want to learn from the example and links I provided then I won't be able to help you ^^
-
It looks like your syntax and structure is not correct. What kind of program are you trying to automate? Your current script isn't setting an active screen to write to and because it's in a while loop it'll write for ever. I'll post an example script that you can take a look at. I would recommend using the WinActive function to activate the desired screen before using send("...") to write. Example script: _IsPressed Codes > https://www.autoitscript.com/autoit3/docs/libfunctions/_IsPressed.htm ; #include <Misc.au3> #include <MsgBoxConstants.au3> HotKeySet("{F5}", "Terminate") Local $hDLL = DllOpen("user32.dll") While 1 If _IsPressed("10", $hDLL) Then ; This is the Shift key << press to hold ConsoleWrite("_IsPressed - Shift Key was pressed." & @CRLF) Run("notepad.exe") WinWaitActive("Untitled - Notepad") Send("This is some text.") ; Wait until key is released. While _IsPressed("10", $hDLL) WEnd ConsoleWrite("_IsPressed - Shift Key was released." & @CRLF) ElseIf _IsPressed("1B", $hDLL) Then MsgBox($MB_SYSTEMMODAL, "_IsPressed", "The Esc Key was pressed, therefore we will close the application.") ExitLoop EndIf Sleep(250) WEnd DllClose($hDLL) Func Terminate() Exit EndFunc ;==>Terminate
-
Consider reviewing this posting below and see if your solution is there. I would also recommend reading how to use _IsPressed and Send("") functions. _IsPressed > https://www.autoitscript.com/autoit3/docs/libfunctions/_IsPressed.htm send() > https://www.autoitscript.com/autoit3/docs/functions/Send.htm
-
GDIPlus Invert Color on Dimp Forms
aa2zz6 replied to aa2zz6's topic in AutoIt General Help and Support
Yes -
I am trying to invert color on our Dimp forms but I am having trouble using _GDIPlus_BitmapCreateFromFile to select a .jpg from our archive folder. I'll provide the working script that's able to capture a section of the screen but _GDIPlus_BitmapCreateFromFile but when I try to replace capture with CreateFromFile and local $iW & $iH with ImageGetWidth & ImageGetHeight the script gets hung up. ;$hBitmap = _GDIPlus_BitmapCreateFromFile(@ScriptDir & "\328 Main Street.jpg") ; create a bitmap object from file ;$iW = _GDIPlus_ImageGetWidth($hBitmap) ;$iH = _GDIPlus_ImageGetHeight($hBitmap) #include <WinAPI.au3> #include <GDIPlus.au3> #include <GuiConstants.au3> #include <WindowsConstants.au3> HotKeySet("{Esc}", "_Exit") Opt("GUIOnEventMode", 1);0=disabled, 1=OnEvent mode enabled ; replace with _GDIPlus_ImageGetWidth & _GDIPlus_ImageGetHeight Local $iW = 400, $iH = 300 $hGui = GUICreate("Invert Colours Example", $iW, $iH) GUISetOnEvent(-3, "_Exit") GUISetState() _GDIPlus_Startup() ;$hBitmap = _GDIPlus_BitmapCreateFromFile(@ScriptDir & "\328 Main Street.jpg") ; create a bitmap object from file ;$iW = _GDIPlus_ImageGetWidth($hBitmap) ;$iH = _GDIPlus_ImageGetHeight($hBitmap) ;ConsoleWrite("$iX = " & $iX & " $iY = " & $iY & @CRLF) $hGraphicGUI = _GDIPlus_GraphicsCreateFromHWND($hGui) $hBMPBuff = _GDIPlus_BitmapCreateFromGraphics($iW, $iH, $hGraphicGUI) $hGraphic = _GDIPlus_ImageGetGraphicsContext($hBMPBuff) $hdc = _WinAPI_GetDC(0) $hcdc = _WinAPI_CreateCompatibleDC($hdc) $hcbmp = _WinAPI_CreateCompatibleBitmap($hdc, $iW, $iH) _WinAPI_SelectObject($hcdc, $hcbmp) _WinAPI_BitBlt($hcdc, 0, 0, $iW, $iH, $hdc, 0, 0, $NOTSRCERASE) $gc = _GDIPlus_GraphicsCreateFromHDC($hdc) $bmp = _GDIPlus_BitmapCreateFromHBITMAP($hcbmp) _GDIPlus_GraphicsDrawImage($hGraphic, $bmp, 0, 0) $sFileName = @DesktopDir & "\results.jpg" _GDIPlus_ImageSaveToFile($bmp, $sFileName) ;ShellExecute(@DesktopDir & "\328 Main Street_New.jpg") _GDIPlus_GraphicsDispose($gc) _GDIPlus_ImageDispose($bmp) _WinAPI_DeleteObject($hcbmp) GUIRegisterMsg(0xF, "MY_PAINT"); Register PAINT-Event 0x000F = $WM_PAINT (WindowsConstants.au3) GUIRegisterMsg(0x85, "MY_PAINT"); $WM_NCPAINT = 0x0085 (WindowsConstants.au3)Restore after Minimize. _GDIPlus_GraphicsDrawImage($hGraphicGUI, $hBMPBuff, 0, 0) While 1 Sleep(100) WEnd Func _Exit() _GDIPlus_GraphicsDispose($hGraphic) _GDIPlus_GraphicsDispose($hGraphicGUI) _WinAPI_DeleteObject($hBMPBuff) _WinAPI_ReleaseDC(0, $hdc) _WinAPI_DeleteDC($hcdc) _WinAPI_RedrawWindow(0, 0, 0, BitOR($RDW_INVALIDATE, $RDW_UPDATENOW, $RDW_ALLCHILDREN)) _GDIPlus_Shutdown() Exit EndFunc ;==>_Exit Func MY_PAINT($hWnd, $msg, $wParam, $lParam) ; Check, if the GUI with the Graphic should be repainted _GDIPlus_GraphicsDrawImage($hGraphicGUI, $hBMPBuff, 0, 0) _WinAPI_RedrawWindow($hGui, "", "", BitOR($RDW_INVALIDATE, $RDW_UPDATENOW, $RDW_FRAME)); , $RDW_ALLCHILDREN Return $GUI_RUNDEFMSG EndFunc ;==>MY_PAINT
-
Incredible I wouldn't of figured that out.
-
Yes, that's correct.
-
Hi, I am having trouble understanding this function. I am using the _FileListToArrayRec function and it's listing the pdf's in an _ArrayDisplay but it's not able to rewrite the pdf's to another file like the _FileListToArray function before. #include <FileConstants.au3> #include <MsgBoxConstants.au3> #include <WinAPIFiles.au3> #include <File.au3> #include <Array.au3> Global $aArray = _FileListToArrayRec("C:\Users\jnmiller\Desktop\test123", "*.pdf", _ $FLTAR_FILES+$FLTAR_NOSYSTEM+$FLTAR_NOHIDDEN, _ $FLTAR_RECUR, $FLTAR_FASTSORT, $FLTAR_FULLPATH) ; Display Results ; _ArrayDisplay($aArray, " Results") ;$FileList = _FileListToArray("C:\Users\jnmiller\Desktop\test123") If @error = 1 Then ;MsgBox(0, "", "No Files\Folders Found.") Exit EndIf For $i = 1 To $aArray[0] ;MsgBox(0, $i, $FileList[$i]) ; Find pdf's in folders ;$sFileOld = "C:\Users\jnmiller\Desktop\test123\" & "\*.pdf*" ; Get folder name $renamePDF = StringSplit(@ScriptDir,"\",0) ; Change pdf name to match folder name FileMove($aArray, $renamePDF[$renamePDF[0]] & ".pdf") ; Create variable for new dest Local $newDest = "C:\Users\jnmiller\Desktop\Store PDF Files" ; Move pdf's to NEO Service Line Scans FileMove($renamePDF[$renamePDF[0]] & ".pdf",$newDest,0) Next
-
I am trying to rename PDF's inside our 2015 Archive folder but I'm not sure how to access each sub folder. #include <FileConstants.au3> #include <MsgBoxConstants.au3> #include <WinAPIFiles.au3> #include <File.au3> $FileList = _FileListToArray("C:\Users\jnmiller\Desktop\2015 Archive") If @error = 1 Then MsgBox(0, "", "No Files\Folders Found.") Exit EndIf For $i = 1 To $FileList[0] MsgBox(0, $i, $FileList[$i]) ; Find pdf's in folders $sFileOld = "C:\Users\jnmiller\Desktop\2015 Archive\" & "\*.pdf*" ; Get folder name $renamePDF = StringSplit(@ScriptDir,"\",0) ; Change pdf name to match folder name FileMove($sFileOld, $renamePDF[$renamePDF[0]] & ".pdf") ; Create variable for new dest Local $newDest = "C:\Users\jnmiller\Desktop\Store PDF Files" ; Move pdf's to NEO Service Line Scans FileMove($renamePDF[$renamePDF[0]] & ".pdf",$newDest,0) Next
-
Hello tiye0405, I've attached the imagesearch files below. Follow this video so you install the dll into your system. For the example script above I would move them to this folder and include this piece of code at the top. Let me know if you don't get it working. #include <ImageSearch2015.au3> ImageSearch2015.zip
-
What's the best function(s) to use in order to replace 3000+ PDF names to mimic the folder name? Folder Structure: Mapping Archive > 2017 2453 Back Orville > SLO.PDF .... .... 2016 5432 Chestnut Ridge > SLO.PDF .... .... 2015 2014 2013
-
AutoitX MouseClickDrag function in C++
aa2zz6 replied to waterstoom's topic in AutoItX Help and Support
If you're trying to relocate the position of a program wouldn't the WinMove function be more beneficial? https://www.autoitscript.com/autoit3/docs/functions/WinMove.htm -
I would definitely use a If EndIf statement if the pixel is found ^^ $location = PixelSearch (137, 321, 540, 683,0xEEA200, 2, 1) If IsArray ($location) = 1 Then MouseClick ('left', $location[0], $location[1], 1, 0) EndIf References: https://www.autoitscript.com/autoit3/docs/keywords/IfElseEndIf.htm https://www.autoitscript.com/autoit3/docs/keywords/Do.htm https://www.autoitscript.com/autoit3/docs/functions/PixelSearch.htm https://www.autoitscript.com/autoit3/docs/functions/WinActivate.htm
-
Bingo! I would possibly look at troubleshooting with the winactivate function and once it works I would imagine the control click should be a walk in the park . 1) Winactivate - Set the Application Window above the folder. ActiveWindow() Func ActiveWindow() $hWnd1 = WinGetHandle("[CLASS: PUT CLASS ID HERE ]") If IsHWnd($hWnd1) Then WinActivate($hWnd1) EndIf EndFunc ;==>ActiveWindow 2) Once the application is activated and it's above every window a controlclick to press the btn should work. ControlClick Sends a mouse click command to a given control. ControlClick ( "title", "text", controlID [, button = "left" [, clicks = 1 [, x [, y]]]] ) Parameters title The title/hWnd/class of the window to access. See Title special definition. text The text of the window to access. See Text special definition. controlID The control to interact with. See Controls. button [optional] The button to click, "left", "right", "middle", "main", "menu", "primary", "secondary". Default is the left button. clicks [optional] The number of times to click the mouse. Default is 1. x [optional] The x position to click within the control. Default is center. y [optional] The y position to click within the control. Default is center.
-
I'm wondering if the winactivate is activating that application. Can u place a folder on top of the application, run the script and see if it's pushing the folder behind it? Local $hWnd = WinWait("CLASS:wxWindowNR", "", 5) ;Activate Window WinActivate ($hWnd)
-
I dunno if this will help but here's an example I used to help someone last year with clicking a btn ^^ Posted December 21, 2016 (edited) · Report post Here you go buddy. Works on win7 Edit: The ID changes when the application is opened.. does someone know why the ID changes? #RequireAdmin ; must include when installing Example() Func Example() Local $hWnd = WinWait("[CLASS:TWizardForm]", "", 10) ; use AutoIt v3 Window Info tool ; located in the AutoIt folder. WinActivate($hWnd) ; WinActivate sets Setup - FreeOCR as an active screen ;Notes: ;ControlClick("title", "text", controlID[, button = "left"[, clicks = 1[, x[, y]]]]) ; title =>> $hWnd = WinWait("[CLASS:TWizardForm] ; "text" =>> "&Next >" ; controlID =>> 329210 ControlClick($hWnd, "&Next >", 329210) ; EndFunc ;==>Example Edited December 21, 2016 by aa2zz6 One last final thought :|
-
Maybe include some error handling in your code: If @error Then MsgBox(16, "Failure", "Process broke here..")
-
I am trying to combine multiple lines in a text file but I can't seem to get it quite right. I tried using the _FileReadToArray to load in everything from the text document and then I tried using the _FileWriteFromArray to rewrite it as 1 string and replace the original document but it doesn't seem to let me replace the original and when I create a variable to hold the results from the $array it doesn't post anything. Script will do nothing. Text file: Line 1: Loading mapping software from the following directory: Line 2: C:\EIS\EIS\Mapping Workspace - Office Use Line 3: ... Line 4: ... ------------------- Results ------------------------------ Combine both to look like: Loading mapping software from the following directory: C:\EIS\EIS\Mapping Workspace - Office Use #include <file.au3> Global $array If _FileReadToArray(@scriptdir & '\ArcGIS_Desktop.txt', $array) Then For $i = 1 To $array[0] ;MsgBox(0, "ArcGIS Software", $array[$i]) ConsoleWrite($array[$i] & " ") _FileWriteFromArray(@scriptdir & '\ArcGIS_Desktop.txt', $array,1) Next Else MsgBox(0, "Error", "Error from Function") EndIf Exit
-
I am trying to launch a series of programs based off a few checked checkbox's but I can't get the button to launch anything. I tried using the GUICtrlCreateButton example in the help file but that won't even open notepad. Am I setting this up incorrectly? https://www.autoitscript.com/autoit3/docs/functions/GUICtrlCreateButton.htm Script - #include <AutoItConstants.au3> #include <Date.au3> #include <GUIConstantsEx.au3> #include <GuiRichEdit.au3> #include <GUIImageList.au3> #include <WindowsConstants.au3> Opt("GUIOnEventMode", 1) #Region ### START Koda GUI section ### Form= Global $hGUI = GUICreate("Form", 500, 500, @DesktopWidth / 2 - 500 / 2, @DesktopHeight / 2 - 700 / 2, _ $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS) GUISetOnEvent($GUI_EVENT_CLOSE, "Form1Close") Global $label = GUICtrlCreateLabel("Esri Products", 35, 10) ; first cell 70 width Global $Checkbox1 = GUICtrlCreateCheckbox("ArcGIS Desktop", 35, 25, 97, 17) Global $Checkbox2 = GUICtrlCreateCheckbox("ArcGIS Catalog", 35, 45, 97, 17) Global $Checkbox3 = GUICtrlCreateCheckbox("ArcGIS PRO", 35, 65, 97, 17) Global $LoadSoftware = GUICtrlCreateButton("Launch", 30, 200, 85, 25) Global $Save = GUICtrlCreateButton("Save", 30, 95, 75, 25, 0) GUICtrlSetOnEvent(-1, "SaveClick") Global $Load = GUICtrlCreateButton("Load", 30, 130, 75, 25, 0) GUICtrlSetOnEvent(-1, "LoadClick") Global $Clear = GUICtrlCreateButton("Clear", 30, 165, 75, 25, 0) GUICtrlSetOnEvent(-1, "ClearClick") Global $log = GUICtrlCreateEdit("", 20, 285, 460, 200, BitOR($ES_WANTRETURN, $ES_READONLY, $ES_AUTOVSCROLL, $WS_VSCROLL)) GUICtrlSetFont($log, 12, 800, "verdana") ;Change Font Size to 12 GUICtrlSetBkColor($log, 0xFFFFFF) GUICtrlSetColor($log, $COLOR_Green) GUICtrlSetResizing(-1, 802) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 Sleep(100) Switch GUIGetMsg() Case $GUI_EVENT_CLOSE, $idClose ExitLoop Case $LoadSoftware If IsChecked($Checkbox1) Then GUICtrlSetData($log, _NowTime() & " Loading ArcGIS Desktop.." & @CRLF, 1) Run("notepad.exe", "", @SW_SHOWMAXIMIZED) ;"C:\EIS\EIS\eis shape\MAP WORKSPACE - Office Use.mxd" Else MsgBox($MB_SYSTEMMODAL, "", " Unable to locate file path..", 0, $hGUI) EndIf If IsChecked($Checkbox2) Then GUICtrlSetData($log, _NowTime() & " Loading ArcGIS Catalog.." & @CRLF, 1) Run("C:\Program Files (x86)\ArcGIS\Desktop10.5\bin", "", @SW_SHOWMAXIMIZED) Else MsgBox($MB_SYSTEMMODAL, "", " Unable to locate file path..", 0, $hGUI) EndIf If IsChecked($Checkbox3) Then GUICtrlSetData($log, _NowTime() & " Loading ArcGIS Pro.." & @CRLF, 1) Run("C:\EIS\EIS\eis shape\ArcGIS Pro Workspace.aprx", "", @SW_SHOWMAXIMIZED) Else MsgBox($MB_SYSTEMMODAL, "", " Unable to locate file path..", 0, $hGUI) EndIf EndSwitch WEnd Func ClearClick() SetCheckedState($Checkbox1, 0) SetCheckedState($Checkbox2, 0) SetCheckedState($Checkbox3, 0) EndFunc ;==>ClearClick Func Form1Close() Exit EndFunc ;==>Form1Close Func LoadClick() SetCheckedState($Checkbox1, IniRead(@ScriptDir & "\cktest.ini", "checkboxes", "Checkbox1", False)) SetCheckedState($Checkbox2, IniRead(@ScriptDir & "\cktest.ini", "checkboxes", "Checkbox2", False)) SetCheckedState($Checkbox3, IniRead(@ScriptDir & "\cktest.ini", "checkboxes", "Checkbox3", False)) EndFunc ;==>LoadClick Func SaveClick() IniWrite(@ScriptDir & "\cktest.ini", "checkboxes", "Checkbox1", IsChecked($Checkbox1)) IniWrite(@ScriptDir & "\cktest.ini", "checkboxes", "Checkbox2", IsChecked($Checkbox2)) IniWrite(@ScriptDir & "\cktest.ini", "checkboxes", "Checkbox3", IsChecked($Checkbox3)) EndFunc ;==>SaveClick ; =============================================================================================================================== ; SetChecked State : Set checked state of Checkbox or Radio button ; =============================================================================================================================== Func SetCheckedState($nCtrl, $iState) If $iState > 0 Then GUICtrlSetState($nCtrl, $GUI_CHECKED) If $nCtrl = 4 Then GUICtrlSetData($log, _NowTime() & " ArcGIS Desktop is checked" & @CRLF, 1) EndIf If $nCtrl = 5 Then GUICtrlSetData($log, _NowTime() & " ArcGIS Catalog is checked" & @CRLF, 1) EndIf If $nCtrl = 6 Then GUICtrlSetData($log, _NowTime() & " ArcGIS PRO is checked" & @CRLF, 1) EndIf Else GUICtrlSetState($nCtrl, $GUI_UNCHECKED) EndIf EndFunc ;==>SetCheckedState ; =============================================================================================================================== ; IsChecked :Get checked state of Checkbox or Radio button ; =============================================================================================================================== Func IsChecked($nCtrl) If BitAND(GUICtrlRead($nCtrl), $GUI_CHECKED) = $GUI_CHECKED Then Return 1 Return 0 EndFunc ;==>IsChecked