This commit is contained in:
Steven Hobs
2025-08-23 15:38:07 +08:00
commit 39f176269a
4 changed files with 75 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
*.lnk

71
CreateLinks.ps1 Normal file
View File

@@ -0,0 +1,71 @@
# PowerShell script to create Chrome shortcuts for specific URLs
# Define variables
$labelsFile = "labels.txt"
$faviconFile = "logo.ico"
$chromePath = "C:\Program Files\Google\Chrome\Application\chrome.exe"
$baseUrl = "https://seller.hepsiglobal.com/"
$baseUserDataDir = "D:\HepsiSeller-Data"
# Check if Chrome executable exists
if (-not (Test-Path $chromePath)) {
Write-Error "Chrome executable not found: $chromePath"
exit 1
}
# Check if stores.txt file exists
if (-not (Test-Path $labelsFile)) {
Write-Error "stores.txt file not found: $labelsFile"
exit 1
}
# Check if favicon.ico file exists
if (-not (Test-Path $faviconFile)) {
Write-Error "favicon.ico file not found: $faviconFile"
exit 1
}
# Read store names
$stores = Get-Content $labelsFile
# Create shortcuts for each store
foreach ($store in $stores) {
# Skip empty lines
if ([string]::IsNullOrWhiteSpace($store)) {
continue
}
# Create user data directory path
$userDataDir = Join-Path $baseUserDataDir $store
# Create user data directory if it doesn't exist
if (-not (Test-Path $userDataDir)) {
New-Item -ItemType Directory -Path $userDataDir -Force | Out-Null
}
# Copy logo.ico to user data directory
$localFaviconPath = Join-Path $userDataDir "logo.ico"
if (Test-Path $faviconFile) {
Copy-Item -Path $faviconFile -Destination $localFaviconPath -Force
}
# Create shortcut
$shortcutName = "$store.lnk"
$shortcutPath = Join-Path $PWD $shortcutName
# Create WScript.Shell object
$shell = New-Object -ComObject WScript.Shell
# Create shortcut object
$shortcut = $shell.CreateShortcut($shortcutPath)
# Set shortcut properties
$shortcut.TargetPath = $chromePath
$shortcut.Arguments = "--user-data-dir=`"$userDataDir`" --app=`"$baseUrl`""
$shortcut.IconLocation = "$localFaviconPath,0"
$shortcut.Save()
Write-Output "Created shortcut: $shortcutName"
}
Write-Output "All shortcuts created successfully."

3
labels.txt Normal file
View File

@@ -0,0 +1,3 @@
test_1
test_2
test_3

BIN
logo.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 66 KiB