I have a packed auto-extract sfx file that runs the script.
Is it possible to extract the script code?
Maybe. It depends on the exact format of the archive. zip is easy since the file format has 1) a well-defined start signature, and 2) a directory at the end of the archive. Most tools that can handle zip archives could open such a sfx archive readily. For other formats it may not be so easy.