Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

extension not working #6

Closed
dptr opened this issue Jul 14, 2017 · 15 comments
Closed

extension not working #6

dptr opened this issue Jul 14, 2017 · 15 comments

Comments

@dptr
Copy link

dptr commented Jul 14, 2017

i downloaded a Visual Studio Code 1.14.1 and installed this extension, when i paste an image, it shows the path select text box, but when i press the enter key , no picture was pasted in the markdown file, neither any image was found in the file path.

@dptr
Copy link
Author

dptr commented Jul 16, 2017

i solved by add powershell.exe path to the environment variable PATH.

@dptr dptr closed this as completed Jul 16, 2017
@clsmt clsmt mentioned this issue Jun 3, 2018
@Eucaly
Copy link

Eucaly commented Feb 15, 2020

Could any one indicate the "exact content" for below?

  • add powershell.exe path to the environment variable PATH?

@gusbemacbe
Copy link

Hello @Eucaly !

I have still the same problem. Here is the output:

PS C:\Users\gusbe> $env:path
C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\dotnet\;C:\Users\gusbe\AppData\Local\Microsoft\WindowsApps;D:\gusbe\Applications\VSCode Insiders\bin

@gusbemacbe
Copy link

And I installed PowerShell 7, but it was not successful to copy and paste on VSCode:

PS C:\Users\gusbe>  $env:Path -split ';'
C:\Program Files\PowerShell\7
C:\WINDOWS\system32
C:\WINDOWS
C:\WINDOWS\System32\Wbem
C:\WINDOWS\System32\WindowsPowerShell\v1.0\
C:\WINDOWS\System32\OpenSSH\
C:\Program Files\dotnet\
C:\Program Files\PowerShell\7\
C:\Users\gusbe\AppData\Local\Microsoft\WindowsApps
D:\gusbe\Applications\VSCode Insiders\bin

@ctlajoie
Copy link

As of powershell 6.0, the executable is named pwsh.exe

@jygzyc
Copy link

jygzyc commented Nov 12, 2020

Extension not working no Vscode 1.51.0

@jmanthony3
Copy link

Extension not working no Vscode 1.51.0

Extension for Windows 10 not working on VS Code v1.53.1

@alejandroarmas
Copy link

Extension not working on 1.55.2

@htqx
Copy link

htqx commented Jul 8, 2021

1.57.1
paste pic ok。
but paste regex string no working。
arch linux

@gusbemacbe
Copy link

1.57.1
paste pic ok。
but paste regex string no working。
arch linux

On native Linux or on WSL? Did you install xclip?

@htqx
Copy link

htqx commented Jul 10, 2021

1.57.1
paste pic ok。
but paste regex string no working。
arch linux

On native Linux or on WSL? Did you install xclip?

yes. native arch linux.

According to xclip's information, there is more than one clipboard, but multiple:

primary

secondary

clipboard

buffer-cut

vscode editor using 1. markdown paste using 3.

So, not working

I think...

@ujwaliyer
Copy link

I installed the latest version of btoh powershell, vscode and this extension- the mark down paste action is pasting a 20 page long binary of the copied image: something like this
![](data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAABLcAAAF8CAYAAAA971neAAAgAElEQVR4AeydMZLDPHK2fYCVyy7bf+YbOLNqk73AHsBbCjbaM7hK0R7CVQq/2JEjhd8FNlL8lSNfhX+B1As0oQYIcMgZceYJpsihgEaj

@jmanthony3
Copy link

For anyone else struggling to do this, I have written a simple Python script that I call from a VS Code shortcut to store the image (if in clipboard) to a folder in the root directory of the .md file and then store to clipboard the text to paste into the .md file that links to the image.

import os
from PIL import ImageGrab
import pyperclip
import sys
import tag_counter
import timestamp as ts

class getClip:
	def __init__(self, mdPath, mdBaseName, imageDescription, imageTitle):
		img = ImageGrab.grabclipboard()
		if isinstance(img, type(None)):
			sys.exit("ERROR! Please copy an image.")
		else:
                        filePath = mdPath
			relativeFilePath = "/".join([filePath, mdBaseName])
			try: os.mkdir(relativeFilePath)
			except OSError as error: print(error)
			when = ts.when()
			imageTitle = str.lower(imageTitle).replace(" ", "_")
			imageName = f"{imageTitle}_{when}.png"
			fileName = f"{relativeFilePath}/{imageName}"
			pasteName = f"./{mdBaseName}/{imageName}"
			img.save(fileName, format="PNG")
			fig_number = tag_counter.getCount(mdPath, mdBaseName)
			pyperclip.copy(\
				f"| ![]({pasteName}) |\n" + \
				"|:--:|\n" + \
				f"| {imageDescription} " + "\\\\(\\tag{" + f"{fig_number+1}" + "} \\label{fig:" + f"{imageTitle}" + "}\\\\) |"\
				)
			print(f"Completed {fileName}")
if __name__ == "__main__":
	getClip(str(sys.argv[1]), str(sys.argv[2]), str(sys.argv[3]), str(sys.argv[4]))

@gusbemacbe
Copy link

For anyone else struggling to do this, I have written a simple Python script that I call from a VS Code shortcut to store the image (if in clipboard) to a folder in the root directory of the .md file and then store to clipboard the text to paste into the .md file that links to the image.

import os
from PIL import ImageGrab
import pyperclip
import sys
import tag_counter
import timestamp as ts

class getClip:
	def __init__(self, mdPath, mdBaseName, imageDescription, imageTitle):
		img = ImageGrab.grabclipboard()
		if isinstance(img, type(None)):
			sys.exit("ERROR! Please copy an image.")
		else:
                        filePath = mdPath
			relativeFilePath = "/".join([filePath, mdBaseName])
			try: os.mkdir(relativeFilePath)
			except OSError as error: print(error)
			when = ts.when()
			imageTitle = str.lower(imageTitle).replace(" ", "_")
			imageName = f"{imageTitle}_{when}.png"
			fileName = f"{relativeFilePath}/{imageName}"
			pasteName = f"./{mdBaseName}/{imageName}"
			img.save(fileName, format="PNG")
			fig_number = tag_counter.getCount(mdPath, mdBaseName)
			pyperclip.copy(\
				f"| ![]({pasteName}) |\n" + \
				"|:--:|\n" + \
				f"| {imageDescription} " + "\\\\(\\tag{" + f"{fig_number+1}" + "} \\label{fig:" + f"{imageTitle}" + "}\\\\) |"\
				)
			print(f"Completed {fileName}")
if __name__ == "__main__":
	getClip(str(sys.argv[1]), str(sys.argv[2]), str(sys.argv[3]), str(sys.argv[4]))

@jmanthony3, does it work with us on company's computers when PowerShell is blocked?

@jmanthony3
Copy link

I should think that if you were able to run Python scripts that you could run this. The computer I wrote this on is a company machine which I have admin over so I do not know if it would run without the elevated privileges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants