Tuesday, November 3, 2026

Creating Sub menu in Chrome extension - snippet for selecting 5th value in drop down list

 background.js

// 1. Create the main parent menu item

chrome.runtime.onInstalled.addListener(() => {

  chrome.contextMenus.create({

    id: "parentMenu",

    title: "My Extension Options",

    contexts: ["all"] // Shows up on text selection, links, pages, etc.

  });


  // 2. Create sub-menu items linked to the parent ID

  chrome.contextMenus.create({

    id: "subMenu1",

    parentId: "parentMenu",

    title: "Select 5th Option",

    contexts: ["all"]

  });


  chrome.contextMenus.create({

    id: "subMenu2",

    parentId: "parentMenu",

    title: "Clear Selection",

    contexts: ["all"]

  });

});


// 3. Handle clicks on the sub-menu items

chrome.contextMenus.onClicked.addListener(async (info, tab) => {

  if (info.menuItemId === "subMenu1") {

    // Inject a script into the active page to select the 5th value

const activeTabId = info.tabId || (tab && tab.id);

    debugger;

    if (!activeTabId) {

      console.error("No active tab ID found.");

      return;

    }

    chrome.scripting.executeScript({

      target: { tabId: tab.id },

      func: selectFifthValue

    });

  } else if (info.menuItemId === "subMenu2") {

    console.log("Sub-menu 2 clicked!");

  }

});


// This function runs directly inside the web page's context

function selectFifthValue() {

  const selectElement = document.querySelector('select[formcontrolname="sectionName"]');

  if (selectElement && selectElement.options.length >= 5) {

    selectElement.selectedIndex = 5;

    selectElement.dispatchEvent(new Event('change', { bubbles: true }));

  }

  else {

  console.error("Dropdown not found. Check if your formControlName is correct.");

}

}

Saturday, October 31, 2026

Environment variable in windows

 >Right click on My computer

> Go to advanced system settings

> Click on Environment variable 

> Create a new User variable

> Enter variable name and value (example name yash and value is d:/)

> Press window button + R and then type %yash%

Thursday, October 29, 2026

How to call a function two time in chrome extension - also click on search and view in function snippets - Create Right Click in chrome with chrome extension

 menifest.json

{

  "manifest_version": 3,

  "name": "Run Snippet from Right Click",

  "version": "1.0",

  "permissions": [

    "contextMenus",

    "activeTab",

    "scripting","storage"

  ],

  "background": {

    "service_worker": "background.js"

  }

}

Tuesday, October 27, 2026

How to create extension and load extension in chrome

 

Step 1: Create a Folder

Create a new folder on your computer and name it something like SearchAndViewExtension.

Step 2: Create the Configuration File (manifest.json)

Inside that folder, create a file named manifest.json and paste the following code. This tells Chrome to register a background service worker and requests permission to run scripts:

json

{

  "manifest_version": 3,

  "name": "Run Snippet from Right Click",

  "version": "1.0",

  "permissions": [

    "contextMenus",

    "activeTab",

    "scripting"

  ],

  "background": {

    "service_worker": "background.js"

  }

}

Use code with caution.

Step 3: Create the Background Script (background.js)

Inside the same folder, create a file named background.js. This script creates the actual right-click menu item and injects your click automation automation script into the page when clicked:

javascript

// 1. Create the right-click menu item when the extension installs

chrome.runtime.onInstalled.addListener(() => {

  chrome.contextMenus.create({

    id: "runSearchAndViewAutomation",

    title: "Run Search & View Automation",

    contexts: ["all"] // Makes it appear on any right-click

  });

});

 

// 2. Listen for clicks on your custom menu item

chrome.contextMenus.onClicked.addListener((info, tab) => {

  if (info.menuItemId === "runSearchAndViewAutomation") {

    // Inject and execute your snippet script directly onto the active tab

    chrome.scripting.executeScript({

      target: { tabId: tab.id },

      func: automatedSearchAndView

    });

  }

});

 

// 3. Your core snippet script wrapped in a function

