Jump to content

Recommended Posts

Posted

So this script runs great when using the run script option, but when I compile it to a EXE it just keeps running and never exits. Here is the code:

$Printer = "LDLAPChecks"
$Server = "PlanetPress"

$answer = InputBox("LDL Ap Checks", "How meny checks do you want to print?")
$answer1 = $answer

FileDelete("C:\APChecks.txt")
$file = FileOpen("c:\APChecks.txt", 1)

While $answer1 > 0
FileWrite($file, "." & @CRLF)
$answer1 = $answer1 - 1
WEnd

FileClose($file)


$LprCmd = "lpr -S " & $Server & " -P " & $Printer & " C:\APChecks.txt"
Run($LprCmd, @TempDir, @SW_HIDE) 


MsgBox(4096, "AP Checks Printed", $answer & " Print Job(S) Sent Successfully")
FileDelete("C:\APChecks.txt")
Exit
Posted

Are you compiling it to "lpr.exe"? If so, the Run command will cause the program to run itself over and over again, since the program "lpr" in the current directory will take precedence over the "lpr" command.

Posted

It's happened before, quite a few times if I remember correctly. There were a couple separated instances, I think, where people had scripts that used the "ftp" command and compiled the script to "FTP.exe", so the program duplicated itself a zillion times. All in good fun. :o

Posted

Hi,

I am cofused; I have a number of scripts which do this when compiled, but none of them , that I know , have such a run command that would do this. I have had to put "singleton" command at the begining of them; I thoght it was expected behaviour, else why would there be such a function...

I don't know still why these other scripts do that..

How can I check?

Best, Randall

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...