Jump to content

Search the Community

Showing results for tags 'return'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • General
    • Announcements and Site News
    • Administration
  • AutoIt v3
    • AutoIt Help and Support
    • AutoIt Technical Discussion
    • AutoIt Example Scripts
  • Scripting and Development
    • Developer General Discussion
    • Language Specific Discussion
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office


  • AutoIt Team
    • Beta
    • MVP
  • AutoIt
    • Automation
    • Databases and web connections
    • Data compression
    • Encryption and hash
    • Games
    • GUI Additions
    • Hardware
    • Information gathering
    • Internet protocol suite
    • Maths
    • Media
    • PDF
    • Security
    • Social Media and other Website API
    • Windows
  • Scripting and Development
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Find results in...

Find results that contain...

Date Created

  • Start


Last Updated

  • Start


Filter by number of...


  • Start



Member Title




Found 9 results

  1. Hi. If I embedd a compiled autoit script into my new script, is there a possibility to pass some data from the compiled embedded exe to my script? I know it's possible with an ini or txt-file. But is there something without creating a file? I plan to return an array or an unformatted string of datas with delimiters inside. Any ideas? Regards, Conrad
  2. Hi, I'm trying to replace line breaks. But when there are two or more of them keep them. At the end it should reformat copied text with unwanted line breaks. This is my code: #include <MsgBoxConstants.au3> ;~ Local $sText = ClipGet() Local $sText = "asd" & @CRLF & "asd" & @CRLF & "asd" & @CRLF & "asd" & @CRLF & "asd" & @CRLF & @CRLF & "asd" & @CRLF & "asd" & @CRLF & "asd" & @CRLF & "asd" & @CRLF & "asd" & @CRLF & @CRLF & "asd" MsgBox($MB_TOPMOST, "Original", $sText) Local $sRegexKillEnters = "(?m)(?<=\V)\v(?!\v|\h\h|\t)" ; (first all but Enter)Enter(but not if Enter or 2 Spaces or a Tab - if one wrote a list) $sText = StringRegExpReplace($sText, $sRegexKillEnters, " ") MsgBox($MB_TOPMOST, "Kill Enters", $sText & @CRLF & @CRLF & "Extended: " & @extended) I would expect: asd asd asd asd asd asd asd asd asd asd asd but get no error code and this: asd asd asd asd asd asd asd asd asd asd asd It works at regex101.com with flavour pcre: https://regex101.com/r/aTmV2T/1 but @AZJIO RegExp-Tester gives @Extended = 11. What is my mistake? Simpel
  3. Afternoon! I have a requirement to return both a string and an array from a function so as a result I put them both into an array and returned that. I can access them in their entirety after returning them but then I can't seem to access the array elements after this. Should I be able to or is there a prettier way? #include <Array.au3> ;Memory info returned as a string and an array $memoryInfo = _getMemoryInfo() msgbox(0,"Memory Info",$memoryInfo[0]) _ArrayDisplay($memoryInfo[1],"Memory as an Array") Local $newArray[7] $memoryInfo[1] = $newArray msgbox(0,"Test element",$newArray[0]) _ArrayDisplay($newArray) Func _getMemoryInfo() Local $newArray[7] Local $array = MemGetStats() $newArray[0] = $array[0] ;% of memory in use $newArray[1] = Round($array[1]/1024 * 0.001,2) ;Total physical RAM $newArray[2] = Round($array[2]/1024 * 0.001,2) ;Availaible physical RAM $newArray[3] = Round($array[3]/1024 * 0.001,2) ;Total pagefile $newArray[4] = Round($array[4]/1024 * 0.001,2) ;Available pagefile $newArray[5] = Round($array[5]/1024 * 0.001,2) ;Total virtual $newArray[6] = Round($array[6]/1024 * 0.001,2) ;Available virtual $memoryUsage = $newArray[1] - $newarray[2] $pagefileUsage = $newArray[3] - $newarray[4] ;Output/Return Local $returnArray[2] $returnArray[0] = "Memory: " & $memoryUsage & " GB/" & $newArray[1] & " GB " & @CRLF & "Pagefile: " & $pagefileUsage & " GB/" & $newArray[3] & " GB " $returnArray[1] = $newArray return $returnArray EndFunc A bit messy but hopefully it's understandable what I'm trying to achieve. Thanks!
  4. 2 writes and how returning? $var1 = "1.variable" $var2 = "2.variable" $var3 = "3.variable" For $i = 1 To 3 Step 1 MsgBox(0,"test Message header",$var1) Next For $i = 1 To 3 Step 1 MsgBox(0,"test Message header",$var2) Next If ($var2 = 2) Then Return $var1 For $i = 1 To 3 Step 1 MsgBox(0,"test Message header",$var3) Next
  5. #Region ### START Koda GUI section ### Form=c:\users\paulo\documents\gui.kxf Global $Form1_1 = GUICreate("Test", 499, 196, -1127, 323) Global $Amount = GUICtrlCreateLabel("Amount", 176, 80, 40, 17) Global $AmountInput = GUICtrlCreateInput("", 224, 80, 57, 21) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### $x = This one is just a test, but I want the value of $x to be whatever numbers the user types in.
  6. Maybe I'm just too tired, but I came across this and didn't quite know how to solve it at once: Func myFunc() If $something Then StopTimer() Return 0 ElseIf $somethingElse Then StopTimer() Return 1 Else StopTimer() Return 2 EndIf EndFunc My idea was to make a return function to get rid of all the StopTimer() lines: Func MyFunc_Return($val) StopTimer() Return $val EndFunc And then use it like so: If $something Then MyFunc_Return(0) ElseIf $somethingElse Then... But then the problem persists of course - how do we get MyFunc to actually return and exit the function? In my real script there is lots of returns... Edit: bleh typo... how do I change topic title?
  7. I created a GUI UDF() I called PickList() that returns the chosen value from the "pick list". Is there a prefered way to RETURN a value from the GUI and use GuiDelete() ? If I simply issue the GuiDelete() before RETURN, my return value is lost. OR Am I worring too much about using GUIDelte()?. The GUI does go away when the UDF is finished without using GuiDelete(), but I thought it is considered good form to call GuiDelete() at the end of a program to "clean up". thanks in advance. Jim Rumbaugh
  8. Hi, I've written two scripts - a sender and a receiver - that sends a file across a TCP connection. The sender reads the file, then splits it in to chunks and populates it in an array. It then creates a TCP connection to the the receiver and sends the chunks across. The receiver populates the chunks in to an array on it's side of the network, then, once it has received all the chunks, writes the file to disk using the _FileWriteFromArray function. All is working well, as expected, however, the _FileWriteFromArray function appears to prepend and tail the output file with a carriage return (hex: 0D 0A). Is there any way to disable this functionality? The data integrity needs to be 100% intact as the send and receive binaries will be md5'd and compared. Thanks for your time, Crisko SEND SCRIPT: #include <File.au3> #include <Array.au3> FileDelete("C:\testlog.log") hotkeyset("{Esc}","quit") $destinationIPAddress = $CmdLine[1] $destinationPort = $CmdLine[2] $sendFile = FileRead ($CmdLine[3]) $fileLength = StringLen($sendFile) $chunkSize = 0 ;Local $fileArray ;_FileReadToArray($sendFile, $fileArray) ;MsgBox(0, "", $fileLength) FileDelete("C:\testlog.log") $Success = false $i = 2 $remainder = 1 While $Success == False If $remainder <> 0 Then ;logwrite("If statement executed") $i = $i + 1 Else ;logwrite("Else statement executed") $chunkSize = $i If $chunkSize > 1023 AND $chunkSize < 8097 Then $Success = true ExitLoop Else $Success = False $i = $i + 1 EndIf EndIf $remainder = Mod ($fileLength, $i) ;logwrite("Divider is: " & $i & " | Remainder is: " & $remainder) WEnd IniWrite("\\diskstation\public\xFPTool\config.ini", "System", "chunkSize", $chunkSize) ;MsgBox (0, "", $chunkSize, 5) $chunkCount = $fileLength / $chunkSize IniWrite("\\diskstation\public\xFPTool\config.ini", "System", "chunkCount", $chunkCount) Local $avSendFileChunked[$chunkCount + 1] $startDividePoint = 1 For $split = 1 to $chunkCount Step + 1 $endDividePoint = $startDividePoint + $chunkSize $avSendFileChunked[$split] = StringMid($sendFile, $startDividePoint, $endDividePoint) ;logwrite("Split iteration: " & $split & " | Start Divide Point: " & $startDividePoint & " | End Divide Point: " & $endDividePoint & " | Array Count: " & $avSendFileChunked[$split]) $startDividePoint = $endDividePoint + 1 Next TCPStartup() Do $ConnectedSocket = TCPConnect($destinationIPAddress, $destinationPort) ;Sleep(2500) Until $ConnectedSocket <> -1 For $sendCount = 1 to $chunkCount Step + 1 ;$sendData = StringtoBinary($avSendFileChunked[$sendCount]) $sendStatus = TCPSend($ConnectedSocket, $avSendFileChunked[$sendCount]) ;logwrite("Send Iteration: " & $sendCount & " ||| Send Status: " & $sendStatus) Next TCPCloseSocket($ConnectedSocket) TCPShutdown() Func logwrite($data) FileOpen("C:\testlog.log", 9) FileWriteLine("C:\testlog.log", $data) FileClose("C:\testlog.log") EndFunc Func quit() Exit EndFunc Exit RECEIVE SCRIPT: #include <String.au3> #include <File.au3> FileDelete("C:\testlog2.log") hotkeyset("{Esc}","quit") $localIPAddress = @IPAddress1 $listeningPort = $CmdLine[1] $xFPSenderModule = "C:\xFP Sender\xFP_Sender.exe" $sendFile = $CmdLine[2] $remoteIPAddress = $CmdLine[3] $chunkSize = IniRead("\\diskstation\public\xFPTool\config.ini", "System", "chunkSize", "") $chunkCount = IniRead("\\diskstation\public\xFPTool\config.ini", "System", "chunkCount", "") Local $avChunkedFile[$chunkCount + 1] TCPStartup() $mainSocket = TCPListen($localIPAddress, $listeningPort) If $mainSocket = -1 Then Exit $connectedSocket = -1 Do $connectedSocket = TCPAccept($mainSocket) Until $connectedSocket <> -1 For $i = 1 to $chunkCount Step +1 $avChunkedFile[$i] = TCPRecv($connectedSocket, $chunkSize) ;logwrite($avChunkedFile[$i]) Next _FileWriteFromArray("C:\output.bin", $avChunkedFile) TCPCloseSocket($connectedSocket) TCPShutdown() Func logwrite($data) FileOpen("C:\testlog2.log", 9) FileWriteLine("C:\testlog2.log", $data) FileClose("C:\testlog2.log") EndFunc Func quit() Exit EndFunc Exit
  9. Hi everybody, I have some code for acquiring webcam image using [WM_CAP_DRIVER_CONNECT], Unfortunately [WM_CAP_DRIVER_CONNECT] return nothing. I have been reading about [WM_CAP_DRIVER_CONNECT] on MSDN LINK, they said So my question is, How can I get returned value from [WM_CAP_DRIVER_CONNECT].? Any help would be greatly appreciated.
  • Create New...