I am writing a Javascript code. In which I have to open an XML file with QTReport.exe. QTReport.exe is made up of to read the xml file and to show the QTP execution results. I am able to do the following in windows explorer. I did, right click on an XML file and choose the option "Open with" and specify the program as "C:\Bin\QTReport.exe".
My question is, is there any API or function that I can specify as open an XML file with QTReport.exe?
Use the following command line arguement with the qtreport.exe:
bin_dir\qtreport.exe -r path_to_xml_file
Related
For example, In my website I have print absolute file path using console.log
like this
console.log('/user/myname/work/projectName/index.ts')
I want to open the file in the editor when I click the message in the devtool in the chrome.
If I log it in nodejs how can I do the same thing?
node index.js
console.log(__dirname)
I want to open the __dirname file using current editor maybe vscode or webtorm and so on when I click the message in the terminal.
How can I do?
Thanks for your help!
All you need to do in most cases (most of the terminal apps already support this functionality for a long time out-of-the-box) is to prepend a correct protocol before the file path, so that the logged path becomes a file URI.
More on file URIs here: https://en.wikipedia.org/wiki/File_URI_scheme
In your case, you can just prepend file:// to the path and it should work out of the box, e.g.:
file:///Users/someuser/somefile.txt
Note that I used standard Unix/MacOS pathname for the example. The first two slashes depict the protocol (file://), the next one comes from the root path in the filesystem, this will look different in e.g. Windows environment.
So, if you want to use __dirname (note that you can still add other text to the logged message, file URI just has to be a part of it):
console.log(`I will be opening file://${__dirname}`);
This works due to the support of hyperlinks in terminal emulators. If you want to delve deeper into the topic, follow this GIST:
https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda
I am using the google chrome to debugging the javascript source file, now I could debbugging the output js file, but the output js file is not human friendly readable. It looks like this:
from the google chrome console, I can see the call stack, and the google chrome tips shows that the source map are avaliable. But how to navigate the the js source file with current debugging line? I already type command + P in macOS but just shows the source files, I did not know which line should to navigate. the call stack only show the output js file line number.
Next to the "Page" tab (you can make the side bar bigger or click on those two arrows, there you will find the "Filesystem tab". If you add the corresponding folder to the workspace you will be able to edit and save those files.
Here's an article that explains it in details using a python server.
(note that you can use any local server you'd like)
(note that it won't work with local files url like file:///)
If you are trying to debug your current JS file at line 23487, steps would be to-
Load URL.
Open chrome debugger tools.
Put debug point on desired line.
Reload the URL, the debugger will pause at debug point.
You can watch below video for this, specifically #10:40 timestamp.
https://www.youtube.com/watch?v=WmVEddplwbo
the chrome dev tool gives me a error. actually i'm trying to get an http ressource from an https webpage :
i don't know where these files are called to change the target. i guess we can know with the chrome dev tool but can't find how. i would like to know which file is firing the call, which line... (if i get only the filename, it's fine)
someone can help ?
The blue box in the picture below represents the link to the exact line that caused the error. The format is filename:XX, where filename is the name of the file where the script originated, and XX is the line of code within that file.
Click the link to see that line of code in the Sources panel. If the file is minified, click the Format button to pretty-print it.
I am usinf Filzilla Client to view/edit FTP files on my server I am able to open and edit HTMLn PHP, and CSS Files using Notepad++ or Brackets Editor but on JavaScript files I am getting this error
the js Files icons also looks different than Notepad++ or Brackets Editor which are like bwlow
Can you please let me know why this is happening?
I have set "custom editor" & check "always use defualt editor" then working for me.
https://i.stack.imgur.com/ZmDLl.png
By default the View/Edit command in FileZilla opens the file in an application associated with the file type. While you have the editor associated with .php/.css, you have a WSH runtime associated with .js, so the JavaScript files get executed.
You can override the default behavior by going to Edit > Settings > File editing.
I logged in to my FTP from Filezilla and tried to open a JS file, and it gave me the following error:
Script: C:/.../slider.js
Line: 1
Char: 1
Error: 'document' is undefined
Code: 800A1391
Source: Microsoft JScript runtime error
I have jQuery linked to the .php file as well...'document' comes from:
$(document).ready(function() {
//Code is here...
});
I tried downloading the file and opening it, I tried removing the $(document).ready();, I tried removing jquery (which by the way, when I opened the jQuery file it gave me the same almost the same error). Any help is appreciated. Thanks!
EDIT:
One of the tags for this post was "asp.net", but to be honest I don't even know if it is related to asp.net...
I had the same issue and fixed it by doing the following in Filezilla:
Go to Edit > Settings
Go to the 'File editing' section
Under 'Default Editor': Ensure that Notepad++ is selected as your custom editor
Change the radio button from 'Use filetype associations if available' to 'Always use default editor'
You say that you're right clicking and clicking "View/Edit", and it throws that error.
The error is occurring because Windows is executing the script, and the script has a problem (because it relies on another script being loaded).
So although you may be clicking "View/Edit", and expecting that this will open the file in Notepad++, what it is actually doing is assuming that "View" means "Run the script".
Clearly, Notepad++ is not the default action for this file type, or at least it isn't according to Filezilla. Maybe the default action isn't actually set the way you think it is, or maybe it's Filezilla that isn't respecting your default action.
The solutions:
If Filezilla has an option "Open with..." that allows you to pick the program to open the file with, then use that and select Notepad++ manually. Even better, if it has the option to then make that the default, then tick it, and the problem should be solved permanently.
Alternatively, just download the file to your local machine before trying to open it.
I got this working in FileZilla by doing the following: -
Edit -> Settings
File editing -> Use custom editor [file path to notepad ++] then
|___File editing -> Filetype associations
Adding the line -> js "C:\Program Files (x86)\Notepad++\notepad++.exe"
Click OK to save changes
This will stop windows script host from attempting to run the file and open in notepad++.
While the question has effectively been identified previously in the post I hope that someone finds this 'how-to' useful.
This is not a programming problem. It's a file association problem - Windows is trying to execute your .js file instead of opening it in an Editor.
See this question on SuperUser: running-javascript-files-js
There's also some explanation of the error here.
Check your file associations again. Try restarting your machine. You will get more help if you ask this type of a question on SuperUser.
It's worked for me after adding the file association.
Edit -> Settings
File Editing -> Select Use filetype association if available checkbox.
Select Filetype Associations -> add association here
js "C:\Program Files\Sublime Text 3\sublime_text.exe"
OK
Note: change association according to your text editor application.
Just follow these steps. It is an easy one to do. Change the default file type for opening the js files.
Edit -> Settings
File editing -> Filetype associations
Adding the line -> js "C:\Program Files(x86)\Notepad++\notepad++.exe"
That's it. Finally, Click OK to save changes.
It will work afterwards.