Jump to content

Unable to open the script file - when running the exe.


Recommended Posts

I wrote a small script which just reads and writes some text files and runs fine. I want to be able to run it on another computer so I did a BUILD and then tried to run the exe. It crashed with the message "Unable to open the script file". I tried a COMPILE (not sure of the difference) with the same results. I want to be able to copy this exe to run on another computer that doesn't have AutoIt installed. What did I do wrong?

Link to comment
Share on other sites

Here it is. Not much there but it runs fine as an au3.

If MsgBox(1+32,"Proceed?","This program will read all the *.URL files in the folder it" & @CR & "is run from and extract the URL= locations from them." & @CR & "They will be listed in the URL.TXT file." & @CR & "Proceed?") = 1 Then
$search = FileFindFirstFile("*.url")  
If $search = -1 Then
    MsgBox(0, "Error", "No files/directories matched the search pattern")
    Exit
EndIf
$wHnd=FileOpen('url.txt',2)
While 1
   $filename = FileFindNextFile($search) 
   If @error Then ExitLoop
   $fHnd=FileOpen($filename,0)
    If $fHnd = -1 Then
        MsgBox(0, "Error", "Unable to open file.")
        Exit
    EndIf
    $text = FileRead($fHnd)
    $url = StringMid($text,StringInStr($text,"://")+3)
    $url = StringLeft($url,StringInStr($url ,"/")-1)
    If StringLeft($url,4) = 'www.' Then
        $url = StringMid($url, 5)
    EndIf
    FileWrite($wHnd, $url & @CRLF)
    FileClose($fHnd)
WEnd
FileClose($wHnd)
FileClose($search)
MsgBox(48,'Done','URL.TXT file has been created.')
EndIf
Link to comment
Share on other sites

Here it is. Not much there but it runs fine as an au3.

If MsgBox(1+32,"Proceed?","This program will read all the *.URL files in the folder it" & @CR & "is run from and extract the URL= locations from them." & @CR & "They will be listed in the URL.TXT file." & @CR & "Proceed?") = 1 Then
$search = FileFindFirstFile("*.url")  
If $search = -1 Then
    MsgBox(0, "Error", "No files/directories matched the search pattern")
    Exit
EndIf
$wHnd=FileOpen('url.txt',2)
While 1
   $filename = FileFindNextFile($search) 
   If @error Then ExitLoop
   $fHnd=FileOpen($filename,0)
    If $fHnd = -1 Then
        MsgBox(0, "Error", "Unable to open file.")
        Exit
    EndIf
    $text = FileRead($fHnd)
    $url = StringMid($text,StringInStr($text,"://")+3)
    $url = StringLeft($url,StringInStr($url ,"/")-1)
    If StringLeft($url,4) = 'www.' Then
        $url = StringMid($url, 5)
    EndIf
    FileWrite($wHnd, $url & @CRLF)
    FileClose($fHnd)
WEnd
FileClose($wHnd)
FileClose($search)
MsgBox(48,'Done','URL.TXT file has been created.')
EndIf
The same thing is happening wth my scripts all i do is "compile with Optins"

maybe work 4 u 2

<- Paid ME $89.65
Link to comment
Share on other sites

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
 Share

  • Recently Browsing   0 members

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