async function automatedSearchAndView() {

  const searchButton = document.querySelector('#search-btn-id'); // <-- Change selector as needed

 

  if (!searchButton) {

    console.error("Automation Stopped: Search button not found.");

    return;

  }

 

  searchButton.click();

  console.log("Search button clicked. Monitoring DOM for the anchor tag...");

 

  const waitForElement = (selector, timeout = 5000) => {

    return new Promise((resolve, reject) => {

      const startTime = Date.now();

      const interval = setInterval(() => {

        const element = document.querySelector(selector);

        if (element) {

          clearInterval(interval);

          resolve(element);

        } else if (Date.now() - startTime > timeout) {

          clearInterval(interval);

          reject(new Error(`Automation Timeout: Link "${selector}" not found.`));

        }

      }, 100);

    });

  };

 

  try {

    const viewAnchor = await waitForElement('a.your-class-name'); // <-- Change selector as needed

   

    if (viewAnchor.href && viewAnchor.href !== '#' && !viewAnchor.href.startsWith('javascript:')) {

      window.location.href = viewAnchor.href;

    } else {

      viewAnchor.click();

    }

  } catch (error) {

    console.error(error.message);

  }

}

Use code with caution.

Step 4: Load it into Google Chrome

1.      Open Chrome and navigate to chrome://extensions/

2.      Turn ON the toggle switch for Developer mode in the top-right corner.

3.      Click the Load unpacked button in the top-left corner.

4.      Select the SearchAndViewExtension folder you created.

 

Wednesday, October 21, 2026

How to slow a computer - How to check computer speed online GPU speed and CPU speed

 In c drive where is windows installed , Make memory to 0 mb

drive free space to 1 mb


2) Open a large excel file with2 gb and copy form one excel file to another


To check gpu speed and slow down computer


 https://mprep.info/gpu/

Wednesday, September 2, 2026

Powershell select query for windows with tables

 Get-CimInstance -Query "select * from Win32_OperatingSystem "

Get-CimInstance -Query "SELECT * FROM Win32_SystemDriver WHERE Name='ntfs'"


Get-CimInstance -Query "select * from win32_baseService where Name='Themes'"


tables


Win32_Service

Win32_SystemDriver


⚙️ Operating System Core & Drivers
  • Win32_Service: Standard Windows background services (the counterpart to system drivers).
  • Win32_PnPSignedDriver: Digital signature and version details for Plug-and-Play drivers (great for checking if a driver is outdated).
  • Win32_Bus: Physical and logical expansion buses (like PCI, USB).
  • Win32_DeviceChangeEvent: Monitors when devices/drivers are added or removed from the system.
🔌 Physical Hardware & Devices
  • Win32_PnPEntity: Every Plug-and-Play device recognized by Device Manager (cameras, mice, keyboards, etc.).
  • Win32_DiskDrive: Physical hard drives and SSDs (shows model, serial number, and size).
  • Win32_VideoController: Graphics cards/GPUs and active video drivers.
  • Win32_NetworkAdapter: Physical and virtual network cards.
🖥️ System Management & Memory
  • Win32_Processor: CPU details (cores, clock speed, current load).
  • Win32_PhysicalMemory: Physical RAM sticks (shows capacity, speed, and manufacturer).
  • Win32_BIOS: Motherboard BIOS/UEFI version, serial number, and manufacturer.
  • Win32_OperatingSystem: General Windows details (build version, boot time, registered user).


Friday, August 21, 2026

How to open notepad and type with batch file

 @echo off

title Type Text Automation


:: 1. Open Notepad

start "" notepad.exe

echo Waiting for Notepad to open...

timeout /t 2 >nul


:: 2. Create a temporary script to type text

set "VBS_FILE=%temp%\type_text.vbs"


(

echo Set objShell = WScript.CreateObject^("WScript.Shell"^)

echo ' Make sure Notepad is the active window

echo objShell.AppActivate "Notepad"

echo WScript.Sleep 500

echo ' Type the characters

echo objShell.SendKeys "abcd"

) > "%VBS_FILE%"


:: 3. Execute the typing script

cscript //nologo "%VBS_FILE%"


:: 4. Delete the temporary script file

del "%VBS_FILE%"


echo Done!

timeout /t 2 >nul


How to create notepad file with batch file

 @echo off

title Text Steps Recorder

cls

echo ==========================================

echo TYPE YOUR STEPS BELOW (Press Enter after each line)

echo Type "EXIT" and press Enter when finished.

echo ==========================================

echo.


:loop

set /p userinput="Enter text/step: "

if "%userinput%"=="EXIT" goto end

if "%userinput%"=="exit" goto end


:: This saves what you typed into a file called keystrokes.txt

echo %userinput% >> keystrokes.txt

