Leaderboard
Popular Content
Showing content with the highest reputation on 03/02/2018 in all areas
-
As the WebDriver UDF - Help & Support thread has grown too big, I started a new one. The prior thread can be found here.1 point
-
Version 1.5.0
1,000 downloads
A gui splash screen. Themed after the famous MS Office Suite. Three colours to choose from, Red, Blue and Green. You can change the labels to your own application. Animated side scrolling dots just like MS does. Also bundled with this is the KODA form. So you can open up and see the basic structure of this splash screen.1 point -
So you want something like this? #include <Array.au3> #include <File.au3> #include <FileConstants.au3> Global $aFileList = _FileListToArrayRec(@DesktopDir & "\test123", "*.pdf", _ $FLTAR_FILES+$FLTAR_NOSYSTEM+$FLTAR_NOHIDDEN, _ $FLTAR_RECUR, $FLTAR_FASTSORT, $FLTAR_FULLPATH) If @error = 1 Then Exit ; Display Results ;~ _ArrayDisplay($aFileList, " Results") Global $aRenamePDF For $i = 1 To $aFileList[0] ; Get folder name $aRenamePDF = StringSplit($aFileList[$i],"\") ; Change pdf name to match folder name FileMove($aFileList[$i], @DesktopDir & "\Store PDF Files\" & $aRenamePDF[$aRenamePDF[0] - 1] & ".pdf", 8) Next1 point
-
Send text with Variables into CMD!
Earthshine reacted to Jos for a topic
Neither ... just use runwait... something like this: RunWait(@ComSpec & ' /c Msiexec /I Code42_client.msi CP_ARGS="DEPLOYMENT_URL=https://code42-auth.antas.com:4285&DEPLOYMENT_POLICY_TOKEN=9ef3e3a5-c58b-4300-9898-ebb99edc09a9" CP_SILENT=true /norestart /qn') Use /k in case it doesn't work so the cmd window stays open to see the error. Jos1 point -
rcmaehl, Final paragraph on this page of the Help file: https://www.autoitscript.com/autoit3/docs/function_notes.htm M231 point
-
Webcam Datamatrix Decoding .NET dll Bitmap parameter
Earthshine reacted to LarsJ for a topic
Twice per second. 172,800 times in 24 hours. I'll recommend you to use pure C# code.1 point -
Does it work if you remove the surrounding quotes, like this? FileMove($source & '\' & $pdffile, $dest, 1) If not, then I suggest that you check to value of @error after that line to see if that helps you diagnose the issue.1 point
-
Webcam Datamatrix Decoding .NET dll Bitmap parameter
Earthshine reacted to LarsJ for a topic
The image input parameter can be a problem. Another problem is that the DecodeImage method seems to be returning a list. There is no way to return a list from C# to AutoIt. Only an array. The solution is to create a small wrapper object in C#/VB code to handle the communication between AutoIt and the methods in the C# dll-file. Then you load the C# dll-file in C#/VB code instead of AutoIt code. The wrapper method can be executed in AutoIt with the techniques in Using C# and VB Code in AutoIt or .NET Common Language Runtime. In the wrapper method you can Validate the input parameters from AutoIt before they are passed to the method in the C# dll-file Validate the output from the method in the C# dll-file before it's returned to AutoIt In case the output is a list, convert it to an array before it's returned to AutoIt1 point -
This example processes a million line file. Most of the run time is taken up displaying the results. Opt("WinTitleMatchMode", -2) ;1=start, 2=subStr, 3=exact, 4=advanced, -1 to -4=Nocase Local $sFileName = "AAATestFile.txt" ; ========= Create & Display Example test file ========== If FileExists($sFileName) Then FileDelete($sFileName) Local $str For $i = 1 To 1000000 ; 1,000,000 line file $str &= $i & "/" & ChrW(Random(97, 102, 1)) & ChrW(Random(97, 102, 1)) & ChrW(Random(97, 102, 1)) & ChrW(Random(97, 102, 1)) & ChrW(Random(97, 102, 1)) & @CRLF Next FileWrite($sFileName, $str) Run("notepad.exe " & $sFileName) $hWin1 = WinWait($sFileName, "", 0) WinMove($hWin1, "", 0, 0, @DesktopWidth / 4, @DesktopHeight) WinSetTitle($sFileName, "", "Unaltered File") ; ====== End of Create & Display Example test file ======= Local $sFileContents = FileRead($sFileName) FileDelete($sFileName) FileWrite($sFileName, StringRegExpReplace($sFileContents, '.*(a.*e|e.*a).*\R*', "")) Run("notepad.exe " & $sFileName) $hWin2 = WinWait($sFileName, "", 0) WinMove($hWin2, "", @DesktopWidth / 4, 0, @DesktopWidth / 4, @DesktopHeight)1 point
-
Also: You do need that runwait() in stead of run(). Consider running this with the x64 version of Autoit3 as it looks like you are using a x64 program? Jos1 point
-
Why did you use $file instead of $pdffile?1 point
-
Whoops didn't see that that post, then I suppose @florian2 could try: #include <file.au3> Local $hFileRead = FileOpen("C:\AutomationDevelopers\temp.txt") Local $hFileOpen = FileOpen("C:\AutomationDevelopers\Updated.txt", 2) While 1 $sFileLine = FileReadLine($hFileRead) If @error = -1 Then ExitLoop If StringRegExp($sFileLine, '(?m)(?|^.*?a.*?e.*$|^.*?e.*?a.*$)\R?') Then ConsoleWrite("Remove: " & $sFileLine & @CRLF) ContinueLoop Else ConsoleWrite("Add: " & $sFileLine & @CRLF) FileWrite($hFileOpen, $sFileLine & @CRLF) EndIf WEnd FileClose($hFileRead) FileClose($hFileOpen)1 point
-
Simple 3D Array
Earthshine reacted to JLogan3o13 for a topic
@Randwulf had you submitted to the "search" nightmare you might have come across our forum rules, especially the part on game automation, before posting. Please read them now before posting again - and please let's know go down the "but it was just an example path" To others <snarkiness removed>1 point -
RegeX Help
adityaparakh reacted to mikell for a topic
? #Include <Array.au3> ;$s = "2-3 3-2 4-1 - - 6" $s = "14-3 16-2 13-1 12-3 10-1 12" $a = StringRegExp($s, '(?|(\d+)-(\d+)|\d+(?=$))', 3) ;_ArrayDisplay($a) $n = (UBound($a)-1)/2 ; nb of pairs Local $res[$n][3] For $i = 0 to $n-1 $res[$i][0] = $a[$i*2] ; col 0 = productCode $res[$i][1] = $a[$i*2+1] ; col 1 = quantity Next $res[0][2] = $a[$n*2] ; col 2 = discount _ArrayDisplay($res)1 point -
a tool I use to silently print pdf to the default (or also another) printer is sumatraPDF.exe --> https://www.sumatrapdfreader.org/free-pdf-reader.html You can print without opening the file as simple as something like this: have a look to the Printing options in the command-line arguments page: https://www.sumatrapdfreader.org/docs/Command-line-arguments.html Run('.\SumatraPDF.exe -silent -print-to "PrinterName" ' & $sFilename, "", @SW_HIDE) (you could move the file before printing and print it after the move so it's should not locked by the print process...)1 point
-
Try the following tool http://www.biopdf.com/guide/print_pdf_from_command_line.php and look at the FileListToArray functionality removes While/Wend loop1 point
-
Your FileMove is likely failing because the file is still open in acrord32. Make sure the process is closed before attempting to move the file.1 point
-
Create PDF from your application
BatMan22 reacted to Mannyfresh31 for a topic
My problem has been fixed as BatMan22 suggested downloading all 6 files and putting them in the include folder after renaming them fixed my problem I guess is a bug in the files as melba23 says you can look at this other thread where he states that replacing the files not only fixes the include library but some other internal things thanks to all who tried to help me and to those having problems with your scripts go ahead and download the files.1 point -
Implode or explode your GUI from anywhere on your screen: holding the mouse pressed on the GUI while dragging will resize the GUI preserving it's dimension #include <GuiconstantsEx.au3> #include <WinAPISys.au3> #include <WinAPIGdi.au3> #include <Misc.au3> Opt("GUIResizeMode", 904) $hDLL = DllOpen("user32.dll") OnAutoItExitRegister("On_Exit") Global $iWidth = 380, $iHeight = 180 Global $hGUI = GUICreate("X", $iWidth, $iHeight, -1, -1) GUISetBkColor(0X5c6e8c, $hGUI) $iWidth = _WinAPI_GetClientWidth($hGUI) $iHeight = _WinAPI_GetClientHeight($hGUI) $ButtonWidth = 40 $ButtonHeight = 20 $idnew = GUICtrlCreateButton("Change Dimension", ($iWidth / 2) - (3 * $ButtonWidth / 2), ($iHeight / 2) - (4 * $ButtonHeight / 2), 3 * $ButtonWidth, $ButtonHeight) $idCenter = GUICtrlCreateButton("x", ($iWidth / 2) - ($ButtonWidth / 2), ($iHeight / 2) - ($ButtonHeight / 2), $ButtonWidth, $ButtonHeight) GUICtrlSetFont($idCenter, 10, 200) Global $PM = _WinAPI_MonitorFromWindow($hGUI) DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $hGUI, "int", 500, "long", 0x00040010) GUISetState() $aGPos = WinGetPos($hGUI) $iWidth = $aGPos[2] $iHeight = $aGPos[3] While 1 Switch GUIGetMsg() Case $GUI_EVENT_close Exit Case $idnew $iWidth = Random(150, 550, 1) $iHeight = Random(150, 550, 1) _NewDimension($iWidth, $iHeight) Case $idCenter _CenterToScreen() Case $GUI_EVENT_PRIMARYDOWN OnDrag() EndSwitch WEnd Func OnDrag() Local $aPos, $iRoll, $X, $Y, $width, $height, $PH, $PW = 0, $aCurInfo = GUIGetCursorInfo($hGUI) If $aCurInfo[4] <> 0 Then Return ; Mouse is over a control Local $aGPos = WinGetPos($hGUI) Local $aMPos = MouseGetPos() Local $MON = _WinAPI_MonitorFromWindow($hGUI) Local $aMax = MonitorGetRect($MON) If $PM <> $MON Then $PM = $MON Return _CenterToScreen(1) EndIf If _SnapToScreen($aGPos, $aMax) Then Return WinMove($hGUI, "", $aGPos[0], $aGPos[1], $aGPos[2], $aGPos[3]) $width = $aGPos[2] $height = $aGPos[3] While _IsPressed("01", $hDLL) $aPos = MouseGetPos() $iRoll = (($aMPos[1] - $aPos[1]) - ($aMPos[0] - $aPos[0])) * 100 / 50 $height = ($aGPos[3] / $aGPos[2]) * ($aGPos[2] + $iRoll) If $height < $iHeight Then ExitLoop If $height >= $aMax[3] Then Do $iRoll -= 1 $height = Round(($aGPos[3] / $aGPos[2]) * ($aGPos[2] + $iRoll)) Until $height <= $aMax[3] EndIf $width = ($aGPos[2] / $aGPos[3]) * $height If $width >= ($aMax[2] - $aMax[0]) Then Do $iRoll -= 1 $height = Round(($aGPos[3] / $aGPos[2]) * ($aGPos[2] + $iRoll)) $width = ($aGPos[2] / $aGPos[3]) * $height Until $width <= ($aMax[2] - $aMax[0]) EndIf ;Store as Previous Width & Height $PW = $width $PH = $height $X = Round((($aGPos[2] / 2) + $aGPos[0]) - ($width / 2)) $Y = Round((($aGPos[3] / 2) + $aGPos[1]) - ($height / 2)) If $X <= $aMax[0] Then $X = $aMax[0] ElseIf ($X + $width) >= $aMax[2] Then $X = ($aMax[2] - $width) EndIf If $Y <= $aMax[1] Then $Y = $aMax[1] ElseIf ($Y + $height) >= $aMax[3] Then $Y = ($aMax[3] - $height) EndIf WinMove($hGUI, "", $X, $Y, $width, $height) Sleep(20) WEnd If $height < $iHeight And $PW <> 0 Then $tRect = _WinAPI_GetWindowRect($hGUI) Return WinMove($hGUI, "", (($PW / 2) + DllStructGetData($tRect, "Left")) - ($iWidth / 2), Ceiling(($PH / 2) + DllStructGetData($tRect, "Top")) - ($iHeight / 2), $iWidth, $iHeight) EndIf EndFunc ;==>OnDrag Func _SnapToScreen(ByRef $aGPos, ByRef $aMax) ; Snap the gui back to its full view when moved off screen Local $Move = False If $aGPos[0] < $aMax[0] Then $aGPos[0] = $aMax[0] $Move = True ElseIf ($aGPos[0] + $aGPos[2]) > $aMax[2] Then $aGPos[0] = ($aMax[2] - $aGPos[2]) $Move = True EndIf If $aGPos[1] < $aMax[1] Then $aGPos[1] = $aMax[1] $Move = True ElseIf ($aGPos[1] + $aGPos[3]) > $aMax[3] Then $aGPos[1] = ($aMax[3] - $aGPos[3]) $Move = True EndIf If $Move Then Return True EndFunc ;==>_SnapToScreen Func _NewDimension($width, $height) Local $aPos = WinGetPos($hGUI) Return WinMove($hGUI, "", ($aPos[2] / 2) + $aPos[0] - ($width / 2), ($aPos[3] / 2) + $aPos[1] - ($height / 2), $width, $height) EndFunc ;==>_NewDimension Func _CenterToScreen($Move =False) Local $aMax = MonitorGetRect(_WinAPI_MonitorFromWindow($hGUI)) ; Center & Resize the gui dimension if off screen Local $aGPos = WinGetPos($hGUI) Local $check = $aGPos[2] If $aGPos[3] > ($aMax[3] - $aMax[1]) Then $aGPos[2] = Round(($aGPos[2] / $aGPos[3]) * ($aMax[3] - $aMax[1])) ;New Width $aGPos[3] = $aMax[3] - $aMax[1] ;New Height EndIf If $aGPos[2] > ($aMax[2] - $aMax[0]) Then $aGPos[3] = Round(($aGPos[3] / $aGPos[2]) * ($aMax[2] - $aMax[0])) ;New Height $aGPos[2] = $aMax[2] - $aMax[0] ;New Width EndIf If $Move and $check = $aGPos[2] then Return Return WinMove($hGUI, "", (($aMax[2] + $aMax[0]) / 2) - ($aGPos[2] / 2), (($aMax[1] + $aMax[3]) / 2) - ($aGPos[3] / 2), $aGPos[2], $aGPos[3]) EndFunc ;==>_CenterToScreen Func MonitorGetRect($hMonitor) Local $aData = _WinAPI_GetMonitorInfo($hMonitor) Local $s = DllStructGetData($aData[1], 1) & ',' & DllStructGetData($aData[1], 2) & ',' & DllStructGetData($aData[1], 3) & ',' & DllStructGetData($aData[1], 4) Local $a = StringSplit($s, ',', 2) Return $a EndFunc ;==>MonitorGetRect Func On_Exit() DllClose($hDLL) EndFunc ;==>On_Exit1 point
-
Monitoring for a custom message in OnEvent mode?
Bilgus reacted to shastaman2 for a topic
Voila. Many thanks BrewMan. I thought that GUISetOnEvent was specific and required for using OnEvent mode and GUIRegisterMsg was specific and required for MessageLoop mode. No examples mixed the two. First future users, here's the solution I'm using: #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; Register for a Message ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Local $lpString = "My_MSG" Local $RT = DllCall("User32.dll","int","RegisterWindowMessageW","WSTR",$lpString) if @error Or $RT[0] = 0 Then SetError(1,0,0) Exit 1 EndIf Local $MSG_ID = $RT[0] Local $MSG_NAME = $RT[1] MsgBox (0, "Receiver", "Registered message: " & $MSG_NAME & " (" & $MSG_ID & ")" & @CRLF) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; Create a blank GUI which is hidden (I'm only making it to receive messages) ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Opt("GUIOnEventMode", 1) ; Change to OnEvent mode $mainwindow = GUICreate("Receiver", 200, 100) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; Register the GUI to do something when MSG_ID is received ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; GUIRegisterMsg($MSG_ID, "ReceivedProc") ;; GUI loop While 1 If Not (WinWait("My App","",2)) Then ThrowError("App window not found") Endif WEnd Exit 0 ;; Function to call when the message is received Func ReceivedProc ($hWnd,$Msg,$wParam,$lParam) MsgBox (0, "Receiver", "Closed GUI") Exit EndFunc Func ThrowError ($msg) MsgBox (0, "Failed", $msg) Exit EndFunc1 point