Jump to content

Recommended Posts

Posted

I have searched/read these forums and the AutoIt help file and cannot seem to return to string a line of text that has ASCII characters in it, and to be honest I need everything *but* the ASCII data.

For those unfamiliar with Flash, the type of file is a Flash *.sol (Shared Objects) file that is generated by Flash Projector file (movie.swf=>movie.exe). This is typically ran from a distributed presentation CD.

The data that is returned at the console if:

type c:\sharedobject.sol >test.txt

Is:

¿   /TCSO      sharedobject     param ##1test.ext

The only data I want/need is the ##1test.ext. Thats it, thats all I want.

The methods I've tried thus far:

;found at: http://www.autoitscript.com/forum/index.php?s=&showtopic=15422&view=findpost&p=106049
#include <Constants.au3>
Global $cmdOUT = ''
$PID = Run("type c:\sharedobject.sol", "", @SW_HIDE, $STDOUT_CHILD)
While NOT @ERROR
      $cmdOUT =& StdoutRead($PID);returns nothing
      $cmdOUT =& StdoutRead($PID, 0, 1);returns nothing
      $cmdOUT =& StdoutRead($PID, 50, 1);returns nothing
Wend
MsgBox(1, "dynaswish.sol:", $cmdOUT)

And I've tried straight from the AI help file:

$file = FileOpen("c:\sharedobject.sol", 0)
; Check if file opened for reading OK
If $file = -1 Then
    MsgBox(0, "Error", "Unable to open file.")
    Exit
EndIf
; Read in lines of text until the EOF is reached
While 1
    $line = FileReadLine($file)
;If @error = -1 Then ExitLoop
    MsgBox(0, "Line read:", $line)
Wend
FileClose($file)

Is this even possible? Thanks for any input.

Posted (edited)

Wouldn't the DOS command type a > b simply duplicate the file?

Does the information that you want always follow some constant symbol like ##? You could use a combination of StringMid() and StringInStr() or perhaps StringSplit() if this is the case.

Edit: Perhaps the file contains null characters, which would cause problems if you're trying to read the file using AutoIt. Actually, now that I think about it perhaps the DOS type command converts nulls to spaces when displaying data.

Edited by LxP
  • Developers
Posted

your script has several syntax issues... here is a version that works:

Global $cmdOUT = ''
$PID = Run(@ComSpec & " /c type c:\boot.ini", "", @SW_HIDE, 2 )
While NOT @ERROR
     $cmdOUT &= StdoutRead($PID);returns nothing
Wend
MsgBox(1, "dynaswish.sol:", $cmdOUT)

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Posted (edited)

Global $cmdOUT = ''
$PID = Run(@ComSpec & " /c find /i ""##"" c:\dynaswish.sol", "", @SW_HIDE, 2 )
While NOT @ERROR
$cmdOUT &= StdoutRead($PID);returns nothing
Wend
MsgBox(1, "dynaswish.sol:", $cmdOUT)

Works like a charm! Thanks for the examples and tips!

Edited by a6m1n0

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...