goto loop


:end

echo.

echo Recording saved to keystrokes.txt!

pause


How to copy txt file from notepad to new notepad using bat file - batch file

 @echo off

title Steps Replayer

cls

echo Ready to replay steps. 

echo You have 5 seconds to click inside the app where you want to type!

echo.

timeout /t 5


:: This block creates a temporary script to simulate automated typing

echo Set wshShell = wscript.CreateObject("WScript.Shell") > replay.vbs


:: This reads your saved text file and writes it into the automated typer

for /f "delims=" %%x in (portalchanges.txt) do (

    echo wshShell.SendKeys "%%x" >> replay.vbs

    echo wscript.sleep 500 >> replay.vbs

    echo wshShell.SendKeys "{ENTER}" >> replay.vbs

    echo wscript.sleep 500 >> replay.vbs

)


:: This runs the automatic typing script and then deletes the temporary file

cscript //nologo replay.vbs

del replay.vbs


echo.

echo Replay complete!

pause


Thursday, August 20, 2026

How to take backup of MSQL database - MYsql database backup by bat file or by batch file

 C:\Program Files\MySQL\MySQL Workbench 8.0 CE>mysqldump -u root -p  eoffice_db documents >d:/backup_filename.sql


@echo off

:: Configuration

set DB_USER=root

set DB_PASS=12345

set DB_NAME=eoffice_DB

set BACKUP_DIR=C:\eoffice_DB\documents


:: 1. SET YOUR TABLE NAME HERE

:: Leave blank for full DB, or type a single table (e.g., users)

set TABLE_NAME=documents


:: Get Date Format safely (YYYYMMDD) regardless of Windows regional settings

for /f "tokens=2 delims==" %%i in ('wmic os get localdatetime /value') do set LDT=%%i

set BACKUP_DATE=%LDT:~0,4%%LDT:~4,2%%LDT:~6,2%


:: Adjust file name based on whether a table is specified

if "%TABLE_NAME%"=="" (

    set BACKUP_FILE=%BACKUP_DIR%\%DB_NAME%_%BACKUP_DATE%.sql

) else (

    set BACKUP_FILE=%BACKUP_DIR%\%DB_NAME%_%TABLE_NAME%_%BACKUP_DATE%.sql

)


:: Ensure target directory exists

if not exist "%BACKUP_DIR%" mkdir "%BACKUP_DIR%"


:: Execute mysqldump

"C:\Program Files\MySQL\MySQL Workbench 8.0 CE\mysqldump.exe" -u%DB_USER% -p%DB_PASS% %DB_NAME% %TABLE_NAME% > "%BACKUP_FILE%"


:: Optional: Delete files older than 30 days

forfiles /p "%BACKUP_DIR%" /s /m *.sql /d -30 /c "cmd /c del @path"


Thursday, July 9, 2026

VS code color change of font in menu - In side bar - explorer - Visual code color change of font

 

In settings.json change below code:-


 "workbench.colorCustomizations": {

    // Changes the default text color of the sidebar/explorer

    "": "#758b7c", 

    "sideBar.foreground":"default",

    // Changes the text color of the currently selected/focused file

    "list.focusForeground": "#FFD700", 

    "menu.foreground":"#020202",

    // Changes the text color of active files or items when hovering

    "list.activeSelectionForeground": "#8400ff31",

    "list.hoverForeground": "#6e0ad2",

    "menu.selectionForeground": "#FFFFFF",

"menu.selectionBackground": "#be1919c6"


}


For changing color of keywords(font in text editor):-

"editor.tokenColorCustomizations": {"textMateRules": [
        {
            "scope": "storage.type",
            "settings": {
                "foreground": "#000000",
                "fontStyle": "bold"
            }
           
        }
    ]}

For changing color of this and return keyword

"editor.tokenColorCustomizations": {"textMateRules": [
        {
            "scope": "variable.language",
            "settings": {
                "foreground": "#666666",
                "fontStyle": "bold"
            }},
            {
            "scope": "keyword.control",
            "settings": {
                "foreground": "#666666",
                "fontStyle": "bold"
            }
        }
    ]}

Saturday, June 6, 2026

visual studio Antialiased font - ClearType - Greyscale

>  Go to Tool 

> Click on Option

>and click on Advanced

>There are 4 options 1)ClearType ) Greyscale ) Aliased


Also in itelliz (java ide) for java these are these options.