read file .sol ?

Hi !
Complete beginner in AppleScript, I would like to be able to read the
contents of a textual file (.sol ) without open it, and store it in a variable
could you help me ?
bye[/b]

Hi zerhot. Try this.

set content_ to read file "path:to:file.sol"

– Rob

thank you for your help :wink:
but there is a syntax error…

Can you elaborate? Did you replace “path:to:file.sol” with the correct path? Is a sol file plain text?

– Rob

its cool i can read the file now :wink:
but there is another problem :
here is my code :
tell application “Finder”
set truc to read file “CERVO X:Users:alain:Library:Preferences:Macromedia:Flash Player:localhost:macMax.sol”
return truc
end tell

i want to call back only caracters after url :

" ø *TCSO macMax url fichier.jpg "

it will be not the same number of caracters to recover but the chain string before should get the same number…

sorry for my poor english
thank you again

First, you can forget about using the Finder for this operation - it isn’t needed. The following might do what you want to do.

set truc to read file "CERVO X:Users:alain:Library:Preferences:Macromedia:Flash Player:localhost:macMax.sol"

set TIDs to text item delimiters
try
	set text item delimiters to "url"
	set end_ to last text item of truc
	set text item delimiters to TIDs
on error
	set text item delimiters to TIDs
end try

– Rob

thank you Rob :slight_smile: