Indigo Rose Software

Professional Software Development Tools

 
+ Reply to Thread
Results 1 to 12 of 12
  1. #1
    Join Date
    May 2007
    Posts
    33

    How to create application, which deletes itself?

    Hi,
    I have this problem with Autoplay Media Studio: I want to create an application, which deletes itself (which means, it deletes autorun.exe file and folder AutoPlay) after it is closed.
    I've tried to put the action File.Delete to On Shutdown, but it doesn't work. Could you help me please?

  2. #2
    Join Date
    Oct 2007
    Location
    Gensokyo
    Posts
    1,324
    Quote Originally Posted by Hofiiik View Post
    Hi,
    I have this problem with Autoplay Media Studio: I want to create an application, which deletes itself (which means, it deletes autorun.exe file and folder AutoPlay) after it is closed.
    I've tried to put the action File.Delete to On Shutdown, but it doesn't work. Could you help me please?
    Make a bat script that does something like

    Code:
    @echo off
    sleep 5
    del autorun.exe
    (sleep: http://www.computerhope.com/download/utility/sleep.exe)

    and in AMS

    File.run, application.exit

  3. #3
    Join Date
    Apr 2007
    Location
    Raalte, OV, Netherlands
    Posts
    3,287
    you could also delete the batch file itsels but that's not always working really good

    Code:
    @echo off
    sleep 5
    del autorun.exe
    del the_bat_filename.bat
    Bas Groothedde
    Imagine Programming :: Blog :: Familiar people here

    My AMS Plugins:

  4. #4
    Join Date
    May 2007
    Posts
    33
    Unfortunatelly, it doesn't work.
    I wrote a BAT file, but it seems, that the command "sleep" doesn't work, because the BAT file runs immediatelly after I close my autorun.exe file (even if I wrote there "sleep 5000")...

  5. #5
    Join Date
    Apr 2007
    Location
    Raalte, OV, Netherlands
    Posts
    3,287
    Quote Originally Posted by Hofiiik View Post
    Unfortunatelly, it doesn't work.
    I wrote a BAT file, but it seems, that the command "sleep" doesn't work, because the BAT file runs immediatelly after I close my autorun.exe file (even if I wrote there "sleep 5000")...
    You've gotta download sleep.exe (link in Shadow's post) and put it either in the folder that containes the batch file, or in System32.
    Bas Groothedde
    Imagine Programming :: Blog :: Familiar people here

    My AMS Plugins:

  6. #6
    Join Date
    May 2007
    Posts
    33
    Problem solved!
    I did it exactly how you wrote, but I forgot, that I set a working folder for BAT file and I didn't copy "sleep.exe" into this folder - now it works fine. Thank you very much

    PS: Is there a way how to set a delay lower than 1 second? (I tried to type there 0.2, but it didn't work...).

  7. #7
    Join Date
    Apr 2007
    Location
    Raalte, OV, Netherlands
    Posts
    3,287
    Quote Originally Posted by Hofiiik View Post
    Problem solved!
    I did it exactly how you wrote, but I forgot, that I set a working folder for BAT file and I didn't copy "sleep.exe" into this folder - now it works fine. Thank you very much

    PS: Is there a way how to set a delay lower than 1 second? (I tried to type there 0.2, but it didn't work...).
    I would stick to 5 seconds, you don't know how long it takes until the application is fully stopped on slower systems... I don't think there's a way to go under 1 second.
    Bas Groothedde
    Imagine Programming :: Blog :: Familiar people here

    My AMS Plugins:

  8. #8
    Join Date
    Oct 2007
    Location
    Gensokyo
    Posts
    1,324
    Just incase you could do TASKKILL /F /IM autorun.exe or something similiar.


  9. #9
    Join Date
    Apr 2007
    Location
    Raalte, OV, Netherlands
    Posts
    3,287
    But if there's more then 1 autorun.exe (eg: two Web-Executables) it ends all of them, doesn't it?
    Bas Groothedde
    Imagine Programming :: Blog :: Familiar people here

    My AMS Plugins:

  10. #10
    Join Date
    Jul 2005
    Posts
    19
    I use this:
    Code:
    tbl_selfdelete = {"@echo off","for /L %%q in (1,1,20) do (","ping -n 1 -w 2000 1.1.1.1 > nul","del /F /Q \"".._SourceFolder.."\\autorun.exe\" > nul","rd \"".._SourceFolder.."\\autorun\"" /Q > nul","if not exist \"".._SourceFolder.."\\autorun.exe\" goto exit",")",":exit","del \"".._TempFolder.."\\_del.bat > nul"}
    TextFile.WriteFromTable(_TempFolder.."\\_del.bat", tbl_selfdelete, false)
    Shell.Execute(_TempFolder.."\\_del.bat", "", "", _TempFolder, SW_MINIMIZE, false)
    Application.Exit()
    Last edited by crj; 12-21-2008 at 03:53 PM.

  11. #11
    Join Date
    Jul 2005
    Posts
    19
    Edited to delete the Autoplay-Folder:
    Code:
    tbl_selfdelete = {"@echo off","for /L %%q in (1,1,20) do (","ping -n 1 -w 2000 1.1.1.1 > nul","del /F /Q \"".._SourceFolder.."\\autorun.exe\" > nul","rd \"".._SourceFolder.."\\AutoPlay\" /Q /S > nul","if not exist \"".._SourceFolder.."\\autorun.exe\" goto exit",")",":exit","del \"".._TempFolder.."\\_del.bat > nul"}
    TextFile.WriteFromTable(_TempFolder.."\\_del.bat", tbl_selfdelete, false)
    Shell.Execute(_TempFolder.."\\_del.bat", "", "", _TempFolder, SW_MINIMIZE, false)
    Last edited by crj; 12-21-2008 at 04:09 PM.

  12. #12
    Join Date
    May 2005
    Posts
    1,115
    Instead of a sleep, just use ping, like crj suggested.
    Never know what life is gonna throw at you.
    (Based on a true story.)

  13. #13
    Join Date
    Jun 2005
    Posts
    25
    And what if application is on CD???

  14. #14
    Join Date
    Apr 2007
    Location
    Raalte, OV, Netherlands
    Posts
    3,287
    well then you simply can't erase it :P well...you actually can by removing the disc from your computer, and throw it down from 8 stories high?
    Bas Groothedde
    Imagine Programming :: Blog :: Familiar people here

    My AMS Plugins:

Similar Threads

  1. HOWTO: Create a Project Template
    By Support in forum AutoPlay Media Studio 4.0 Examples
    Replies: 0
    Last Post: 10-28-2002, 01:49 PM
  2. HOWTO: Create a Page Template
    By Support in forum AutoPlay Media Studio 4.0 Examples
    Replies: 0
    Last Post: 10-26-2002, 05:20 AM
  3. HOWTO: Distribute an AutoPlay Application with Setup Factory 6.0
    By Support in forum AutoPlay Media Studio 4.0 Examples
    Replies: 0
    Last Post: 10-25-2002, 02:33 PM
  4. INFO: Dynamically Resizing an Application at Runtime
    By Support in forum AutoPlay Media Studio 4.0 Examples
    Replies: 0
    Last Post: 10-21-2002, 02:23 PM
  5. HOWTO: Make an AutoPlay Application Expire
    By Support in forum AutoPlay Media Studio 4.0 Examples
    Replies: 0
    Last Post: 10-09-2002, 10:10 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts