Quick - Get multiple BBCode links from imgur? - imgur

There used to be a way to get a copy-and-paste link of all the [img] codes from an album on imgur, did they remove that? If not, how do you get all the [img]s besides manually doing it?
Example;
[IMG]http://i.imgur.com/photohere.png[/IMG]

paste this in your console:
var bb=[];$('a.zoom').each(function(){bb.push('[img]'+this.href+'[/img]');});console.log(bb.join(''));
I'm sure someone could make a userscript out of this, but this is enough for me.
or, more elegant, if you don't want to select the text yourself:
var bb=[];$('a.zoom').each(function(){var h = this.href; bb.push('[url='+h+']'+'[img]'+h+'[/img][/url]');});window.prompt("Copy to clipboard: Ctrl+C, Enter",bb.join('\n'));
This one opens a prompt with the text already selected, wraps each image in a link, and separates each [img] with a line return

Related

Script to paste a specific string into a text field with a hotkey

I am trying to find a way to paste a predefined string upon entering a specific keyboard sequence, on any app.
For example if I have to paste an url or a password into a field, I can have said password in a hidden script and when I press, say, [ctrl] + [5], it would write "example123" on the text field where my cursor is.
Ideally without copying to the clipboard (I'd prefer keeping what I have on my clipboard and also avoiding to paste a password or such by mistake elsewhere).
I have tried every solution I've found so far that include xclip, xdotool and xvkdb. All of them either do not work or are really inconsistent: They only paste the string sometimes, and when they do, it's usually only part of the string ("ample123" instead of "example123").
I thought of using compose key, which I heavily use anyway to write in french on an us keyboard, but it seems it only supports 1 character sequences, as nothing is printed when I modify my .XCompose to include custom output sequences of len > 1.
I am using Ubuntu 18.04 with Gnome as a DE. Ideally something that also works when logging back (like compose keys).
You need to walk the Document Object Model for either Gnome or your web-page. My concern is that with a desktop script you wont be able to access the web page because you will need to be able to establish a target to send string to. I see in your question that you tried using using "x{tool-name}" to grab the text field element. Delivering the sting really isn't the problem. The problem is getting the GUI element of text box pragmatically. The easiest way to get access to this in a user loaded web-page is with WebExtensions API which is how to make extensions for most modern browsers. Otherwise, if you can get away with only having access to Gnome's GUI I would try LDTP, it's a library used for testing, but it looks like it can be used for automation too.
For keyboard shortcuts:
It really shouldn't matter what the script is doing to how you want to activate it. I would just go to Gnome/Settings/Keyboard and set the path to where I saved the script to be the Command. If you go the WebExtension route, you will want to build the shortcut into your extension.

LXDE: Change text in logout session

I have installed LXDE on my Ubuntu PC (not Lubuntu). I want to change the text in the logout session. The default text is "Logout LXDE session ?". But I want to personalize it. I've already changed the picture of the logout session. Can you help me? Thank you very much.
BowStar
I don’t know yet how to solve this in a completely and permanent way, but you can create a new logout dialogue box:
Make a Folder and, inside it, click with the right mouse button to create a new empty file (a simply txt file) with the name "temp-lubuntu-logout" (you can change the file name after the conclusion of the work.
Paste this text, changing the items to fit your options:
!/bin/sh
lxsession-logout --prompt "Your custom message" --banner "Your logo" \
--side "left | top | right | bottom (The position of the logo)"
Open with the terminal the folder where is your temp-lubuntu-logout file and make it executable with this command:
sudo chmod +x temp-lubuntu-logout
That’s all! You just created a script file!
To verify is it is working, write in the terminal:
./temp-lubuntu-logout
(dont forget the dot before the /)
Now I can’t help more them this. You need to link this script to the the command of a app. Or you can change the lubuntu-logout script with your new script file (you may, for example, rename the original script to "former-lubuntu-logout" and your file to "lubuntu-logout". Probably, the path to the "lubuntu-logout" file is /usr/bin).
https://crisnepita.wordpress.com/2012/08/12/cambiar-un-poco-la-ventana-de-cerrar-sesion-en-lubuntu/
https://unix.stackexchange.com/questions/170029/command-to-log-out-of-lxde-directly/171880
http://tunealxde.blogspot.pt/2015/02/tunea-el-dialogo-de-cierre-de-sesion-de.html
I have found a way to change it.
Warning
This requires you to know what you are doing.
Use your favorite hex editor and edit file /usr/bin/lxsession-logout
Scroll all the way down the file, then go up until you see a human-readable section.
Over there, on a long string, there is the logout menu in bytes.
Once you change stuff in there, and save the binary, if you did not break something it will work. For deleting something, just overwrite its section with spaces, same for text and labels.
Tip: only edit and don't change any appearance order or add more bytes at some index because it will scramble the offset table of the file and will become corrupted.

PowerGrep Search and Replace: "cannot make replacements using read-only converters"

I get an error on PowerGrep software when I try to Replace the content of some files: "cannot make replacements using read-only converters"
What can I do? Can anyone help me a little bit?
I find the solution:
In the left menu, on File formats to convert to plain text, you have to choose from that combo "Writable proprietary formats".
Then, press the section [...] and add NEW (format). In my case, I add .txt. Click ok. And then run "REPLACE"

notepad++ how to convert to typing assistant like?

I was using notepad++ to create a report and its taking a quite a while for me to type and do so.
Well i had tried a software called typing assistant it was really good(except for the money part :D).
TO the Point :
is there any way tat i can link a dict(text file of words) and use notepad ++ as typing assistant please tell me if so i
can speed my report.
Cause i am a programmer too so i really like the keyword completion and stuff .But is there a way to use it for text ?
already tried Phrase Express -.-:
Takes long and its kinda for macro text and text completion don't work tat fast for me to tab and complete
if there's a question in the form like mine link me to tat :
i searched it and i didn't get it
Yes, you can set up your own custom auto-complete dictionaries in notepad++. You need to create an xml file with your language name and put it under the plugins/APIs directory in notepad++. Of course this assumes you know how to write xml. There's a formal description of how to implement this here.
I've never tried to create an auto-complete dictionary for plain text files, so I'm not sure if it's possible, but I have successfully created them for user-defined languages, which you could also do if you can't get it to work with text files.
I'm not sure if this question is really a duplicate, but here is a very similar one, which may help you in your research.

how can I extract text contents from GUI apps in linux?

I want to extract text contents from GUI apps,here are 2 examples::
example 1:
Suppose I opened firefox, and input url : www.google.com
how can I extract the string "www.google.com" from firefox using my own app ?
example 2:
open calculator(using gcalctool),then input 1+1
How can I extract the string "1+1" of calculator from my own program?
in brief ,what I want is to find out whether there is a way to extract the text contents from any widget of an GUI application
Thanks
I don't think there's a generic way to do this, at least not a very elegant one.
Some inelegant ideas:
You might be able to modify the X window system or even some toolkit framework to extract what is being displayed in specific window elements as text.
You could take a screenshot and use an OCR library to convert the pixels back into text for the interesting areas.
You could recompile the apps of interest to add some kind of mechanism for asking them questions.
You could use something like xtest to inject events highlighting the region of interest and copying it to the clipboard.
I believe firefox and gcalctool are for examples only and you just want to know in general how to pass output of one application to other application.
There are many ways to do that on Linux, like:
piping
application1 | application2
btw here is the Firefox command line manual if you want to start firefox on Ubuntu with a URL. eg:
firefox "$url"
where $url is a variable whose value can be www.mozilla.org
That sounds difficult. Supposing you're running X11, you can very easily grab a window picture ( see "man xwd"); however there is no easy way to get to the text unless it's selected and therefore copied to the clipboard.
Alternatively, if you only want to capture user input, this is quite easy to do, too, by activation the X11 record extension: put this in your /etc/X11/xorg.conf:
Section "Module"
Load "record"
#Load other modules you need ...
EndSection
though it may prove difficult to use too, see example code for Xorg/X11 record extension fails

Resources