This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2012-04-07 00:59:40

laptop97
Scratcher
Registered: 2011-06-27
Posts: 1000+

Deleting Scratch Shortcut

This code is for the Windows Scratch 1.4 shortcut incase you deleted it. It only works well if you installed Scratch in the default location. Copy and paste the following code in a Notepad document and save it anywhere as "Any name you want here.bat" ; including the quatation marks.

Code:

@ECHO off
Title Start MIT Scratch
cls
ECHO Starting MIT Scratch. Please wait...
IF EXIST "C:\Program Files (x86)\Scratch" GOTO x86
IF EXIST "C:\Program Files\Scratch" GOTO PF
IF EXIST "C:\Scratch" GOTO C
ECHO.
ECHO System could not find MIT Scratch in C:\, C:\Program Files\, or C:\Program Files (x86)\.
GOTO Retry
:Retry
ECHO.
set /p var=Did you install the program somewhere else? (Yes/No)  
If %var%==yes GOTO Different
If %var%==Yes GOTO Different
If %var%==no GOTO Error
If %var%==No GOTO Error
GOTO Retry
:Different
ECHO.
ECHO Type in the Drive:\Path\  (With the Scratch file path at the end.) Make sure to use the ending \ mark.
set /p var=Drive:\Path\ -  
If NOT EXIST "%var%scratch.exe" GOTO Error
cd "%var%"
start scratch.exe
exit
:Error
ECHO.
ECHO Could not find the file. Contact the website directors/administrators.
ECHO.
ECHO Closing...
ECHO.
Pause
Exit
:PF
cd "C:\Program Files\Scratch\"
start scratch.exe
exit
:x86
cd "C:\Program Files (x86)\Scratch\"
start scratch.exe
exit
:C
cd "C:\Scratch\"
start scratch.exe
exit

Open it and it should open Scratch  smile  Please report any bugs.

Offline

 

#2 2012-04-07 06:38:33

LS97
Scratcher
Registered: 2009-06-14
Posts: 1000+

Re: Deleting Scratch Shortcut

That's a pretty cool application of Batch code to the Scratch world!
Do you think that could be expanded to actually create a wizard that finds the program, and then creates the shortcut automatically for future uses, without having to go through the process again?

Consider using IF EXIST command to check for a file or directory, without having to actually ask the user and depend on what they tell you!  smile

Offline

 

#3 2012-04-07 10:07:18

laptop97
Scratcher
Registered: 2011-06-27
Posts: 1000+

Re: Deleting Scratch Shortcut

LS97 wrote:

That's a pretty cool application of Batch code to the Scratch world!
Do you think that could be expanded to actually create a wizard that finds the program, and then creates the shortcut automatically for future uses, without having to go through the process again?

Consider using IF EXIST command to check for a file or directory, without having to actually ask the user and depend on what they tell you!  smile

I could try, but I don't know how to create a shortcut in cmd  hmm .

Offline

 

Board footer