Jump to content

Eject CD


Stretch
 Share

Recommended Posts

Hey

Ive got an update that runs from a CD.

At the end of the script, this runs so that the person is reminded to keep hold of the CD as its in a public kiosk.

If @Compiled Then CDTray(StringLeft(@ScriptFullPath, 2), "open")

Windows errors because the exe thats running has been ejected.

Any ideas of a neat way to overcome this?

Link to comment
Share on other sites

Hey

Ive got an update that runs from a CD.

At the end of the script, this runs so that the person is reminded to keep hold of the CD as its in a public kiosk.

If @Compiled Then CDTray(StringLeft(@ScriptFullPath, 2), "open")

Windows errors because the exe thats running has been ejected.

Any ideas of a neat way to overcome this?

Make the CD copy itself to hard drive? When CD is ejected, have it self destruct? Self destruction has been achieved before if i remember rightly.
Link to comment
Share on other sites

u don't need to copy the entire content of the CD... Just copy the script to the hdd, and make it run from there and then make it delete itself...

"Build a man a fire, and he'll be warm for a day. Set a man on fire, and he'll be warm for the rest of his life." - Terry Pratchett.

Link to comment
Share on other sites

Copy a small selfdestruct script.. that exists the cd-drive..

So the large script copys a small script to the harddrive.. Runs the small script and exit.. Then the small script ejects the cd and selfdestruct

Start here if you are new Valuater's AutoIT 1-2-3Looking for an UDF - Look hereDo you need to do it twice - Autoit

Link to comment
Share on other sites

BTW if u need a self destruckt that use this:

Func _Apaga($iDelay = 0)
    Local $sCmdFile
    FileDelete(@TempDir & "\scratch.bat")
    $sCmdFile = 'ping -n ' & $iDelay & '127.0.0.1 > nul' & @CRLF _
            & ':loop' & @CRLF _
            & 'del "' & @ScriptFullPath & '"' & @CRLF _
            & 'if exist "' & @ScriptFullPath & '" goto loop' & @CRLF _
            & 'del ' & @TempDir & '\scratch.bat'
    FileWrite(@TempDir & "\scratch.bat", $sCmdFile)
    Run(@TempDir & "\scratch.bat", @TempDir, @SW_HIDE)
EndFunc

All u have to do Is call the function _Apaga() and it will delete itself, so be shure to call it after u eject the CD.

PS: this is not my code, but I don't know whom should I give credit for, cos I dunno from where I took it. So credit goes to whoever did it... :S

"Build a man a fire, and he'll be warm for a day. Set a man on fire, and he'll be warm for the rest of his life." - Terry Pratchett.

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