Skip to content

Fix bugs and more scripts

Compare
Choose a tag to compare
@suchsoak suchsoak released this 19 Nov 14:41
· 86 commits to main since this release
d144681
 ___                                             _  _ __  _   
| _ \ ___  _ __ __  ___  _ _        ___ __  _ _ (_)| '_ \| |_ 
|  _// _ \ \ V  V // -_)| '_|      (_-// _|| '_|| || .__/|  _|
|_|  \___/  \_/\_/ \___||_|        /__/\__||_|  |_||_|    \__|

            Github: https://github.com/schsoak
            v:1.0.3
            BY: ~#M?x

            [1] Wsl                     [9] IDE
            [2] Firewall rules          
            [3] Browser Install 
            [4] Drive Reset    
            [5] NetReset 
            [6] Disk Verification 
            [7] Telssh 
            [8] Programming language

Details

Error handling

Note

Just an example of the code part

Before

}else {
    Write-Host "Installing Telnet..."
    Start-Sleep 3 > $null
    Add-WindowsCapability -Online -Name TelnetClient~~~~0.0.1.0
    Start-Sleep 2 > $null
    Write-Host
    Clear-Host
    Write-Host "Telnet is already installed." -ForegroundColor Red
    Write-Host
}}}

After

  default{
        Write-Host
        Write-Host "Please enter a valid number." -ForegroundColor Red
    }    catch{
        Write-Host "Error"
    }}}}

The difference between the two code snippets in terms of error handling is as follows:

In the first code snippet:

default{
    Write-Host
    Write-Host "Please enter a valid number." -ForegroundColor Red
} catch{
    Write-Host "Error"
}}}

The default block is used to catch any exception that is not handled by a specific catch block.
The catch block is used to catch specific exceptions and execute error handling code.
In the case of the first code snippet, the catch block is not specifying any type of exception to catch, so it will catch any exception that occurs and display the message "Error" in the console.

In the second code snippet:

Write-Host "Installing Telnet..."
Start-Sleep 3 > $null
Add-WindowsCapability -Online -Name TelnetClient~~~~0.0.1.0
Start-Sleep 2 > $null
Write-Host
Clear-Host
Write-Host "Telnet is already installed." -ForegroundColor Red
Write-Host
}}}

There is no default or catch block in the second code snippet.
Therefore, any exception that occurs during the execution of this code will not be explicitly handled.
The code simply continues its normal execution.

Programming Language

         _              __ _              __ _      
        | | __ _  _ _  / _` | _  _  __ _ / _` | ___ 
        | |/ _` || ' \ \__. || || |/ _` |\__. |/ -_)
        |_|\__/_||_||_||___/  \_._|\__/_||___/ \___|
        Github: https://github.com/schsoak
        Buy ME A Coffe: 
        BY: ~#M?x  

        [1] Python    [5] Swift
        [2] Ruby      [6] GO
        [3] GCC (C)   [7] Kotlin
        [4] Nodejs    [8] ALL

This scrips will install the programming languages of your choice such as python, ruby and etc..

Part of the code

switch ($language) {
1{
    Clear-Host
    $python =@"

    ___ __   __ _____  _  _   ___   _  _ 
    | _ \\ \ / /|_   _|| || | / _ \ | \| |
    |  _/ \   /   | |  | __ || (_) || .  |
    |_|    |_|    |_|  |_||_| \___/ |_|\_|
    
    
"@
    Write-Host $python -ForegroundColor Blue
    Start-Sleep 2 > $null
    Write-Host
    winget install --id=Python.Python.3.12  -e
    Clear-Host
    pip -V -ForegroundColor Blue
    Write-Host
    Write-Host "Python Installed"
    break
}

2{
    Clear-Host
    $ruby = @"

    ___  _   _  ___ __   __
    | _ \| | | || _ )\ \ / /
    |   /| |_| || _ \ \   / 
    |_|_\ \___/ |___/  |_|  
    
"@
    Write-Host $ruby -ForegroundColor Red
    Start-Sleep 2 > $null
    #Ruby on Windows
    winget install --id=RubyInstallerTeam.Ruby.3.2  -e
    Write-Host
    if ($true) {
        Ruby -v
        Write-Host "Ruby Installed"
        break
    }else {
        Write-Host "Ruby Not Installed"
        Write-Host
        Write-Host "Sorry there was really problem"
    }
} 

Here is a breakdown of how the script works:

The script starts by clearing the console screen using the Clear-Host command.

It then defines a variable called $programming that contains a multi-line string with ASCII art representing the available programming languages and some additional information.

The script displays the $programming variable using the Write-Host command, which prints the text to the console.

The script prompts the user to choose an option by reading their input using the Read-Host command and storing it in the $language variable.

The script uses a switch statement to handle different cases based on the user's input.

Each case corresponds to a different programming language option.

For example, case 1 corresponds to Python, case 2 corresponds to Ruby, case 3 corresponds to GCC (C), and so on.

Each case starts by clearing the console screen using Clear-Host and then displays ASCII art representing the selected programming language using the Write-Host command.

After displaying the ASCII art, the script installs the corresponding programming language using the winget install command.

For example, for Python, it installs the Python package using winget install --id=Python.Python.3.12.

After installing the language, the script displays a success message using Write-Host.

The script also includes a default case that is executed when the user enters an invalid option. In this case, it displays an error message using Write-Host.

Overall, the script provides a menu-driven interface for installing different programming languages on the system.

IDE

    ___  ___   ___ 
    |_ _||   \ | __|
     | | | |) || _| 
    |___||___/ |___|
    Buy ME A Coffe: https://www.buymeacoffee.com/m100047r
    Github: https://github.com/schsoak
    BY: ~#M?x

    [1] Visual Code Studio          [4] Atom                 [7] Notepadd++
    [2] PyCharm Community Edition   [5] Android Studio       [8] Rubymine
    [3] Sublime Text                [6] Arduino IDE          [9] ALL

This script is a PowerShell script that allows the user to choose and install different Integrated Development Environments (IDEs) on their system. Let's break down how the script works and what it does:

Introduction

The script starts with a brief introduction that includes ASCII art logos for each IDE and some contact information for the script's author.

Displaying Options

After the introduction, the script displays a menu of IDE options using a here-string variable called $IDE. Each option is numbered, and the user is prompted to choose an option by entering the corresponding number.

Handling User Input

The script uses a switch statement to handle the user's input. Depending on the chosen option, the script executes a specific block of code for that option.

Installing IDEs

For each option, the script clears the console screen and displays the ASCII art logo for the chosen IDE. It then waits for 2 seconds before executing the installation command using the winget install command. The installation command is specific to each IDE and is passed as an argument to the winget install command.

Error Handling

If an error occurs during the installation process, the script displays an "Error" message.

Installing All IDEs

If the user chooses option 9, the script executes a block of code that installs all the IDEs sequentially. It clears the console screen, displays a progress message for each IDE being installed, and waits for 2 seconds before executing the installation command for each IDE.

Conclusion

After all the installations are complete, the script displays a message indicating that all the IDEs have been installed.