2 posts in this topic
Good morning everyone
I am working on a little script, which takes some data from a SQLite DB and should create a sort of report, inserting rows in a Word Document... I arrived at the point of:
_Word_DocTableWrite() and, I don't know how to set the range parameter? What does that specify?
Thanks a lot for the help
Managed to write a table in the Word document, but now I get an error when I save the document with _Word_DocSaveAs(), with error 2.
Which are possible causes? Thanks a lot, again
... And, how can I set a border to the table? Maybe, with a sort of auto-formatting for text ( larger is the text, larger is the height/width of the table's cell ).
EDIT 3 ( bug ):
Including the parameter $WdSaveChanges in the function _Word_DocSaveAs(), a save dialog box appears, and it should not do it, as it's written in the MSDN documentation:
wdSaveChanges -1 Save pending changes automatically without prompting the user. Thanks again for everyone will answer to me
I'm using the Word UDF for the first time, and I'm having some trouble with _Word_DocFind(). There isn't really much talk around the forums about this so it's hard to find any support on the issue I'm having. Here's my code:
#include <Word.au3> $listPath = @ScriptDir & "\AMCH OFFSET 042617.docx" $pWord = _Word_Create() $oWord = _Word_DocOpen($pWord, $listPath) Local $ctr = 0 Local $searchRange = _Word_DocFind($oWord, "Claim Number") If Not @error Then $ctr += 1 EndIf While ($searchRange <> 0) $searchRange = _Word_DocFind($oWord, "Claim Number", 0, $searchRange) If Not @error Then $ctr += 1 EndIf $searchRange.Select WEnd My problem is that it doesn't seem to find a match of the string on any page after the second. When I run the script, it just loops indefinitely on the second page. I can't post an example of the word document because it is medical data, but every page is basically the same and every page has the string I am looking for on it. Also I tried checking @error after doing a find and it is never set, so I don't think that's the problem.
I am trying to do 2 things but i cannot seem to get any traction on how to read/implement this idea.
Premise: PowerPoint file in C\temp\presentation.pptx that contains on the first slide 2 entries as "<one>" and "<two>" which need to be replaced with "user1" and "user2", then a silent Outlook send mail containing the file with a predefined body and subject.
I narrowed it down to COM objects as the Office does not like intrusive open AutoIt functions. I installed OLE/COM Object Viewer to understand how to create the commands but i am still stuck. So far i am trying to user water's code but i suck
COM object i was originally trying to modify
Dim $oPPT, $oPres $oPPT = ObjCreate("PowerPoint.Application") $oPPT.Visible = True $oPres = $oPPT.Presentations.Read Water's code below (0.1% modified)
#include <File.au3> #include "PowerPoint.au3" #include <misc.au3> Global $sFile = "C:\temp\presentation.pptx" Global $sString2Search = "<username>", $sString2Replace = "Password", $iReplaceOnce = 1, $sFullLogFile = "C:\temp\pptxlog.txt" _ProcessPpt($sFile) Func _ProcessPpt($sFile) $oApp = _PPT_PowerPointApp() Local $bChange = False Local $oInterface = $oApp.Presentations Local $oPresentation = $oInterface.Open($sFile, False, False, False) If @error Then _FileWriteLog($sFullLogFile, "E Error " & @error & " opening File " & $sFile) Return SetError(1, 0, 0) EndIf ;it does not even open my file and from here not sure how to read the text and replace it EndFunc ;==>_ProcessPpt
Hello, in my own design of small procedures, used to insert the ellipse notation in the GUI graphics, and let the arrow pointing to the little girl mouth position. I discovered that point to the gap region size is not fixed, first thought he had just set the angle, calculate the arc starting coordinates and end coordinates OK, then I found that I was wrong. The online search information, for a long time did not find the answer, only to the official website to help you, because I do not start.
#include <GDIPlus.au3> #include <GUIConstantsEx.au3> #include <Array.au3> Opt("MouseCoordMode", 2) ;1=absolute, 0=relative, 2=client $nPI = 3.1415926535897932384626433832795 $iAngle = 95 $iSpace = 50 $nX = 100 $nY = 200 $nWidth = 200 $nHeight = 100 $fStartAngle = $iAngle + $iSpace / 2 $fSweepAngle = 360 - $iSpace _GDIPlus_Startup() Local Const $iWidth = 600, $iHeight = 600 Local $hGUI = GUICreate("GDI+ UDF 示例", $iWidth, $iHeight) GUISetState(@SW_SHOW) Local $hGraphics = _GDIPlus_GraphicsCreateFromHWND($hGUI) _GDIPlus_GraphicsSetSmoothingMode($hGraphics, $GDIP_SMOOTHINGMODE_HIGHQUALITY) Local $hPen = _GDIPlus_PenCreate(0xFFFF8080, 1) Local $hImage = _GDIPlus_ImageLoadFromFile("g_8.png") _GDIPlus_GraphicsDrawImageRect($hGraphics, $hImage, 400, 100, 102, 278) _GDIPlus_GraphicsDrawArc($hGraphics, $nX, $nY, $nWidth, $nHeight, $fStartAngle, $fSweepAngle, $hPen) ; Local $a = $nWidth / 2 Local $b = $nHeight / 2 Local $c = Sqrt($a ^ 2 - $b ^ 2) Local $Coordinate $Coordinate = Sqrt($a ^ 2 * $b ^ 2 / ($a ^ 2 * Tan((360 - $iAngle - $iSpace / 2) * $nPI / 180) ^ 2 + $b ^ 2)) $Coordinate = Tan((360 - $iAngle - $iSpace / 2) * $nPI / 180) * $Coordinate ;_ArrayDisplay($Coordinate) If (360 - $iAngle - $iSpace / 2) >= 90 And (360 - $iAngle - $iSpace / 2) <= 270 Then $Coordinate = -$Coordinate If (360 - $iAngle - $iSpace / 2) >= 0 And (360 - $iAngle - $iSpace / 2) < 180 Then $Coordinate = -$Coordinate $Coordinate = $nX + $a + $Coordinate $Coordinate = $nY + $b + $Coordinate ;MouseMove($Coordinate, $Coordinate) Do Until GUIGetMsg() = $GUI_EVENT_CLOSE _GDIPlus_PenDispose($hPen) _GDIPlus_ImageDispose($hImage) _GDIPlus_GraphicsDispose($hGraphics) _GDIPlus_Shutdown() GUIDelete($hGUI)
I am having a very unique, but repeatable problem with ImageMagick COM interface. Here are the applicable lines of code:
and then later on...
the array points to a pdf file with the "convert" command converting the first page of the pdf to a jpg with any alpha layer removed.
Every time, without fail, the first time I run the script on a freshly booted machine it crashes on the $oIM.Convert command. It does this if it isn't compiled and says there is an error executing the command on the object. If compiled, i get an error that autoit has stopped responding. Anytime I run the script, compiled or not, after this initial crash everything works perfectly fine.
I am totally at a loss as to why this is occurring and how to correct it.