{"id":13800423,"url":"https://github.com/fakoua/SwissKnife","last_synced_at":"2025-05-13T09:31:37.999Z","repository":{"id":50363106,"uuid":"234409067","full_name":"fakoua/SwissKnife","owner":"fakoua","description":"Deno Swiss Knife tools","archived":false,"fork":false,"pushed_at":"2023-12-23T21:54:18.000Z","size":201,"stargazers_count":10,"open_issues_count":1,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-22T16:59:25.498Z","etag":null,"topics":["deno","dialog","monitor","notification","screen","screencapture","screenshot","systray","texttospeech","typescript","volume","windows"],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fakoua.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2020-01-16T20:49:04.000Z","updated_at":"2025-02-08T01:58:29.000Z","dependencies_parsed_at":"2024-01-05T20:59:52.074Z","dependency_job_id":"663a3eda-6466-408c-93e3-b2df96c118df","html_url":"https://github.com/fakoua/SwissKnife","commit_stats":{"total_commits":34,"total_committers":3,"mean_commits":"11.333333333333334","dds":0.05882352941176472,"last_synced_commit":"cbd2bc2879288992487da4070f219c37206dac8c"},"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fakoua%2FSwissKnife","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fakoua%2FSwissKnife/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fakoua%2FSwissKnife/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fakoua%2FSwissKnife/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fakoua","download_url":"https://codeload.github.com/fakoua/SwissKnife/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253913137,"owners_count":21983264,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["deno","dialog","monitor","notification","screen","screencapture","screenshot","systray","texttospeech","typescript","volume","windows"],"created_at":"2024-08-04T00:01:12.428Z","updated_at":"2025-05-13T09:31:36.917Z","avatar_url":"https://github.com/fakoua.png","language":"TypeScript","funding_links":[],"categories":["Modules"],"sub_categories":["Automation"],"readme":"# SwissKnife\n![GitHub code size in bytes](https://img.shields.io/github/languages/code-size/fakoua/swissKnife?style=for-the-badge)\n![GitHub](https://img.shields.io/github/license/fakoua/swissKnife?style=for-the-badge)\n![GitHub last commit](https://img.shields.io/github/last-commit/fakoua/swissKnife?style=for-the-badge)\n![GitHub Workflow Status](https://img.shields.io/github/workflow/status/fakoua/swissKnife/Deno%20CI?style=for-the-badge)\n\n\nDeno Swiss Knife tools (Windows Only)\n\nSwissKnife is a Deno module that allows you to do some useful tasks on Windows OS using NirCmd v2.86\n\n[API Document](https://doc.deno.land/https/deno.land/x/swissKnife/mod.ts)\n\n## Usage\n\n### Sound Library\n\n#### Text To Speech\n\nSpeaks the text your specify by using the Speech library (SAPI) that comes with Windows.\n\n```ts\nimport * as swissKnife from \"https://deno.land/x/swissKnife/mod.ts\"\nawait swissKnife.speak(\"Hello from the other world\")\n```\n\nRun your script file:\n\n```bash\ndeno -A myfile.ts #Requires allow-run and allow-write permissions\n```\n\nYou can also set the rate and the volume:\n\n```ts\nimport * as swissKnife from \"https://deno.land/x/swissKnife/mod.ts\"\nawait swissKnife.speak(\"Hello from the other world\", {rate: 3, volume: 80})\n//rate: -10 -\u003e 10\n//volume: 0% -\u003e 100%\n```\n\n### Computer System volume\n\n```ts\nimport * as swissKnife from \"https://deno.land/x/swissKnife/mod.ts\"\n\n//Set the volume\nawait swissKnife.setVolume(90) //value between 0 to 100\n\n//mute the system sound\nawait swissKnife.mute()\n\n//unmute the system sound\nawait swissKnife.unmute()\n```\n\n### Play beeps\n\n`await swissKnife.beep(freq, duration)`\n\nThe freq (Frequance) parameter specifies the freq in hertz, the duration parameter specifies the duration of the sound in milliseconds.\n\n```ts\nawait swissKnife.beep(500, 1000) //play 500 hz for 1 sec.\n```\n\nAlso you can play the Windows standard beep (notification sound)\n\n```ts\nawait swissKnife.winBeep()\n```\n\n### Play local mp3\n\n`await swissKnife.playMp3(local_path)`\n\nPlay local mp3 and WAIT untile the sound ends..\n\n```ts\nawait swissKnife.playMp3(\"c:\\\\myFolder\\\\sound.mp3\") //play 500 hz for 1 sec.\n```\n\n## Desktop Library\n\n### Take screenshot\n\nWith swissKnife you can take a screenshot of the full screen, dual screen and active windows and save the png file to your hard disk.\n\n```ts\n//Save the primary screen image.\nawait swissKnife.screenshot(\"c:\\\\myfolder\\\\myfile.png\")\n```\n\nAlso you can specify Dual monitor:\n\n```ts\n//take a screenshot of both screens\nawait swissKnife.screenshot(\"c:\\\\myfolder\\\\myfile.png\", \"Dual\")\n```\n\nAlso you can specify the current active window:\n\n```ts\n//take a screenshot of both screens\nawait swissKnife.screenshot(\"c:\\\\myfolder\\\\myfile.png\", \"Window\")\n```\n\nThe third parameter allows you to specify the coordinates, width and height of the area:\n\n```ts\n//take a screenshot of both screens\nawait swissKnife.screenshot(\"c:\\\\myfolder\\\\myfile.png\", \"Single\", {\n    x: 10,\n    y: 30,\n    width: 200,\n    height: 150\n})\n```\n\n### Show Notification (Tray Balloon)\n\nDisplay a notification with text, icon and duration:\n\n`swissKnife.notification(title, text, iconNumber, duration)`\n\nNB: Icon number is the icon id in shell32.dll\n\n```ts\nawait swissKnife.notification(\"My Title\", \"Hello Notification\", 77, 2000)\n```\n\n### Show info box\n\nDisplay a dialog box with \"OK\" button:\n\n`await swissKnife.infoBox(title, text)`\n\n### Question Box\n\nQuestion box is a dialog box with \"yes/no\" buttons that returns true if the user clicks on yes\n\n```ts\nlet res = await swissKnife.questionBox(\"A Question\", \"Do you want to quite smoking?\")\nif (res) {\n    console.log(\"Great, keep trying!\")\n} else {\n    console.log(\"Not Great, but keep trying!\")\n}\n```\n\n## Window (forms) Actions Library\n\nThis method allows you to hide, show, minimize, maximize, flush ... windows forms.\n\n`winAction(winTitle: string, find: Find, action: WinActions)`\n\n- winTitle: Window Title to send the command\n- find: Find method (Contains, StartsWith, EndsWith and Equals)\n- action: Close, Hide, Show, Activate, Flash, Max, Min, Normal and Center.\n\n```ts\n//flash any window with title containing 'untit'\nawait swissKnife.winAction(\"Untit\", \"Contains\", \"Flash\")\n```\n\n## Window Power\nThis method allows you to Logoff, Power Off and Stand by the system.\n\n`power(mode:PowerMode)`\n\n- mode: Supported values Logoff, Power off and Standby\n\n```ts\nimport * as swissKnife from \"https://deno.land/x/swissKnife/mod.ts\"\n//Standby the system\nawait swissKnife.power(\"StandBy\")\n```\n\n## License\n\n[MIT](LICENSE)\n\n\n[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Ffakoua%2FSwissKnife.svg?type=large)](https://app.fossa.com/projects/git%2Bgithub.com%2Ffakoua%2FSwissKnife?ref=badge_large)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffakoua%2FSwissKnife","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffakoua%2FSwissKnife","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffakoua%2FSwissKnife/lists"}