Jump to content

lsakizada

Active Members
  • Posts

    450
  • Joined

  • Last visited

Everything posted by lsakizada

  1. Thanks Edit: found bug in my code. thanks for the help.
  2. Hi All, I have not visiting you for long time, happy to be here again !!!! I need help, I have a file that it is fails to opened with _FileReadToArray() function. It returns error 1 ("Error opening specified file"). BTW: For general info, the file is created on Amazon S3 and I downloaded it to my windows PC (win 7) Any other application other then autoit script is opening it properly without any issue. Not all files from S3 has that problem and this is raise some concern for me that something is wrong with autoit. Can you please help to investigate it?. I attached an example such "problematic" file. Here is the code how I call to open the file. Func _GetTestNameFromResultsFile($ResultsFile) Local $i, $arrContent, $arrLine, $res = 0 Local $delim = ",", $aRet $res = _FileReadToArray($ResultsFile, $arrContent) If $res = 1 Then ;succes For $i = 1 To 1 $arrLine = StringSplit($arrContent[$i], $delim) If IsArray($arrLine) And $arrLine[0] <> 0 Then $aRet = StringSplit($arrLine[1], '/') Return $aRet[4] Else _Log_Report($hLog, "_GetTestNameFromResultsFile: Error splitting first line!", 5) SetError(2) EndIf Next Else _Log_Report($hLog, "_GetTestNameFromResultsFile: Error opening file for reading test name! " & "error:" & @error, 5) SetError(1) EndIf EndFunc ;==>_GetTestNameFromResultsFile all_clips_results.csv
  3. There is nothing to do about switching development platform, anyone prefer its choices as well as autoit programers. For autoit programers It will be simple for instance to call node.js services from AU3 UI script. The development of the UI is easy with autoit scripts including interpreting the response JSON objects (some good libraries already on the forum) Using the GDIPlus library will make it the coolest UI on Windows 10 mobile. But, we will see how many Android users will switch to windows in the future so it will motivate developers to develop more mobile apps for windows 10. Mean time I will wait until someone will test it and post its observation.
  4. 1) Agree but that's popularity could be changed in the future. 2) The Android emulators cannot help here since (unless you prove it) we need to test installing Windows 10 Mobile on top of Android which I never did it yet and it is a device dependency.
  5. @BrewManNH Microsoft developed the OS so the installer can wipes out Android and installs Windows 10 instead. Read Here So, Imagine how many Android users will prefer Windows because of ease integration with other Microsoft software, and if Autoit Script can run on that devices then creating Mobile Apps for Windows will be very cool and easy. Anyway, I do not have Android available now for testing so I will glad to hear from someone else who can share with us that experience.
  6. I was thinking to run GUI/EXE files created by Autoit on PC but deployed on Windows 10 mobile. Thats could be very powerful. According to their ad as I posted above:
  7. Probably this question was asked zillion times I am going to ask it one more: Does AU3 script can run on Windows 10 mobile? Regards
  8. Please ignore my last post. I found the solution and it is very simple Needs to set the $iNumberOfBytesToRead default value of 8192 to $X bytes... Func _WinHttpReadData($hRequest, $iMode = Default, $iNumberOfBytesToRead = Default, $pBuffer = Default)
  9. Hi, First thanks for this wonderful UDF! I am sending simple Get request to a server's API that response with json data. I noticed that the json data is truncated and partially data is received by the client Can you please let me know what should be done to capture all data? I have this code to send the get method Func BIPRequest($URL, $HTTPMethod, $HTTPSources = "", $JSON = '', $SaveHeaders = False, $SaveResponse = False, $ReadCookie = True, $SaveCookie = False, $Folder = @ScriptDir,$name="") Local $hOpen = _WinHttpOpen() Local $hConnect = _WinHttpConnect($hOpen, $URL) Local $hRequest = _WinHttpOpenRequest($hConnect, $HTTPMethod, $HTTPSources, Default, Default, Default, $WINHTTP_FLAG_SECURE) ; set options Local $CurrentOption = _WinHttpQueryOption($hRequest, $WINHTTP_OPTION_SECURITY_FLAGS) Local $Options = BitOR($CurrentOption, _ $SECURITY_FLAG_IGNORE_UNKNOWN_CA, _ $SECURITY_FLAG_IGNORE_CERT_CN_INVALID, _ $SECURITY_FLAG_IGNORE_CERT_DATE_INVALID) _WinHttpSetOption($hRequest, $WINHTTP_OPTION_SECURITY_FLAGS, $Options) ; Send request If $ReadCookie = True Then _WinHttpAddRequestHeaders($hRequest, "Cookie: " & String(ReadCookie($Folder))) EndIf _WinHttpSendRequest($hRequest, "Content-type: application/json", $JSON) ; Wait for the response _WinHttpReceiveResponse($hRequest) ; ...get full header Local $sHeader = _WinHttpQueryHeaders($hRequest) If $SaveCookie = True Then SaveCookie($sHeader,$Folder) EndIf ; ...get full data Local $sData = _WinHttpReadData($hRequest) ; Clean/Close handles _WinHttpCloseHandle($hRequest) _WinHttpCloseHandle($hConnect) _WinHttpCloseHandle($hOpen) ; Display retrieved header MsgBox(0, "Header", $sHeader) ; Display retrieved data MsgBox(0, "Data", $sData) If $SaveResponse = true Then SaveTestResponse($name, $sData ,$name) EndIf EndFunc ;==>BIPRequest
  10. I found a way to send the request by using this WinHTTP functions. Unfortunately, I do not know how to retrieve the cookie in order to send it in next request. Can you please give me a clue how to to perform it with WinHTTP functions? #include "WinHttp.au3" Opt("MustDeclareVars", 1) Local $URL = "https://URL.com" Local $Sources = "/auth/signin" Local $Jason = '{"email":"test@MAILMAIL.com","password":"12345678"}' Local $hOpen = _WinHttpOpen() Local $hConnect = _WinHttpConnect($hOpen, $URL) Local $hRequest = _WinHttpOpenRequest($hConnect, "post", $Sources, Default, Default, Default, $WINHTTP_FLAG_SECURE) local $CurrentOption = _WinHttpQueryOption($hRequest, $WINHTTP_OPTION_SECURITY_FLAGS) local $NewOption = BitOR($CurrentOption, _ $SECURITY_FLAG_IGNORE_UNKNOWN_CA, _ $SECURITY_FLAG_IGNORE_CERT_CN_INVALID, _ $SECURITY_FLAG_IGNORE_CERT_DATE_INVALID) ; set options _WinHttpSetOption($hRequest, $WINHTTP_OPTION_SECURITY_FLAGS, $NewOption) ; Send request _WinHttpSendRequest($hRequest,"Content-type: application/json",$Jason) ; Wait for the response _WinHttpReceiveResponse($hRequest) ; ...get full header Local $sHeader = _WinHttpQueryHeaders($hRequest) ; ...get full data Local $sData = _WinHttpReadData($hRequest) ; Clean/Close handles _WinHttpCloseHandle($hRequest) _WinHttpCloseHandle($hConnect) _WinHttpCloseHandle($hOpen) ; Display retrieved header MsgBox(0, "Header", $sHeader) ; Display retrieved data MsgBox(0, "Data", $sData)
  11. Hi, I am running this script against my site and it is return empty response in the message box. What could be the problem? Is this related to JSon? or maybe HTTPS? #include <array.au3> $oHTTP = ObjCreate("winhttp.winhttprequest.5.1") $oHTTP.Open("POST", "https://SITE.com/auth/signin", False) $oHTTP.SetRequestHeader("Content-type", "application/json") $oHTTP.SetRequestHeader("User-Agent", "User-Agent=Mozilla/5.0 (Windows NT 6.1; WOW64; rv:12.0) Gecko/20100101 Firefox/12.0") $sPD = '{"email":"test@EMAILEMAIL.com","password":"12345678"}' $oHTTP.Send($sPD) $oReceived = $oHTTP.ResponseText $oStatusCode = $oHTTP.Status If $oStatusCode <> 200 Then MsgBox(4096, "Response code", $oStatusCode) EndIf $file = FileOpen("Received.html", 2) FileWrite($file, $oReceived) FileClose($file)
  12. Hi water . sorry for the late response. Thanks for the function. somehow it is still not working in my code. but the other was working for me. I can not test it much and see were it is fails but seems that its ok. thanks alot
  13. I read the Excel.SaveAs method in MSDN and it can get another parameter named Local see https://msdn.microsoft.com/en-us/library/microsoft.office.tools.excel.workbook.saveas.aspx The UDF function_Excel_BookSaveAs does not accept that as parameter. I tried to extend the function but it did not works for me I gues that I made some mistake somewhere I think it will be useful to support local by using native proprieties of excel.
  14. @Water, there are no changes in the function code right? just passing a text file. its works for me too thanks for the help
  15. I do not know how to include file in this forum but I put the text in the code box. Edit: I am running Excel 2007 Date,SensorID,FG33,FG100,MC332,MC333,BG2000,CF0,CF99 '2015-04-01 07:28:59,1,,96,83,83,100,100, '2015-04-01 07:28:59,4,,96,83,83,100,100, '2015-04-01 07:29:47,1,,,,,0,, '2015-04-01 07:29:47,4,,,,,0,, '2015-04-01 07:30:47,3,,94,84,83,99,, '2015-04-01 07:30:48,1,,96,83,83,100,100, '2015-04-01 07:30:48,4,,96,83,83,100,100, '2015-04-01 07:31:48,1,,94,82,84,99,, '2015-04-01 07:31:48,4,,94,82,84,99,, '2015-04-01 07:32:48,1,,96,83,83,100,100, '2015-04-01 07:32:48,4,,96,83,83,100,100, '2015-04-01 07:33:48,1,,94,84,83,99,, '2015-04-01 07:33:48,4,,94,84,83,99,, '2015-04-01 07:34:48,1,,94,84,83,99,100, '2015-04-01 07:34:48,4,,94,84,83,99,100, '2015-04-01 07:35:49,1,,94,82,84,99,, '2015-04-01 07:35:49,4,,94,82,84,99,, '2015-04-01 07:36:49,1,,96,83,83,100,, '2015-04-01 07:36:49,4,,96,83,83,100,, '2015-04-01 07:37:50,1,,94,84,83,99,, '2015-04-01 07:37:50,4,,94,84,83,99,, '2015-04-01 07:38:50,1,,94,84,83,99,100, '2015-04-01 07:38:50,4,,94,84,83,99,100, '2015-04-01 07:39:50,1,,94,82,84,99,, '2015-04-01 07:39:50,4,,94,82,84,99,, '2015-04-01 07:40:50,1,,94,82,83,109,, '2015-04-01 07:40:50,4,,94,82,83,109,, '2015-04-01 07:41:50,2,,94,84,83,99,, '2015-04-01 07:41:51,1,,94,84,83,99,100, '2015-04-01 07:41:51,4,,94,84,83,99,100, '2015-04-01 07:42:51,3,,94,84,83,99,, '2015-04-01 07:42:51,1,,96,83,83,100,, '2015-04-01 07:42:52,4,,96,83,83,100,,
  16. Hi I have a csv file with coma delimiter columns that needs to be converted to '.xls' format On English locale its works perfectly (each data line separated by comma get its own column cell in the excel sheet) The problem is that on German locale it is not working. The xls contain single column only in the excel sheet. The UDF function _Excel_BookSaveAs does not save it as expected. How to resolve that issue? Here is the function that I am using: Func CreateXLSFromCSV($sFilePath) Local $sDrive = "", $sDir = "", $sFileName = "", $sExtension = "" Local $Parame = "" Local $aPathSplit, $sWorkbook Local $oAppl $oAppl = _Excel_Open(False) If @error Then MsgBox($MB_SYSTEMMODAL, "CreateXLSFromCSV ", "Error openning Excel application object." & @CRLF & "@error = " & @error & ", @extended = " & @extended) _Excel_Close($oAppl) Return SetError(1, 1, "") EndIf $oWorkbook = _Excel_BookOpenText($oAppl, $sFilePath) If @error Then MsgBox($MB_SYSTEMMODAL, "CreateXLSFromCSV", "Error opening text " & @ScriptDir & "\" & $sFilePath & @CRLF & "@error = " & @error & ", @extended = " & @extended) _Excel_Close($oAppl) Return SetError(2, 2, "") EndIf $sWorkbook = StringTrimRight($sFilePath, 4) & ".xls" _Excel_BookSaveAs($oWorkbook, $sWorkbook, 56, True) ;56 ;_Excel_BookSaveAsEx($oWorkbook, $sWorkbook, 56, True) If @error Then MsgBox($MB_SYSTEMMODAL, "CreateXLSFromCSV", "Error saving workbook to '" & $sWorkbook & "'." & @CRLF & "@error = " & @error & ", @extended = " & @extended) _Excel_Close($oAppl) Return SetError(3, 3, "") EndIf _Excel_Close($oAppl) Return $sWorkbook EndFunc ;==>CreateXLSFromCSV
  17. Thanks mikell, I will have that in the pattern too!
  18. Hi JCHD, That's working very well in my procedure. Now I will go and test it how faster it will be. BTW: I am using some of your other code that was posted on the forums. Thanks for all and have a good one !!!
  19. Thanks for the reply, Indeed that's how I did, but the performance of parsing thousands of lines with that method took very long time. I must use regexp to reduce the time. For $i = 1 To $aData[0] If StringInStr($aData[$i], "Feat stats, sensor ") <> 0 Then $aSplit = StringSplit($aData[$i], " ") ;_ArrayDisplay($aSplit) If $aSplit[0] = 12 Then $aFeatureHolder[0][0] = $aFeatureHolder[0][0] + 1 ReDim $aFeatureHolder[UBound($aFeatureHolder) + 1][11] ;_ArrayDisplay($aFeatureHolder,"11") $aSplit1 = StringSplit($aSplit[2], ".") ;_ArrayDisplay($aSplit1,"$aSplit1") $aFeatureHolder[UBound($aFeatureHolder) - 1][0] = $aSplit[2] ; raw time $aFeatureHolder[UBound($aFeatureHolder) - 1][1] = StringTrimRight($aSplit[8], 1) ; sensor id $aFeatureHolder[UBound($aFeatureHolder) - 1][2] = StringTrimRight($aSplit[9], 1) ; feat type. e.g. MC, Fg, BG.. $aFeatureHolder[UBound($aFeatureHolder) - 1][3] = StringTrimLeft(StringTrimRight(StringStripWS($aSplit[10], 8), 1), 2) ; feat sub type. e.g. p=333, p=332, p=100, etc $aFeatureHolder[UBound($aFeatureHolder) - 1][4] = StringTrimRight(StringStripWS($aSplit[12], 8), 2); performance value $aFeatureHolder[UBound($aFeatureHolder) - 1][5] = $sFN & " " & $aSplit1[1] ; full date/time without miliseconds EndIf ; 10:41:59.256697 T33252 DBG Feat stats, sensor 85: FG, p=100: c=191: 95%. EndIf Next
  20. Hi, Anyone please help me getting some data from text line into an array by using regexp? I have a line that looks like: 11:05:40.839855 T2708 DBG Feat stats, sensor 78: BG, p=2000: c=10: 100%. I need a one dimension array that has that elements values: $aArray[0] = 6 $aArray[1] = '11:05:40.839855' $aArray[2] = '78' $aArray[3] = 'BG' $aArray[4] = '2000' $aArray[5] = '10' $aArray[6] = '100'
  21. @mpower Get allot of these!!!! So simple pretty code! Exactly what I was needed! BTW: I saw this topic about backup DB from memory to file and I was consider it. '?do=embed' frameborder='0' data-embedContent>> Now I do not need it
  22. Hi, This is a question about sqlite. I have a large size 2 dimension array that I want to insert it into physical sqlite database table (not in memory). My problem is that it is take very long time. How do I make it faster? BTW: On my computer its take 92 seconds! Here is a code sample to assist me. #include <Array.au3> #include <MsgBoxConstants.au3> #include <SQLite.au3> #include <SQLite.dll.au3> Local $iRows, $iColumns, $aRes Local $hDB = @ScriptDir & "\" & "Test.db" If FileExists($hDB) Then FileDelete($hDB) Local $aResult, $iRows, $iColumns, $iRval ;Local $aArray[5][2] Local $hTimer, $fDiff _SQLite_Startup() If @error Then MsgBox($MB_SYSTEMMODAL, "SQLite Error", "SQLite.dll Can't be Loaded!") Exit -1 EndIf $hDskDb = _SQLite_Open($hDB) If @error Then MsgBox($MB_SYSTEMMODAL, "SQLite Error", "Can't Load Database!") Exit -1 EndIf Local $aArray[100][3] For $i = 0 To UBound($aArray) - 1 For $j = 0 To UBound($aArray, 2) - 1 $aArray[$i][$j] = "Item" & $i * $j Next Next ;_ArrayDisplay($aArray) If Not _SQLite_Exec($hDskDb, "CREATE TABLE T (Column0, Column1,Column2);") = $SQLITE_OK Then _ MsgBox($MB_SYSTEMMODAL, "SQLite Error", _SQLite_ErrMsg()) $hTimer = TimerInit() For $i = 0 To UBound($aArray) - 1 _SQLite_Exec($hDskDb, "INSERT INTO T (Column0,Column1,Column2) VALUES ( " & _SQLite_FastEscape($aArray[$i][0]) & "," & _SQLite_FastEscape($aArray[$i][1]) & "," & _SQLite_FastEscape($aArray[$i][2]) & ");") Next $fDiff = TimerDiff($hTimer) ConsoleWrite(@CRLF & "Insert to database took " & $fDiff / 1000 & " seconds!" & @CRLF) _SQLite_GetTable2d($hDskDb, "SELECT * FROM T;", $aRes, $iRows, $iColumns) _SQLite_Display2DResult($aRes) ; Output to Console _SQLite_Close() _SQLite_Shutdown()
  23. @Water, thanks for sharing it! I am using it for creating profiling reports where I work. I already created several tools that reports excel charts with this UDF. Thanks alot!
  24. Thanks water, Anyway, I just look at the example code with the dates and I found that you put single quote before the inserted date x-value, hence I did it in my code and its worked. But I would appreciate if you will have a clean way to do that. Regards and have a good trip one.
×
×
  • Create New...