init
This commit is contained in:
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
*.lnk
|
71
CreateLinks.ps1
Normal file
71
CreateLinks.ps1
Normal 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
3
labels.txt
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
test_1
|
||||||
|
test_2
|
||||||
|
test_3
|
Reference in New Issue
Block a user