-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Ana Martinez Gomez <[email protected]>
- Loading branch information
Showing
8 changed files
with
829 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<package xmlns="http://schemas.microsoft.com/packaging/2015/06/nuspec.xsd"> | ||
<metadata> | ||
<id>internet_detector.vm</id> | ||
<version>1.0.0</version> | ||
<authors>Elliot Chernofsky and Ana Martinez Gomez</authors> | ||
<description>Tool that changes the background and a taskbar icon if it detects internet connectivity</description> | ||
<dependencies> | ||
<dependency id="common.vm" version="0.0.0.20240821" /> | ||
<dependency id="libraries.python3.vm" version="0.0.0.20240726" /> | ||
<dependency id="fakenet-ng.vm" version="3.2.0.20240425" /> | ||
</dependencies> | ||
</metadata> | ||
</package> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
$ErrorActionPreference = 'Stop' | ||
Import-Module vm.common -Force -DisableNameChecking | ||
|
||
$toolName = 'internet_detector' | ||
$category = 'Utilities' | ||
|
||
# Install dependency for windows api | ||
VM-Pip-Install "pywin32" | ||
|
||
# Create tool directory | ||
$toolDir = Join-Path ${Env:RAW_TOOLS_DIR} $toolName | ||
New-Item -Path $toolDir -ItemType Directory -Force -ea 0 | ||
VM-Assert-Path $toolDir | ||
|
||
$packageToolDir = "$(Split-Path -parent $MyInvocation.MyCommand.Definition)" | ||
|
||
# Move images to %VM_COMMON_DIR% directory | ||
$imagesPath = Join-Path $packageToolDir "Images" | ||
Move-Item "$imagesPath\*" ${Env:VM_COMMON_DIR} -Force | ||
|
||
# Get path to pythonw for executing Python without terminal popup | ||
$executablePath = (Get-Command pythonw).Source | ||
$filePath = Join-Path $packageToolDir "$toolName.pyw" | ||
|
||
VM-Install-Shortcut $toolName $category $executablePath -arguments $filePath | ||
|
||
# Create scheduled task for tool to run every 2 minutes. | ||
$action = New-ScheduledTaskAction -Execute $executablePath -Argument "$filePath" | ||
$trigger = New-ScheduledTaskTrigger -Once -At (Get-Date) -RepetitionInterval (New-TimeSpan -Minutes 2) | ||
Register-ScheduledTask -Action $action -Trigger $trigger -TaskName 'Internet Detector' -Force |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
$ErrorActionPreference = 'Continue' | ||
Import-Module vm.common -Force -DisableNameChecking | ||
|
||
$toolName = 'internet_detector' | ||
$category = 'Utilities' | ||
|
||
VM-Uninstall $toolName $category | ||
Unregister-ScheduledTask -TaskName 'Internet Detector' -Confirm:$false |
Oops, something went wrong.