Search the Community
Showing results for tags 'Write'.
-
I have a string containing the full path of an executable and an array of executables without their paths. I am trying to compare the string to the list in the array and if a match is found, remove it from the array. The entry get removed from the array successfully, and after checking its return result, uses it to update the ubound if it succeeded, but it doesn't want to update to the new value. Any ideas what I am doing wrong? It acts like it is read-only. #include <Array.au3> #include <File.au3> Local $sApp_Exe = "F:\App\Nextcloud\nextcloud.exe" Local $aWaitForEXEX = [3, "Nextcloud.exe", "nextcloudcmd.exe", "QtWebEngineProcess.exe"] For $h = 1 To $aWaitForEXEX[0] If StringInStr($sApp_Exe, $aWaitForEXEX[$h]) <> 0 Then $iRet = _ArrayDelete($aWaitForEXEX, $h) If $iRet <> -1 Then $aWaitForEXEX[0] = $iRet ;this line doesn't work. $aWaitForEXEX[0] doesn't update and shortly gives Error: Array variable has incorrect number of subscripts or subscript dimension range exceeded.: _ArrayDisplay($aWaitForEXEX) EndIf Next
-
My solution is to write nested arrays without copying. The problem was described hier. Function: #include <Array.au3> ; #FUNCTION# ==================================================================================================================== ; Name ..........: _ArrayNestedSet ; Description ...: Assigns a value to an element of a nested 1D array. ; Syntax ........: _ArrayNestedSet(ByRef $aArray, $vIndex, $vValue) ; Parameters ....: $aArray - an array of arrays. ; $vIndex - an index or 1d-array of indexes; ; a size if $vValue not defined (zero to delete). ; $vValue - a value (create, resize or delete if not defined). ; ; Return values .: on success - 1 ; @extended - nesting level of operation ; on failure - 0 ; @extended - nesting level of error ; @error = 1 - invalid array ; @error = 2 - invalid index ; Author ........: ; Modified ......: kovlad ; Remarks .......: ; Related .......: ; Link ..........: https://www.autoitscript.com/forum/topic/185638-assign-a-value-to-an-array-in-array-element/ ; https://www.autoitscript.com/trac/autoit/ticket/3515?replyto=description ; Example .......: Yes ; =============================================================================================================================== Func _ArrayNestedSet(ByRef $aArray, $vIndex, $vValue = Default) Local $extended = @extended + 1 If IsArray($vIndex) Then If UBound($vIndex, 0) <> 1 Then _ Return SetError(2, $extended) If UBound($vIndex) > 1 Then If UBound($aArray, 0) <> 1 Then _ Return SetError(1, $extended) ; keep index for this array Local $i = $vIndex[0] If $i < 0 Or UBound($aArray) <= $i Then _ Return SetError(2, $extended) ; delete index of this array _ArrayDelete($vIndex, 0) ; recursive function call Local $return = _ArrayNestedSet($aArray[$i], $vIndex, $vValue) If @error Then Return SetError(@error, @extended + 1, 0) Else Return SetExtended(@extended + 1, 1) EndIf Else $vIndex = $vIndex[0] EndIf EndIf If $vValue = Default Then If $vIndex < 0 Then _ Return SetError(2, $extended) If $vIndex = 0 Then ; delete array and free memory $aArray = 0 Return SetExtended($extended, 1) EndIf If UBound($aArray, 0) = 1 Then ; resize array keeping data ReDim $aArray[$vIndex] Return SetExtended($extended, 1) Else ; create new nested array Local $aTmp[$vIndex] $aArray = $aTmp Return SetExtended($extended, 1) EndIf Else If UBound($aArray) <= $vIndex Then _ Return SetError(2, $extended + 1) ; set value of array entry $aArray[$vIndex] = $vValue Return SetExtended($extended, 1) EndIf EndFunc Examples: ; write value to 1st nested array ConsoleWrite("@@ Debug(" & @ScriptLineNumber & ") : write value to 1st nested array" & @CRLF) Local $aTmp1[4] = [1,2,3,4] _ArrayDisplay($aTmp1, "$aTmp1") Local $aArray[2] = [$aTmp1] ConsoleWrite( _ "_ArrayNestedSet($aArray[0], 3, 14) = " & _ArrayNestedSet($aArray[0], 3, 14) & @CRLF & _ " @error = " & @error & @CRLF & _ " @extended = " & @extended & @CRLF & @CRLF) _ArrayDisplay($aArray[0], "$aArray[0]") ; resize 1st nested array ConsoleWrite("@@ Debug(" & @ScriptLineNumber & ") : resize 1st nested array" & @CRLF) ConsoleWrite( _ "_ArrayNestedSet($aArray[0], 8) = " & _ArrayNestedSet($aArray[0], 8) & @CRLF & _ " @error = " & @error & @CRLF & _ " @extended = " & @extended & @CRLF & @CRLF) _ArrayDisplay($aArray[0], "$aArray[0]") ; write array to 1st nested array ConsoleWrite("@@ Debug(" & @ScriptLineNumber & ") : write array to 1st nested array" & @CRLF) Local $aTmp11[4] = [11,12,13,14] _ArrayDisplay($aTmp11, "$aTmp11") ConsoleWrite( _ "_ArrayNestedSet($aArray[0], 2, $aTmp11) = " & _ArrayNestedSet($aArray[0], 2, $aTmp11) & @CRLF & _ " @error = " & @error & @CRLF & _ " @extended = " & @extended & @CRLF & @CRLF) _ArrayDisplay(($aArray[0])[2], "($aArray[0])[2]") ; write value to 2nd nested array using index array ConsoleWrite("@@ Debug(" & @ScriptLineNumber & ") : write value to 2nd nested array using index array" & @CRLF) Local $aIndex1[2] = [2,3] _ArrayDisplay($aIndex1, "$aIndex1") ConsoleWrite( _ "_ArrayNestedSet($aArray[0], $aIndex1, 140) = " & _ArrayNestedSet($aArray[0], $aIndex1, 140) & @CRLF & _ " @error = " & @error & @CRLF & _ " @extended = " & @extended & @CRLF & @CRLF) _ArrayDisplay(($aArray[0])[2], "($aArray[0])[2]") ; resize 2nd nested array ConsoleWrite("@@ Debug(" & @ScriptLineNumber & ") : resize 2nd nested array" & @CRLF) Local $aIndex1[2] = [2,8] _ArrayDisplay($aIndex1, "$aIndex1") ConsoleWrite( _ "_ArrayNestedSet($aArray[0], $aIndex1) = " & _ArrayNestedSet($aArray[0], $aIndex1) & @CRLF & _ " @error = " & @error & @CRLF & _ " @extended = " & @extended & @CRLF & @CRLF) _ArrayDisplay(($aArray[0])[2], "($aArray[0])[2]") ; create new 3rd nested array ConsoleWrite("@@ Debug(" & @ScriptLineNumber & ") : create new 3rd nested array" & @CRLF) Local $aIndex2[3] = [2,7,6] _ArrayDisplay($aIndex2, "$aIndex2") ConsoleWrite( _ "_ArrayNestedSet($aArray[0], $aIndex2) = " & _ArrayNestedSet($aArray[0], $aIndex2) & @CRLF & _ " @error = " & @error & @CRLF & _ " @extended = " & @extended & @CRLF & @CRLF) _ArrayDisplay((($aArray[0])[2])[7], ")($aArray[0])[2])[7]") ; delete 3rd nested array ConsoleWrite("@@ Debug(" & @ScriptLineNumber & ") : delete 3rd nested array" & @CRLF) Local $aIndex3[3] = [2,7,0] _ArrayDisplay($aIndex3, "$aIndex2") ConsoleWrite( _ "_ArrayNestedSet($aArray[0], $aIndex3) = " & _ArrayNestedSet($aArray[0], $aIndex3) & @CRLF & _ " @error = " & @error & @CRLF & _ " @extended = " & @extended & @CRLF) ConsoleWrite("IsArray((($aArray[0])[2])[7]) = " & IsArray((($aArray[0])[2])[7]) & @CRLF & @CRLF) ; write 0 in 1st nested array to delete the 2nd nested array ConsoleWrite("@@ Debug(" & @ScriptLineNumber & ") : write 0 in 1st nested array to delete the 2nd nested array" & @CRLF) Local $aIndex4[1] = [2] _ArrayDisplay($aIndex4, "$aIndex4") ConsoleWrite( _ "_ArrayNestedSet($aArray[0], $aIndex4, 0) = " & _ArrayNestedSet($aArray[0], $aIndex4, 0) & @CRLF & _ " @error = " & @error & @CRLF & _ " @extended = " & @extended & @CRLF) ConsoleWrite("IsArray(($aArray[0])[2]) = " & IsArray(($aArray[0])[2]) & @CRLF & @CRLF) ; delete 1st nested array (same as '$aArray[0] = 0') ConsoleWrite("@@ Debug(" & @ScriptLineNumber & ") : delete 1st nested array (same as '$aArray[0] = 0')" & @CRLF) Local $aIndex5[1] = [0] _ArrayDisplay($aIndex5, "$aIndex5") ConsoleWrite( _ "_ArrayNestedSet($aArray[0], $aIndex5) = " & _ArrayNestedSet($aArray[0], $aIndex5) & @CRLF & _ " @error = " & @error & @CRLF & _ " @extended = " & @extended & @CRLF) ConsoleWrite("IsArray($aArray[0]) = " & IsArray($aArray[0]) & @CRLF & @CRLF)
-
(Edited from original. Please note that I AM NOT AN AUTOIT EXPERT. I write code using Autoit frequently but I am no expert, especially when it comes to I/O. So any remarks that start with "Why did you..." can be answered by referring to the first sentence. This project was done in Autoit because of an interface I built to display the data.) Attached is a program and ascii input file I wrote to read stock price data, convert it to binary and then read it back into the program in binary. The goal was to show increased performance for reading the files in binary and provide a demo on how to read/write binary for int32, int64, double and strings for anyone who might find it helpful. The results on my PC show the following: Time to read ascii file only: 456.981951167202 Ascii read & process time: 6061.83075631701 Binary write file time: 14787.9184635239 Time just to read binary file: 42.418867292311 Binary read and process time: 4515.16129830537 A couple things to note: 1) The 32 MB ascii file took 10x longer to read than the 15 MB binary file. Not entirely sure why. Both were read into a buffer. 2) The Binary write takes a long time but I made no effort to optimize this because the plan was to write this file one time only so I don't mind if it takes longer to write this file. I care much more about how long it takes to read the file because I will be reading it many times. 3) There was a modest gain in converting the ascii file to binary in terms of file size and reading speed. So big picture... not sure it's worth the effort to convert the files to binary even though most of the data is numerical data in the binary file. That was actually surprising as I expected there would be more of a difference. Any ideas on how to get the binary data to read at a faster rate would be great. binary.au3 2019_02_08.zip
-
good morning sirs. please i have a request from you. i have an variable to Read a data from a file this data is Encrypted and when i read it i Decrypte it. for that i need a function to Write a ini data to string. ;#Function# ===================================================================================================================== ; Name............: _IniReadFromString ; Description.....: Returns the value of a key in a specific section of an ini-formatted string ; Syntax..........: _IniReadFromString($szInput, $szSection, $szKey, $Default) ; Parameters......: ; $szInput - The string that contains data in ini format ; $szSection - The sectionname (just as in IniRead) ; $szKey - The keyname (just as in IniRead) ; $Default - The default value if the key does not exist or reading failed (just as in IniRead) ; Return values ..: ; Success - Returns the read value ; Failure - Returns $Default ; Author .........: FichteFoll ; Remarks ........: Works for Unicode as well as for ANSI ; Related ........: IniRead, _IniReadSectionFromString ; Link ...........; See on top ; Example ........; $var = _IniReadFromString(StringFormat("[Sect]\r\nMyKey1=value1\r\nMyKey2=value2"), "Sect", "MyKey2", "no_value") ; =============================================================================================================================== Func _IniReadFromString($szInput, $szSection, $szKey, $Default) $szInput = StringStripCR($szInput) ;~ Local $aRegMl = StringRegExp($szInput, "\[" & __StringEscapeRegExp($szSection) & "\]\n+(?:[^\[].*?=.*\n)*" & __StringEscapeRegExp($szKey) & "=(.*)\n?(",3) Local $aRegMl = StringRegExp($szInput, "\[" & __StringEscapeRegExp($szSection) & "\]\n+(?:[^\[].*?=.*\n)*" & __StringEscapeRegExp($szKey) & "=(.*)\n?", 3) If @error Then Return SetError(1, 0, $Default) ; key not found Return $aRegMl[0] EndFunc;==>_IniReadFromString ; ############################################################################################################################### ; =============================================== ; = Internal Use Only ; =============================================== Func __StringEscapeRegExp($szExp) Return StringRegExpReplace($szExp, "([\(\)\[\]\{\}\\\/\?\.\\|\+])", "\\$1") ; ()[]{}\/?.|+ EndFunc;==>__StringEscapeRegExp like this function Read the ini from string. please ihelp me thanks in advance
-
Currently, I'm working on a program that will display Dialog boxes with either Yes or No. For each dialog, I reward the user with X amount of Credits. I'm hoping to output the amount of credits to a cell in a column (there will be 20 different columns). It will only post to a row that is equal to today's date (first column). If no row exists yet with the current date, it will start a new row. Any suggestions? Thank you
-
I have 2 items (a field box and a bypass checkbox). every time the box is checked i need the field to become writable. unchecked is read only displaying some text. this is as far as i got as I am stuck at making it read/write toggle #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <EditConstants.au3> #include <WindowsConstants.au3> $hGUI = GUICreate("Test", 500, 500) Global $hCombo = GUICtrlCreateInput("", 10, 10, 200, 20, BitOR($ES_AUTOHSCROLL,$ES_READONLY)) GUICtrlSetBkColor($hCombo,0xe7e5e5) Global $cbox = GUICtrlCreateCheckbox ("", 40,50,10,20) GUICtrlSetState($cbox, $GUI_Unchecked) GUISetState() Global $sCurrCombo = "" While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $cbox If GUICtrlRead($cbox) <> $sCurrCombo Then $sCurrCombo = GUICtrlRead($cbox) GUICtrlSetStyle ($hCombo, $SS_LEFTNOWORDWRAP) GUICtrlSetBkColor($hCombo,0xFFFFFF) MsgBox(0, "Choice", "PLease enter the text") EndIf EndSwitch WEnd
-
Hi all, Is there a way to write a string to a cell in Excel without replacing what may be already in that cell? Can this be achieved with a single function? Or will I need to read any potential data first, then join it, and then write to that cell? As the write function replaces what is already in the cell. Thanks
-
Since my last topic were closed because bot scripting aren't allowed to be discussed anymore on here. Could anyone possibly give me a good example to learn memory read/write? , i can't figure out anything else which would be a good level of difficulty to practice than "tetris bot" but since it aint legal, i wont be asking for that let me know ur ideas and i would highly appreciate if examples could be posted (My last project was a imgsrch/pxlsrch) so thought i woud move on to memory read/write, if this somehow came out wrong lmk. AND NO I'M NOT ASKING FOR A FULL CODE I WANNA CODE/SCRIPT IT MY SELF, Just show me some simple examples of Memory read/write if u can/will TYVM. Dequality.
-
Hello Autoit Scripters, Using Autoit v3.3.14.1 in Windows 7, I'm trying to write an array of X rows by 34 columns to an Excel 2000 sheet as follows: _Excel_RangeWrite ($workbook, $newsheet, $outarray) It only works up to 160 rows. An array longer than that writes nothing or hangs the system. This needs to work with up to about 32,000 rows. I've displayed $outarray right before the writing function, and it's perfect. I searched around and found an alternative to _Excel_RangeWrite that uses a different approach based on that COM stuff. It gives the same problem! The problem doesn't appear to be affected by how much data is stored in the array, only the number of rows. I must be overlooking something, like maybe a system setting. Any help would be appreciated. Thanks in advance!
-
hey guys, anyone knows how to write a string between two other strings like for example: To write AbzhdfX_d between ElseIf $sVideoLink1 = " and " then _IEAction ($oA, "click"), Simpler: to write a between b and c ,but automatically
-
hello guys, i have this list of youtube links: youtu.be/3bGqROF5ZWk youtu.be/mWRsgZuwf_8 youtu.be/DK_0jXPuIr0 youtu.be/NywWB67Z7zQ youtu.be/9fL5iWgWwno youtu.be/jofNR_WkoCE youtu.be/olFEpeMwgHk youtu.be/IgKWPcpwFDs and i'd like to put them between these quotes below: ElseIf $sVideoLink1 = " " then _IEAction ($oA, "click") ElseIf $sVideoLink2 = " " then _IEAction ($oA, "click") ElseIf $sVideoLink3 = " " then _IEAction ($oA, "click") ElseIf $sVideoLink4 = " " then _IEAction ($oA, "click") ElseIf $sVideoLink5 = " " then _IEAction ($oA, "click") ElseIf $sVideoLink6 = " " then _IEAction ($oA, "click") ElseIf $sVideoLink7 = " " then _IEAction ($oA, "click") but the problem is i have a lot of video links i want to put in there and everytime i put one, the VideoLinkNr. must be +1 if you know what i mean... can anyone help or give a clue
-
Ok so thus far the script does what it's suppose to do.. to a point. There are two complications and they are as follows: There is suppose to be ONE GUI that opens up. When i run the script it opens, but when i close it another identical one opens behind it. When i click save on the first GUI it saves like it's supposed too. BUT when i close it and reopen it, it's suppose to open with the info that was saved. I'm no pro coder, maybe it's something very small i'm not getting. Some help would be highly appreciated. Yea.. i have it saving alot :3 #include <ButtonConstants.au3> #include <EditConstants.au3> #include <MsgBoxConstants.au3> #include <GUIConstantsEx.au3> #include <GuiStatusBar.au3> #include <ProgressConstants.au3> #include <WindowsConstants.au3> Do $pass = InputBox("Enter Password", "Please enter the password", "", "*", 150, 120) If $pass <> "Password" Then EndIf If (@error == 1) Then Exit ; Until $pass == "123" MsgBox(0, "Success", "Correct password" & @CRLF & "") Global $sConfigPath = @ScriptDir & "\Settings.ini" ProgressOn("Title", "Loading program", "Loading...") For $i = 0 To 100 ProgressSet($i) Sleep(5) Next ProgressSet(50, "Half Way.") Sleep(250) ProgressSet(100, "Done!") Sleep(750) ProgressOff() #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Title", 610, 477, 206, 143) $Input1 = GUICtrlCreateInput("Date", 480, 16, 113, 21) $Input2 = GUICtrlCreateInput("Title", 16, 56, 577, 21) $Edit1 = GUICtrlCreateEdit("", 16, 80, 577, 329) $Button1 = GUICtrlCreateButton("Save", 520, 424, 75, 25, $BS_DEFPUSHBUTTON) $idProgressbar1 = GUICtrlCreateProgress(16, 424, 454, 17) $StatusBar1 = _GUICtrlStatusBar_Create($Form1) GUICtrlSetColor(-1, 32250) GUISetState(@SW_SHOW) Local $iWait = 20; wait 20ms for next progressstep Local $iSavPos = 0; progressbar-saveposition Local $idMsg, $idM ; Loop until the user exits. Do $idMsg = GUIGetMsg() If $idMsg = $Button1 Then GUICtrlSetData($Button1, "Stop") For $i = $iSavPos To 100 If GUICtrlRead($idProgressbar1) = 50 Then MsgBox($MB_SYSTEMMODAL, "Info", "half is done...", 1) $idM = GUIGetMsg() If $idM = -3 Then ExitLoop If $idM = $Button1 Then GUICtrlSetData($Button1, "Next") $iSavPos = $i;save the current bar-position to $iSavPos ExitLoop Else $iSavPos = 0 GUICtrlSetData($idProgressbar1, $i) Sleep($iWait) EndIf Next If $i > 100 Then ; $iSavPos=0 GUICtrlSetData($Button1, "Click") EndIf If GUICtrlSetData($Button1, "Click") Then IniWrite($sConfigPath, "Date", "Input1", GUICtrlRead($Input1)) IniWrite($sConfigPath, "Title", "Input2", GUICtrlRead($Input2)) IniWrite($sConfigPath, "Edit", "Edit1", GUICtrlRead($Edit1)) EndIf If IniWrite($sConfigPath, "Edit", "Edit1", GUICtrlRead($Edit1)) Then GUICtrlSetData($Button1, "Done") EndIf EndIf Until $idMsg = $GUI_EVENT_CLOSE GUICtrlSetData($Input1, IniRead($sConfigPath, "Date", "Input1", "Date")) GUICtrlSetData($Input2, IniRead($sConfigPath, "Title", "Input2", "Title")) GUICtrlSetData($Edit1, IniRead($sConfigPath, "Edit", "Edit1", "Start writing...")) While 1 $idMsg = GUIGetMsg() Switch $idMsg Case $GUI_EVENT_CLOSE ; Note: Exit needs to be changed to ExitLoop ; for any code after the loop to execute. ExitLoop EndSwitch If $idMsg = $GUI_EVENT_CLOSE Then ExitLoop If $idMsg = $Button1 Then SendMyData() WEnd Func Button1Click() IniWrite($sConfigPath, "Date", "Input1", GUICtrlRead($Input1)) IniWrite($sConfigPath, "Title", "Input2", GUICtrlRead($Input2)) IniWrite($sConfigPath, "Edit", "Edit1", GUICtrlRead($Edit1)) EndFunc ;==>Button1Click IniWrite($sConfigPath, "Date", "Input1", GUICtrlRead($Input1)) IniWrite($sConfigPath, "Title", "Input2", GUICtrlRead($Input2)) IniWrite($sConfigPath, "Edit", "Edit1", GUICtrlRead($Edit1)) Func SendMyData() FileDelete('Settings.ini') $data = "[General]" & @CRLF & GUICtrlRead($Input2) & @CRLF & @CRLF & GUICtrlRead($Edit1) FileWrite('\Settings.ini', $data) MsgBox(0, 'Info', 'Data saved') EndFunc ;==>SendMyData #EndRegion ### END Koda GUI section ###
-
How to FileWriteLine() Chinese characters?
Servant posted a topic in AutoIt General Help and Support
First, the value of my $LineArray[0] is "歌词制作 生态。破坏".. And whenever I tried to run this code: FileWriteLine($PathName, $LineArray[0] & @CRLF) The line of the created file produced the "???? ?????" null characters.. Now, what can I do to make it write the original (I think) Chinese characters? -
For example my GUICtrlCreateEdit() contains: Line 1 Line 2 Line 3 When I IniWrite() the content of it, the value will be look like this: [SectionName] Key=Line 1 Line 2 Line 3 But when I IniRead() that key like this: GUICtrlCreateEdit(IniRead(@ScriptDir & "/data.ini", "SectionName", "Key", ""), 1, 1, 200, 100) The value of the GUI edit field is only "Line 1".. How can I INI write and read a text with line breaks in a GUICtrlCreateEdit() ?
-
I wrote a script that is designed to log at least 10,000 lines of data. While timing it in the beginning, I figured this will take a while so I decided to afk. I came back shortly and found an error came up in the script C:\Program Files (x86)\AutoIt3\Include\Excel.au3 (451) : ==> The requested action with this object has failed.: $oExcel.Activesheet.Cells($sRangeOrRow, $iColumn).Value = $sValue $oExcel.Activesheet.Cells($sRangeOrRow, $iColumn).Value = $sValue^ ERROR About six thousand lines were produced in the file successfully, but I was wondering what could have caused this error?
- 7 replies
-
- excel
- spreadsheet
-
(and 1 more)
Tagged with:
-
I'm trying to write a test .txt file with test being the word I want to put into the GUI window. Kinda stuck any help would be appreciated. (work in progress) #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <GuiButton.au3> #include <StaticConstants.au3> #include <EditConstants.au3> Global $file = FileOpen("test.txt") GUICreate("Disclaimer", 500, 400) ;Creates the GUI window fileread($file, 400) GUISetState(@SW_SHOW) ;Shows the GUI window sleep(5000) fileclose($file)
-
This line was originally used instead of the FileOpen and FileWrite commands _WinAPI_WriteFile($hFile, DllStructGetPtr($tBuffer), StringLen($sText), $nBytes) But WinAPI would only erase my prev text. But FileOpen and FileWrite doesn't work. The file is generated, but no text is inserted. #include <WinAPI.au3> #include <Date.au3> DirCreate("C:\Inventory\Log") Global $sFile, $hFile, $sText, $nBytes, $tBuffer $aDato = _Date_Time_GetSystemTime() $Dato = _Date_Time_SystemTimeToArray($aDato) _WriteToLog("Topic", "text") _WriteToLog("Topic2", "text2") Func _WriteToLog($labelname, $Recv) $sFile = 'C:\Inventory\Log\' & $dato[2] & $dato[0] & $dato[1] & '.log' $sText = '' & $labelname & ' | ' & $Recv & ' ' & @CRLF & '' $tBuffer = DllStructCreate("byte[" & StringLen($sText) & "]") DllStructSetData($tBuffer, 1, $sText) $hFile = _WinAPI_CreateFile($sFile, 1) FileOpen($sFile, 1) FileWrite($sFile, $sText) _WinAPI_CloseHandle($hFile) ConsoleWrite('1) ' & FileRead($sFile) & @CRLF) EndFunc ;==>_WriteToLog Thanks for all help =)