File tree Expand file tree Collapse file tree 3 files changed +13
-3
lines changed
scripts/Copy to clipboard Expand file tree Collapse file tree 3 files changed +13
-3
lines changed Original file line number Diff line number Diff line change 44 ```
55 git clone [email protected] :GDSC-RCCIIT/General-Purpose-Scripts.git 66 ```
7- 2 . Navigate to ` Copy to clipboard ` directory
7+ 2 . Install the script requirements
8+ ```
9+ pip install -r requirements.txt
10+ ```
11+ 3 . Navigate to ` Copy to clipboard ` directory
812 ```
913 cd General-Purpose-Scripts/scripts/Copy to clipboard
1014 ```
11- 3 . Run the script to copy text from the desired file to your clipboard
15+ 4 . Run the script to copy text from the desired file to your clipboard
1216 ```
1317 python clipboard.py <file_name>
1418 ```
1519 ### Note
1620 Replace <file_name> with the name of the file present in the same directory as the script or replace it with the path of the file.
21+ For Linux users, install [ xclip] ( https://linoxide.com/copy-paste-commands-output-xclip-linux/ ) in your system before running the script.
Original file line number Diff line number Diff line change 22import sys
33import platform
44import subprocess
5+ import pyperclip
56
67# Seeing if the file exists
78if os .path .exists (sys .argv [1 ]):
1819
1920if whatos == "Darwin" :
2021 subprocess .run ("pbcopy" , universal_newlines = True , input = f_contents )
21- print ("success: copied to clipboard" )
22+ print ("Success! Copied to clipboard." )
23+ elif whatos == "Linux" :
24+ pyperclip .copy (f_contents )
25+ print ("Success! Copied to clipboard." )
2226elif whatos == "Windows" :
2327 subprocess .run ("clip" , universal_newlines = True , input = f_contents )
2428 print ("Success! Copied to clipboard." )
Original file line number Diff line number Diff line change 1+ pyperclip == 1.8.2
You can’t perform that action at this time.
0 commit comments