View Single Post
  #1230  
Old 14.03.2020, 00:24
BJN01 BJN01 is offline
JD Adviser
 
Join Date: Jan 2020
Posts: 113
Default

@zreenmkr = ???
sorry but now I don't understand, the script I posted now worked (it does what I need).
when I posted it I was still in the "development" phase (say)
I had put it because I had a doubt about the "process" that I followed in the script, namely:

- select the link in the tab linkgrabber
- delete the old example.txt file (SaveLinkFile.txt)
- write the info i want in the new txt file

-open the new txt file with notepad.exe

the question was << to have a notepad open with the info pasted inside do I have to write a real file? can't it be done virtually with some command to avoid deleting files? >>

and mgpai answered this question

Quote:
mgpai
There is an option to to append (true) or not append (false), but there is no option to overwrite. You will just have to delete the old file and create a new one.

if you are interested in the current result is this:

Code:
// "select link, paste them in a tx and open it"
// N.B = add button (event scrip trigger) in linkgrabber contextmenu
//trigger : linkgrabber contextmenu button press
if (name == "Save LinkGrabber selez + open txt") {

    var SaveLinkFile = getPath(JD_HOME + "/tmp/SaveLinkFile.txt");
    var textEditor = "notepad.exe";
    var links = lgSelection.getLinks(); 
    var urls = [];

    for (i = 0; i < links.length; i++) {
        var link = links[i];
        var fileName = link.getName();
        var GrabberURL = link.getContentURL();
        urls.push(fileName + " , " + GrabberURL);
    }

      if (SaveLinkFile.exists()) SaveLinkFile.delete(); // delete the old file "savelinkfile.txt"    
    if (urls.length) writeFile(SaveLinkFile, urls.join("\r\n"), true);
    callSync(textEditor, SaveLinkFile); //now i edit the file and "save as " it .
}
--> select link in linkgrabber tab
--> TD mouse / linkgrabber contextmenu /run script
--> I see notepad (SaveLinkFile.txt) , now I , edit - add - write - delete what i want and " save as" (changing path and name every time as needed ) .



Quote:
as @mgpai mentioned, there is no native key strocks in jd but autoit can be called to do that.

Quote:
I read the page but I think at the moment it is a little too much beyond my current skills and needs.
I could help you started with 'autoit' to send 'F2' key. Let me know what 'F2' does because 'F2' function in jd is to Rename. Do you need to send F2 to another program?
(F2 it was an example !)


In JD there is a command: <<clear filtered links>>
( setting\user interface\linkgrabber botton bar .....
the icon is a gray funnel)
I matched it with a shost cut (ctrl + del)

so when I have the JD window open I activate it by pressing the two keys (ctrl + del).
I had hypothesized to insert this operation (or the pressure of the 2 keys) in a script in order to execute the command.

now I'm starting trying to work on the autohotkey script which should simply say "hold down ctrl + delete key to JD ".
but i dont know if it work the way i think ....
Reply With Quote