Jump to content

Clark

Active Members
  • Posts

    175
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

Clark's Achievements

  1. Hmmm, I wonder.... Microsoft has warned of a spam campaign that uses maliciously-crafted RTF documents. Once the documents have been opened, they infect computers with no additional user interaction. The spam email is being sent in several different European languages. The malicious documents exploit a known vulnerability for which Microsoft released a patch in November 2017.
  2. Thanks for everyone's help. The problem is fixed. Fixed code is as follows: $file=FileOpenDialog("Attach to RFC",".","All (*.*)",1) $filehnd=FileOpen($file,16) ; Check if file opened for reading OK If $filehnd = -1 Then MsgBox(0, "Error", "Unable to open file.") Exit EndIf ; Read in the File $fsize = FileGetSize($file) $chars = FileRead($filehnd) FileClose($filehnd) The FileGetSize call not being needed in fact. Thanks again Clark
  3. Right! I will take the path and pass it to FileOpen and then use the handle in FileRead and see if that works. Strange my code very worked at all, really! 😂
  4. Isn't that what I have done? $file is the return value (presumably a filehand) from FileOpenDialogue, which I then use in FileRead. (Or am I misinterpreting what you are saying)
  5. Hello all A programme I wrote for the organisation for which I work has been in use for a number of years with no issue. One of the things that it does is allow for attachments to be selected (Word docs, Excel sheets, etc) which it then writes away as a BLOB in MySQL. This was all working fine until recently, when suddenly, on the odd occasion, Word would advise that the file was corrupt on retrieval of the BLOB from MySQL. Upon further examination it appears that the issue is not with the retrieval of the data from MySQL, but reading in the data from the disk by AutoIT. It seems that on occasions that AutoIT will only read half the file. I have no idea why this is, as the whole function is very simple. I have included a sanitised vesion of it below in the hope that someone can tell me where to look next, as this one has me beat (again). 😋 I have put some comments in to show what I have done to try and solve the problem, but am getting no closer to the truth. @error is the strangest one - it should return -1 when it reaches end of file but is returning zero. Func _AttachAttachment() local $file,$chars,$fsize If $RFC_Retrieved = False Then msgbox(0,"Error","Must have a RFC active first") Else $file=FileOpenDialog("Attach to RFC",".","All (*.*)",1) ; Check if file opened for reading OK If $file = -1 Then MsgBox(0, "Error", "Unable to open file.") Exit EndIf ; FileClose($file) These two lines are my attempt to open the file in binary mode. Made no difference ; FileOpen($file,16) ; Read in the File $fsize = FileGetSize($file) ConsoleWrite("File size is " & $fsize & @CRLF) ; the size comes back as what it say in Windows properties ; $chars = FileRead($file,$fsize) ; I was using this, then tried the line following this. It didn't help $chars = FileRead($file) ; This is showing a figure $chars/2 - 1 I don't understand this ConsoleWrite("Number of chars read is " & @extended & " error code is " & @error & @crlf) ; @error is coming back with 0. I don't understand this as I thought it would be -1 FileClose($file) EndIf EndIf EndFunc Thanks in advance for looking at this Clark
  6. Thanks Melba My bad for not rereading the doco. I can't explain why the original code works with the old version of the udf, but it does. I just did a search through the code and ReadToArray nor ListViewEx_Close appear anywhere in the code, yet it sorts those columns just fine. You have made a really useful udf. Thanks again Clark
  7. Thanks for looking at this Melba I have hacked away all my original code and inserted some fake data into the array and the problem still exists. Clearly PICNIC (Problem In Chair, Not In Computer). I would appreciate your guidance when you have the time. I have left all the includes in there in case there is some conflict somewhere. listboxtest.au3
  8. Long time no been here :) Back in 2015 I used this udf to make sortable list boxes for an inhouse app. As these things go, the app has been in use since that time, loved but untouched. Recently however, we have had to migrate to a new server farm and for "reasons" the code needs a recompile. Unfortunately the new guilistviewex.au3 no longer works in the clever list view sorting department. In other words I click on the column headers and nothing happens. What I have tried: Reviewed the GUIListViewEx_Init statement Reviewed the GUIListViewEx_MsgRegister statement Reviewed the GUIListViewEx_SetActive statement Added a GUIListViewEx_EventMonitor into the script loop I have checked the @extended return from GUIListViewEx_EventMonitor and it returns nothing when clicking the column headers. It does return a 9 when I click on a row so I know the listbox is active. What else can I check to see why this sorting is not working? I have spent all day on this and cannot think what else it could be. Thanks in advance for any help
  9. I would use a case statement personally. But at any rate, in the first block of code, you run the md5sum when $ext = ".mov" but in the second block you exitloop when $ext = ".mov" I'm not sure if this helps at all.
  10. Excellent! It works. Thank you.
  11. Thanks Water THis is because the initial sql retrieve also brings back column headings, but only for columns 0-12. Nevertheless, in the interest of trying to solve this problem, I have removed the array rewrite and cleaned up the Excel code as per your suggestions above. The sql retrieves are returning 2d arrays as confirmed by ubound, however, when I write the array out to Excel, nothing is appearing other than the headings which I manually insert. Excel_Rangewrite does not return an error when writing out the retrieved 2d arrays. Any ideas?
  12. Thanks for your reply DarthCookieMonster I'm not really understanding what you are suggesting. When you say "rename the variable", do you mean copy the $iRval array to a new array variable and then try to display that with _arraydisplay? I apologise in advance if I am being dumb.
  13. Thanks Jfish I just tried removing the redim and the consequent statements that addressed the now out of bounds array values but this had no effect on the problem. I'm pretty sure redim preserves the values in an array anyway.
  14. I am having trouble understanding why the following code does not work. THe way it is now, with this line commented out... ;$iRval = _EzMySql_GetTable2d($sSQL ...it works fine and populates the excel spreadsheet with the heading rows "System Impact" etc. However, if I uncomment out the line I mention above, nothing goes to the Excel spreadsheet. Where I have the messagebox reporting the value of Ubound on the array (for debugging purposes) it returns the correct value, i.e. the number of rows the sql has returned. I have also included a screen snap of the array display, showing that the array does indeed contain data. Here is the function Func _Excel_Xport() local $cntr,$wf,$tempresult,$iSval,$iRval[10][10] local $sFilePath = @TempDir & "\Temp.xls" local $oExcel = _Excel_Open() If Not _FileCreate($sFilePath) Then MsgBox(4096, "Error", " Error Creating File - " & @error & " - " & @extended) return 1 EndIf $oExcel = _Excel_BookOpen($oExcel,$sFilePath, Default, Default, True) if $oExcel = 0 Then MsgBox(0,"Error",@error) Return EndIf $oExcel = _Excel_BookAttach("Microsoft Excel - Temp.xls","Title") if $oExcel = 0 Then MsgBox(0,"Error","Unable to attach to spreadsheet") Return EndIf for $cntr = 1 to 8 if GUICtrlRead($r_[$cntr]) = 1 Then Switch $cntr Case 1 $wf="%" Case 2 $wf="%5" Case 3 $wf="1_0" Case 4 $wf=20 Case 5 $wf=30 Case 6 $wf=40 Case 7 $wf=50 Case 8 $wf=3 EndSwitch ExitLoop EndIf next $sSQL="SELECT * FROM rfc_manager.tbl_RFC WHERE RFC_Workflow_Status LIKE """ & $wf & """ AND RFC_Workflow_Status <> ""9999"";" ;$iRval = _EzMySql_GetTable2d($sSQL) $error = @error msgbox(0,"test",Ubound($iRval)) $iRval[0][0]="Test" if uBound($iRval)=1 Then MsgBox(0, $sSQL & " error", $error) ReDim $iRval[UBound($iRval)][26] ; Add a few columns to the array $iRval[0][13]="System Impact" $iRval[0][14]="Tech Est Hours" $iRval[0][15]="Tech Quoted Hours" $iRval[0][16]="Func Est Hours" $iRval[0][17]="Func Quoted Hours" $iRval[0][18]="Admin Est Hours" $iRval[0][19]="Admin Quoted Hours" $iRval[0][20]="Payment Method" $iRval[0][21]="PO Number" $iRval[0][22]="CAB Priority" $iRval[0][23]="CAB Notes" $iRval[0][24]="Vendor Notes" $iRval[0][25]="Reason Notes" _ArrayDisplay($iRval) $iSval = _Excel_RangeWrite($oExcel,$oExcel.Activesheet, $iRval) if $iSval = 0 Then msgbox(0,"Error",@error) EndFunc And here is the array displayed <a href="http://s111.photobucket.com/user/wongdai/media/array_display_zps9832c577.jpg.html" target="_blank"><img src="'>" border="0" alt=" photo array_display_zps9832c577.jpg"/></a> I hope I have explained this clearly enough
  15. Hi Melba Damn, in my head I think listview but my fingers type listbox. Yes, without the subitems staying with their correct rows I would have to forego sorting, which would be a shame. But if there is a trigger I can track in the program code, similar to what is available for _GUIListViewEx_Editonclick, then I can easily put the subitems back in the right place after a sort. Here is a screen from my app so you can see why: I will remove the $LVS_SORTASCENDING as per your suggestion. regards Clark
×
×
  • Create New...