Nppexec Howto pass selected link from npp editor to external browser - google-chrome

is it possible to pass selected text to browser (chrome) from notepad ++?
howto pass not path to TEMP_FILE but content?
//—need a correction—
set ChromeRun = C:\Documents and Settings\My\Local Settings\Application Data\Google\Chrome\Application\chrome.exe
set TEMP_FILE = $(SYS.TEMP)\npp_sel.txt
// save current selection as ANSI text file
SEL_SAVETO $(TEMP_FILE) :a
// run Chrome.exe for this file
$(ChromeRun) –-homepage $(TEMP_FILE)
could you help me out with this script, please

NppExec can refer directly to a highlighted word(s) using $(CURRENT_WORD). So you don't need sel_saveto or temporary files.
The snippet below works with Firefox. You should be able to modify it for Chrome in the obvious way.
In NppExec console window:
`npp_run firefox $(CURRENT_WORD)`,
where $(CURRENT_WORD) is, for example, a URL (http://google.com) that you have highlighted in the current file in Notepad++.

Related

visual studio code not recognizing html files

VS code has suddenly stopped recognizing html files (the file icon is the default one for files with no extension)
all other file extensions work just fine
except for html
the tags still work but it won't autocomplete
Adding this to file extensions worked for me:
"files.associations": {
"*.html": "html"
}
In my case, for this problem the solution was to manually add *.html to files.associations, in user settings. Its unlogical but it seems that somehow the extension wasn't associated to the type of file. Now everything works perfectly...
Go to the settings (In mac it is Code -- > Preferences --> Settings)
In the search bar search for Association.
In Files:Associations click on Add items.
update key = *.html & Value = html
Below is the screenshot for reference.
I had the same issue but none of the other solutions worked for me!
You can try this:
Go to the path where the "settings.json" file exits, for my case the path is:
C:> Users> User123 > AppData > Roaming > Code > User > settings.json
Now, paste the code in the file:
"code-runner.executorMap": {
"html": "\"C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe\"",
}
Now search for the "files.associations" section in your settings.json file:
As an example
Now if you have the "files.associations" section then just add the line there:
"*html": "html"
(don't forget to write a comma after a line if there are more lines in it)
or if you don't have a "files.associations" section, then copy paste the code there:
"files.associations": {
"*.rmd": "markdown",
"*html": "html"
},
I had the same problem in Windows 10 a few minutes ago:
Yeah, from the solutions above I did this but still had some errors:
File -- > Preferences --> Settings
In the search bar search for Files: Association.
In Files:Associations click on Add item button.
update Item = *.html & Value = HTML
As shown below:
When I saved, I got this error
Unable to write into user settings. Please open the user settings to correct errors/warnings in it and try again.
The problem is that terminal.integrated.shellArgs settings have been deprecated.
One of the answers here will help:
So I just had this problem and I figured it out the problem was from an extension that I installed which is the pyscript extension I disabled it and everything started to work again!
Well if you have pyscript extension installed, disable it. It has conflicts with html files I guess.
Or if you don't want to disable it just ctrl+shift+p then change language mode. Select configure file association for html.
This applies for any extension not just pyscript. For me it was pyscript

Downloading a web page with AutoIt is not working correctly

I'm trying an AutoIt script which uses the "Save As" download dialog from a web browser and gives a new name to the page downloaded. The page downloads correctly, but the problem is that it can't rename it, so the default name is used. I used the script whit IE, Chrome and Firefox but none of them worked.
Script:
WinWaitActive("Save As","","20")
If WinExists("Save As") Then
ControlSetText("Save As","","Edit1",$CmdLine[1])
ControlClick("Save As","","&Guardar")
EndIf
Example
When I run it with "script.exe newname", the page should be downloaded as "newname", not "AutoIt simple example bla bla...." (default name)
EDIT: Same code works with notepad save dialog, but It doesn't work on any browser.
Also, I'm not using InetGet because that only downloads plain HTML. I need the complete page with css and images.
EDIT2: I also tried this from java using AutoItX4java but that neither worked.
First, you are missing the WinSearchChildren option. Save/Open file dialogs are children dialogs.
Also no need to &Guardar string. that will make your script depend on the system language.
Here is the working code
#RequireAdmin ;Will give your script a permission elevation (sometimes its needed)
Opt("WinTitleMatchMode", 4) ;1=start, 2=subStr, 3=exact, 4=advanced, -1 to -4=Nocase
Opt("WinSearchChildren", 1) ;0=no, 1=search children also
WinWaitActive("Save As","","20")
If Not #error Then
ControlSetText("Save As","","Edit1",$CmdLine[1])
ControlClick("Save As","","[CLASS:Button; INSTANCE:1]")
EndIf

Selenium sendKeys with Chrome- Hebrew

I try to use:
action.sendKeys("some phrase with a dot, for example: www.google.co.il ");
but when i run the program what the action writes is:
www*google*co*il
the * represent hebrew character.
I can disable this only by disabling the hebrew language in my computer.
I tried to bypass the problem by using JS: set.attribute but it makes a lot of problems and i need something better.
Is there a function similar to sendkeys or a way to fix it?
You can try JavascriptExecuter using below code:
WebElement text= driver.findElement(By.name("q"));
JavascriptExecutor jsExecutor = (JavascriptExecutor) driver;
jsExecutor.executeScript("arguments[0].value='test input';", text);
Webelement is the textbox where your need to write the value.
Or you can try some copy paste action after clicking into text box.
actions.click();
Refer to this URL for help:
http://www.helloselenium.com/2015/03/how-to-set-string-to-clipboard-data.html
I found out a way to change language during the tests while I solved another problem related to Upload a picture. there is this freeware called AuTOIT that you can use to help you with dialogs on Windows. I wrote a script to push the alt and click shift and my language is changed.
To change the language, I use the line:
Runtime.getRuntime().exec("path_of_script_here/name_of_script_here.exe");
The script was made the following way:
Open a text file.
Inside the file write:
Send ("{ALTDOWN}") ;Hold down Alt
Sleep(100) ;Wait 100 milliseconds
Send("{LSHIFT}{ALTUP}") ;Press Left-Shift and release Alt
Save as .au3 file.
Download and install AUTOIT.
Compile the script and then exe file will be created.
Run the test.
Hope this will help everyone else who encounters this problem. If something is not clear, ask me and I will gladly help.

Is there a way to prevent Sublime Text from previewing binary files inside the text editor?

As the title suggests, I would like to find out if there's a way to prevent ST2 from opening binary files when I click on them. For example when I click on an image, there's no point displaying the hex representation inside the text editor.
One additional note: I'm not interested in hiding binary files from the sidebar.
Files containing null bytes are opened as hexadecimal by default
In your User or Default Settings file:
"enable_hexadecimal_encoding": false
Unfortunately I'm not aware of a way to disabled previewing of specific formats, but if you want to avoid accidental clicks on enormous binary files that may slow down the editor you could disable all previewing from sidebar clicks.
In your User or Default Settings file(s):
"preview_on_click": false
I have similar situation like you. I dont want sublime open editor for binary like jpg png files. Instead open system default application is more reasonable.
Create one Build. Refer to Sublime Text 2 keyboard shortcut to open file in specified browser (e.g. Chrome) It will both open default application and hex editor.
Plugin OpenDefaultApplication https://github.com/SublimeText/OpenDefaultApplication
It will have context right click menu OpenInDefaultApplication. But It will both open default application and hex editor as well
Plugin: Non Text Files https://packagecontrol.io/packages/Non%20Text%20Files Add config in the user setting
"binary_file_patterns": ["*.JPG","*.jpg", "*.jpeg", "*.png", "*.gif", "*.ttf", "*.tga", "*.dds", "*.ico", "*.eot", "*.pdf", "*.swf", "*.jar", "*.zip"],
"prevent_bin_preview": true,
"open_externally_patterns": [
"*.JPG",
"*.jpg",
"*.jpeg",
"*.JPEG",
"*.png",
"*.PGN",
"*.gif",
"*.GIF",
"*.zip",
"*.ZIP",
"*.pdf",
"*.PDF"
]
I choose the third way, it's quite suitable for me. It will open jpg file in system default application and quickly close the edit mode automatically.
For Sublime Text 3
file_exclude_patterns Setting
If your binary files have a file extension, then yes.
In your Sublime Settings you can use this setting to prevent you from seeing the files in the left project folders:
"file_exclude_patterns":
[
"*.db",
"*.dll",
"*.ds_store",
"*.egg",
"*.enc",
"*.eot",
"*.exe",
"*.ko",
"*.otf",
"*.pdb",
"*.pdf",
"*.pgn",
"*.plist",
"*.psd",
"*.pxm",
"*.pyc",
"*.rdb",
"*.sqlite",
"*.sublime-workspace",
"*.ttf",
"*.woff",
"*.woff2",
"*.zip",
],
Just modify this to your needs, and then you will not see this in your project folders in Sublime.
Toggle
Maybe you just want to turn it off or on for the current file?
Try Sublime Command Palette using CTRL OR Command + Shift + P
and type:
HexViewer: Toggle Hex View
and press Enter or Return then the file will switch between HEX and TEXT.
Extra
If you don't want any-file to be converted to HEX then please use #steven-teo's answer.
If you want to learn more about the HEX Viewer you can see the Code Here & Documentation Here.
**Note: Keys vary for the Sublime Command Palette more info on that.

how to set default location in browse tag

Am doing project in j2ee.I use Browse button. I need to fetch images/files from a folder inside my project folder, everytime.I wish to set my project's folder name as a default location for my browse button.How to do that?
am using tis following code in a jsp page:
and calling the value in servlet :
String image= (String) request.getParameter("img");
while browsing ,the whole path is getting displayed but only the name of the image is passing as value in the sevlet.How to get the entire path? or how to set my project folder as default location while browsing?
If this is rendering a standard
<input type="file".../>
Then you have no control over the default directory.
Using flash gains you a bit more control (filetype preset, single/multiple file selection etc.)
I'm not sure if Java Applets have more access/options, hopefully someone can advise.
PS. for the standard input tag, the browser will remember the last location you used, so you only need to navigate once, if you are uploading several files from the same directory.
I actually solved this problem with an interesting trick. Here's how...
Create an external vbscript include file called vbshelper.inc which contains the following code:
function stuffKeys(x)
Set wshShell = CreateObject("WScript.Shell")
wshShell.Sendkeys(x)
end function
Inside your HTML code header, place the following line as your first < Script> element...
< Script type="text/VBScript src="vbshelper.inc">
later, in your HTML code, create the button like this...
< input type="File" id="srcFile" onchange="go_do_something()" onclick="stuffkeys(' C:\Temp\*.txt~')">
Note the space before the C in ' C:\Temp*.txt~' and the tilde ~ after the .txt.