var wndHandle = sp.ForegroundWindow().HWnd; var desktopHandle = sp.DesktopWindowListView().HWnd; var result = 1; var selectedFiles; var fullPath = ""; var isDesktop = false; var success = false; var actionName = "Upload to Imgur" if(wndHandle.ToInt32() == desktopHandle.ToInt32() || sp.LastFocusControl().HWnd.ToInt32() == desktopHandle.ToInt32()) { //Desktop selectedFiles = sp.GetSelectedFilesOnDesktop(); isDesktop = true; } else { //Not Desktop selectedFiles = sp.GetSelectedFilesInExplorer(wndHandle); } if(selectedFiles.Length != 0) { fullPath = selectedFiles[0]; if(isDesktop) { fullPath = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Desktop) + "\\" + fullPath; } result = sp.RunProgram('D:\\Program Files\\ShareX\\ShareX.exe', `"${fullPath}" -task "${actionName}"`, 'open', 'hidden', false, true, true); if(result == 0) { success = true; sp.ShowBalloonTip("OK", "", "info", 1000); } } if(!success) { sp.ShowBalloonTip("Upload to Imgur", "Failed", "error", 1000); } sp.Sleep(2000); //Wait for 1s or 2s then get the URL from the clipboard //and use google image search engine to search the URL
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter