Jump to content

drbyte

Active Members
  • Posts

    44
  • Joined

  • Last visited

Everything posted by drbyte

  1. Hello Jos, It also works on my pc at work (W10-X64) Thnx !!๐Ÿ™‚
  2. Jos, I did a quick check on mij home computer (W7-x64, with also the same error), and used the beta version Autoit3Wrapper.au3 No errors, it worked perfect! Next week (Tuesday) i'm going to check the beta version on my pc at work, where i did the testing today. I let you know! Thnx a lot !!
  3. Thank you Jos, I will wait for your answer/solution๐Ÿ™‚
  4. Sorry Jos........ ๐Ÿ™‚ test3.au3
  5. Below the source code. #region --- Au3Recorder generated code Start (v3.3.9.5 KeyboardLayout=00020409) --- #region --- Internal functions Au3Recorder Start --- Func _Au3RecordSetup() Opt('WinWaitDelay',100) Opt('WinDetectHiddenText',1) Opt('MouseCoordMode',0) Local $aResult = DllCall('User32.dll', 'int', 'GetKeyboardLayoutNameW', 'wstr', '') If $aResult[1] <> '00020409' Then MsgBox(64, 'Warning', 'Recording has been done under a different Keyboard layout' & @CRLF & '(00020409->' & $aResult[1] & ')') EndIf EndFunc Func _WinWaitActivate($title,$text,$timeout=0) WinWait($title,$text,$timeout) If Not WinActive($title,$text) Then WinActivate($title,$text) WinWaitActive($title,$text,$timeout) EndFunc _AU3RecordSetup() #endregion --- Internal functions Au3Recorder End --- _WinWaitActivate("Program Manager","") MouseClick("left",371,1058,1) _WinWaitActivate("Map1 - Excel","") MouseClick("left",196,327,1) Send("123{ENTER}") Sleep (500) Send("456{ENTER}") Sleep (500) Send("={UP}{+}") Sleep(750) Send("{UP}{UP}{ENTER}") #endregion --- Au3Recorder generated code End ---
  6. Hello all, I started again after a long time to use Autoit, installed version autoit-v3.3.14.5. When i press Build, i get the error below. How can i solve this? Running on Windows 10-64 bit. >"C:\Program Files (x86)\AutoIt3\SciTE\..\AutoIt3.exe" "C:\Program Files (x86)\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.au3" /Prod /AU3check /in "C:\AutoIt\test3.au3" +>11:40:24 Starting AutoIt3Wrapper (21.316.1639.1) from:SciTE.exe (4.4.6.0) Keyboard:00020409 OS:WIN_10/2009 CPU:X64 OS:X64 Environment(Language:0413) CodePage:0 utf8.auto.check:4 +> SciTEDir => C:\Program Files (x86)\AutoIt3\SciTE UserDir => C:\Users\username\AppData\Local\AutoIt v3\SciTE\AutoIt3Wrapper SCITE_USERHOME => C:\Users\username\AppData\Local\AutoIt v3\SciTE !Main script C:\AutoIt\test3.au3 contains Unicode characters so copy for processing to C:\Temp\AutoIt3WrapperRunTmpFiles\test3.au3 !$ScriptFileName = C:\AutoIt\test3.au3 $nScriptFileName = C:\Temp\AutoIt3WrapperRunTmpFiles\test3.au3 >Running AU3Check (3.3.14.5) from:C:\Program Files (x86)\AutoIt3 input:C:\AutoIt\test3.au3 Error : couldn't open input file: !>11:40:24 AU3Check ended. Press F4 to jump to next error.rc:3 +>11:40:24 AutoIt3Wrapper Finished. >Exit code: 0 Time: 0.7446
  7. I took a quick look, but at this moment i can't spend much time on it. (deadline on some other projects....) I will change the QuickPDF_Examples.au3 to open other pdf file's.
  8. @Jos i run indeed an older version of AutoIt3, version 3.3.0. I wil upgrade to the latest version, and see if this helps.
  9. I added the QuickPDF.au3 to the include directory and i ran the QuickPDF_Examples.au3. At that moment i get a lot of errors of missing several .au3 files. i run SciTE Version 3.3.0 Mar 30 2013 17:50:01 Below the error log >"I:\Data\Autoit\SciTe\AutoIt3Wrapper\AutoIt3Wrapper.exe" /run /prod /ErrorStdOut /in "I:\Data\Autoit private\zz_projects\QuickPDF_Examples.au3" /UserParams +>18:53:45 Starting AutoIt3Wrapper v.2.1.2.9 Environment(Language:0409 Keyboard:00020409 OS:WIN_7/Service Pack 1 CPU:X64 OS:X64) >Running AU3Check (1.54.22.0) from:I:\Data\Autoit I:\Data\Autoit private\1_include\QuickPDF.au3(7,10) : ERROR: can't open include file <MsgBoxConstants.au3>. #include <MsgBoxConstants.au3> ~~~~~~~~~^ I:\Data\Autoit private\1_include\QuickPDF.au3(10,10) : ERROR: can't open include file <WinAPIFiles.au3>. #include <WinAPIFiles.au3> ~~~~~~~~~^ I:\Data\Autoit private\1_include\QuickPDF.au3(350,26) : WARNING: $MB_SYSTEMMODAL: possibly used before declaration. MsgBox($MB_SYSTEMMODAL, ~~~~~~~~~~~~~~~~~~~~~~^ I:\Data\Autoit private\1_include\QuickPDF.au3(607,101) : ERROR: syntax error Func _QPDF_FileSplitEachPage($sPDF_FileFullPath, $sPDF_Password = '', $sDestinationDir = @ScriptDir & ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ I:\Data\Autoit private\1_include\QuickPDF.au3(607,138) : ERROR: _QPDF_FileSplitEachPage() called by a previous line with 3 arg(s). Max = 0. First previous line calling this Func is 426. Func _QPDF_FileSplitEachPage($sPDF_FileFullPath, $sPDF_Password = '', $sDestinationDir = @ScriptDir & '\Extracted', $iNumberOfDigits = 3) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ I:\Data\Autoit private\1_include\QuickPDF.au3(619,106) : ERROR: syntax error $sPDF_Destination = $sDestinationDir & '\' & StringRegExp($sPDF_FileFullPath, '(?i).*\\(.*?)\.pdf', 3)[ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ I:\Data\Autoit private\1_include\QuickPDF.au3(619,170) : WARNING: $iNumberOfDigits: possibly used before declaration. $sPDF_Destination = $sDestinationDir & '\' & StringRegExp($sPDF_FileFullPath, '(?i).*\\(.*?)\.pdf', 3)[0] & '_p' & __QPDF_AddLeadingZeros(String($n), $iNumberOfDigits) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ I:\Data\Autoit private\1_include\QuickPDF.au3(774,36) : WARNING: $MB_OK: possibly used before declaration. MsgBox($MB_SYSTEMMODAL + $MB_OK, ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ I:\Data\Autoit private\1_include\QuickPDF.au3(350,26) : ERROR: $MB_SYSTEMMODAL: undeclared global variable. MsgBox($MB_SYSTEMMODAL, ~~~~~~~~~~~~~~~~~~~~~~^ I:\Data\Autoit private\1_include\QuickPDF.au3(619,170) : ERROR: $iNumberOfDigits: undeclared global variable. $sPDF_Destination = $sDestinationDir & '\' & StringRegExp($sPDF_FileFullPath, '(?i).*\\(.*?)\.pdf', 3)[0] & '_p' & __QPDF_AddLeadingZeros(String($n), $iNumberOfDigits) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ I:\Data\Autoit private\1_include\QuickPDF.au3(774,36) : ERROR: $MB_OK: undeclared global variable. MsgBox($MB_SYSTEMMODAL + $MB_OK, ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ I:\Data\Autoit private\1_include\QuickPDF.au3(423,46) : ERROR: _WinAPI_FileInUse(): undefined function. While _WinAPI_FileInUse($sA5_UpperAndBottom) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ I:\Data\Autoit private\zz_projects\QuickPDF_Examples.au3 - 9 error(s), 3 warning(s) !>18:53:45 AU3Check ended. Press F4 to jump to next error.rc:2 >Exit code: 2 Time: 0.354
  10. @mLipok, Excuses for the late reply..... I added the QuickPDF.au3 to the include directory and i ran the QuickPDF_Examples.au3. At that moment i get a lot of errors of missing several .au3 files.
  11. Hello all, I have to print a lot pdf labels during a day at work. One of our customers delivers them as a pdf file on a single A4 page. Every time when i need to print a specific label, i need to do the handling below to print the selected label to our Dymo printer. Can this be automated in a simple way? 1. Zoom opened pdf to 350% 2. Resize the window to fit the label 3. Select print 4. Choose printer 5. Select properties 6. Select left roll 7. Select the correct label size 8. Select current view 9. Press print...... If found the code below in the forum, is this, with some adjustments of course usable? (Thanks to M23) #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> ; Install a custom error handler Global $oMyError = ObjEvent("AutoIt.Error","_ComErrFunc") Global $iGUIWidth = 800, $iGUIHeight = 570, $fResized = False _Show_PDF() Func _Show_PDF() ; Get file to display Local $sFile = FileOpenDialog("Choose PDF", "C:\Temp", "PDF Files(*.pdf)", 3) ; put your own start folder here If @error Then MsgBox(0, "Error", "No file selected") Return EndIf ; Declare objects Local $oPDF = ObjCreate("AcroPDF.PDF.1"); $oPDF.src = $sFile ; Create GUI GUICreate("Label Printer", 1580, 590, -1, -1, BitOr($GUI_SS_DEFAULT_GUI, $WS_SIZEBOX, $WS_MAXIMIZEBOX)) Local $GUI_ActiveX = GUICtrlCreateObj($oPDF, 10, 10, 1560, 570) GUICtrlSetStyle($GUI_ActiveX, $WS_VISIBLE) GUICtrlSetResizing($GUI_ActiveX, $GUI_DOCKAUTO) ; Auto Resize Object GUISetState() ; When window is resized, run this function GUIRegisterMsg($WM_SIZE, "MY_WM_SIZE") While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch If $fResized = True Then ConsoleWrite($iGUIWidth & " - " & $iGUIHeight & @CRLF) $fResized = False WinMove($GUI_ActiveX, "", Default, Default, $iGUIWidth - 20, $iGUIHeight - 20) EndIf WEnd ; Clear up $oPDF = "" $GUIActiveX = "" Exit EndFunc Func MY_WM_SIZE($hWnd, $Msg, $wParam, $lParam) $iGUIWidth = BitAND($lParam, 0xFFFF) $iGUIHeight = BitShift($lParam, 16) $fResized = True Return $GUI_RUNDEFMSG EndFunc ;==>MY_WM_SIZE Func _ComErrFunc() Local $HexNumber = Hex($oMyError.number,8) Msgbox(0,"AutoItCOM Test","We intercepted a COM Error !" & @CRLF & @CRLF & _ "err.description is: " & @TAB & $oMyError.description & @CRLF & _ "err.windescription:" & @TAB & $oMyError.windescription & @CRLF & _ "err.number is: " & @TAB & $HexNumber & @CRLF & _ "err.lastdllerror is: " & @TAB & $oMyError.lastdllerror & @CRLF & _ "err.scriptline is: " & @TAB & $oMyError.scriptline & @CRLF & _ "err.source is: " & @TAB & $oMyError.source & @CRLF & _ "err.helpfile is: " & @TAB & $oMyError.helpfile & @CRLF & _ "err.helpcontext is: " & @TAB & $oMyError.helpcontext _ ) SetError(1) EndFunc
  12. @JCEF I'am also testing your code at the moment. Wat does "$oExcel.Sheets("Folha1")" mean is this the name of the sheet name? Did some experimenting it is indeed the name of the worksheet. There is a small mistake in your code, corrected code below. For $1 = 0 To UBound($aFiles) - 1 Is has to be from 0 to Ubound, otherwise i will miss the first record of the array.
  13. @soonyee91 Perfect solution! I'am learning more and more on how to handle this. Thnx a lot.
  14. I fill an array with values from pdf file's found in a directory. Now i need to find de corrsponding values in the array and in the excel sheet, and place "X" in the cell at the left of the corresponding value. How to do this? See below the code i made so far to fill the 2D array with the value's (a lot of code plagarized from Kylomas and soonyee91 ) ; ------------------------------------------------------------------------------------ ; create pdf files in @scriptdir \test\ for testing ; ------------------------------------------------------------------------------------ Local $result[16] $result[0] = "Could be any name - ABCD001.pdf" $result[1] = "Could be any name - ABCD003.pdf" $result[2] = "Could be any name - ABCD005.pdf" $result[3] = "Could be any name - ABCD007.pdf" $result[4] = "Could be any name - ABCD009.pdf" $result[5] = "material-1a_124567.pdf" $result[6] = "material-1b_12345_589752467.pdf" $result[7] = "material-1c_12345_nesting.pdf" $result[8] = "material-1d_us_04030-2010-09-03.pdf" $result[9] = "material-1e_us_Certificaat.pdf" $result[10] = "material-1f_z35_SL1020_01.pdf" $result[11] = "material-1g_harden_W1305050.pdf" $result[12] = "material-1h_veredelen_SL1025_02.pdf" $result[13] = "material-1k_painting.pdf" $result[14] = "material-1i_ndt_RM0199.pdf" $result[15] = "material-1j_ndt_Certificaat.pdf" For $1 = 0 To UBound($result) - 1 FileOpen(@ScriptDir & '\test\' & $result[$1], 16) Next ; end creation pdf file's ; list all .pdf type files from a specific directory $atemp_Files = _FileListToArray(@ScriptDir & '\test\', '*.pdf', 1) _ArrayDisplay($atemp_Files, "Directory loaded") ; Remove all file names with "material-" in the pdf file For $i = UBound($atemp_Files) - 1 To 0 Step -1 If StringInStr($atemp_Files[$i], "material-", 0) Then _ArrayDelete($atemp_Files, $i) EndIf Next _ArrayDisplay($atemp_Files, "Material pdf's removed") ; create final result array with 2 dimensions Local $aFiles[UBound($atemp_Files)][2] ; populate 1ST dimension of final result array with complete file name (not path) For $1 = 0 To UBound($atemp_Files) - 1 $aFiles[$1][0] = $atemp_Files[$1] Next ; populate 2ND dimension of final result array with stripped out file name Local $aTmp For $1 = 1 To UBound($aFiles) - 1 $aTmp = StringRegExp($aFiles[$1][0], '[a-zA-Z]{1,4}[0-9]{1,3}', 3) If IsArray($aTmp) Then $aFiles[$1][1] = $aTmp[0] Next _ArrayDisplay($aFiles, "2nd Array filled") _ArrayDelete($aFiles, 0) ; ------------------------------------------------------------------------------------ ; iterate array looking for element with "paint" in the name ; ------------------------------------------------------------------------------------ ;~ For $1 = 0 To UBound($aFiles) - 1 ;~ If StringInStr($aFiles[$1][1], 'ndt') > 0 Then ;~ ConsoleWrite('Found "ndt" in element ' & $1 & ' of array' & @LF) ;~ EndIf ;~ Next Thnx in advance!
  15. junkew This is what i mean by "smart searching" !! Thnx
  16. soonyee91 Both your solutions work like a charm! Now i can go on and manipulate some of the values, so for me the "case select" method will be the best to use i believe. Global $Certificate Global $Chargenr For $1 = 0 To UBound($aFiles) - 1 Select Case StringInStr($aFiles[$1][0], 'material-1a') > 0 ConsoleWrite('Found ' & $aFiles[$1][0] & ' in element ' & $1 & ' of array' & @LF) Case StringInStr($aFiles[$1][0], 'material-1b') > 0 ConsoleWrite('Found "1b" in element ' & $1 & ' of array' & @LF) $Certificate = $aFiles[$1][1] Local $array5 = StringSplit($Certificate, "_", 1) $Certificate = $array5[1] $Chargenr = $array5[2] Case StringInStr($aFiles[$1][0], 'material-1c') > 0 ConsoleWrite('Found ' & $aFiles[$1][0] & ' in element ' & $1 & ' of array' & @LF) Case StringInStr($aFiles[$1][0], 'material-1d') > 0 ConsoleWrite('Found ' & $aFiles[$1][0] & ' in element ' & $1 & ' of array' & @LF) Case StringInStr($aFiles[$1][0], 'material-1e') > 0 ConsoleWrite('Found ' & $aFiles[$1][0] & ' in element ' & $1 & ' of array' & @LF) Case StringInStr($aFiles[$1][0], 'material-1f') > 0 ConsoleWrite('Found ' & $aFiles[$1][0] & ' in element ' & $1 & ' of array' & @LF) EndSelect Next
  17. The "looking for a value" could be the solution, i need to know on which position in the array the value for material-1a or material-1b and so on is, so that i always take the correct value to place int the excell sheet. I think i solved it with the code below. (only for looking up 1a) For $1 = 0 To UBound($aFiles) - 1 If StringInStr($aFiles[$1][0], '-1a') > 0 Then ConsoleWrite('Found "1a" in element ' & $1 & ' of array' & @LF) EndIf Next Is there a smart way to search from 1a to 1f ?
  18. Let me explain again in another way what my goal is with this application. Read all the pdf file's in a certain directory and put a part of the pdf filenames into an array or variable(s). It depends on the job how many pdf files there will be, sometimes there are 8 pdf files, sometimes there are 3 pdf files, or even 1 pdf file is possible. From the prefix of the pdf file (material-1a) i know what type of document it is, and where to place its value after the prefix "material-1a_" in the excell sheet. When there are 8 pdf file's the array is filled from 1 to 8 with the values, so i know wich value is on array position 8, or 7 and so on. When there are (for example) 3 pdf file's i don't know how to determine the values in the array. example1 material-1a_124567.pdf - always 1th record in array material-1b_12345_12345.pdf - always 2th record in array material-1c_12345_nesting.pdf - always 3th record in array material-1d_us_04030-2010-09-03.pdf - always 4th record in array material-1e_z35_SL1020_01.pdf - always 5th record in array material-1f_W1305050.pdf - always 6th record in array material-1g_SL1025_02.pdf - always 7th record in array material-1h_painting.pdf- - always 8th record in array example2 material-1b_12345_12345.pdf - first record in array - with 8 pdf files this is the 2nd record in the array material-1c_12345_nesting.pdf - second record in array - with 8 pdf files is this the 3th record in the array material-1f_W1305050.pdf - 3th record in array - with 8 pdf files is this the 6th record in the array So i need to know on which position in the array "material-1a" and so on is, which ofcourse depends on how may pdf files there are in the directory.
  19. @JohnOne, sooyee91, kylomas (very nice regexpression, how do you build them?) You solution works fine, but how to get the values on a fixed place in the array? or in a fixed variable I need this because not allways all the pdf documents will be needed. See the examples below example1 material-1a_124567.pdf - always 1th record material-1b_12345_12345.pdf - always 2th record material-1c_12345_nesting.pdf - always 3th record material-1d_us_04030-2010-09-03.pdf - always 4th record material-1e_z35_SL1020_01.pdf - always 5th record material-1f_W1305050.pdf - always 6th record material-1g_SL1025_02.pdf - always 7th record material-1h_painting.pdf- - always 8th record example2 material-1b_12345_12345.pdf - always 2th record material-1c_12345_nesting.pdf - always 3th record material-1f_W1305050.pdf - always 6th record material-1g_SL1025_02.pdf - always 7th record I also need to remove: _us_ from the 4th record _z35_ from the 5th record Thanx again :-)
  20. @edano and the rest, i'am still very interested in the given solutions, but time is my biggest problem at this moment, i did not have time to read them until now..... This weekend i'am gonna try all the possible solutions given, and comment on this great forum. Thnx a lot for the support!
  21. For a new project i need to lookup all the available .pdf files in a certain directory. The pdf format looks like below material-1a_124567.pdf material-1b_12345_12345.pdf material-1c_12345_nesting.pdf material-1d_us_04030-2010-09-03.pdf material-1e_z35_SL1020_01.pdf material-1f_W1305050.pdf material-1g_SL1025_02.pdf material-1h_painting.pdf The above mentioned pdf file names are all the available variations that can occur, but it is also possible that there are only one or two of the the file's mentioned above. My goal: I want to read all the available filenames(without) the extension and the prefix "material-1a_" (and so on for the next files), and store the value in an array? or each file in a different variable?, but in a way that material-1a is always available in the same variable or array position, so i can use them to place the value in an excell sheet. Is this possible or are there better/smarter ways to do this. Thanks in advance!
  22. The method _ExcelWriteCell works perfect. Project almost finished now! Below the code i use to fill the merged cells with the array. $startcolumn = 3 For $j = 0 To ($i - 1) Step 1 _ExcelWriteCell($MyExcel, $aArray1[$j], 9, $startcolumn) $startcolumn = $startcolumn + 2 Next
  23. There is one small problem left. I have problems with inserting the array into the merged cells. The insertion needs to start at C9. See the code below i use and the picture to explain what i want. For $j = 1 To ($i - 1) Step 1 $MyExcel.ActiveSheet.Cells(9, $j).value = $aArray1[$j] Next _ExcelWriteArray($MyExcel, 11, 3, $aArray1, 0)
  24. Both your solutions work like a charm. With this knowledge i'am going to try to fill the sheet with data. Thanks a lot !
ร—
ร—
  • Create New...