Change text colour in WINDOWS command line [duplicate] - windows

This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
how to have multiple colors in a batch file?
Colorizing Windows command line output from PHP
Let me just make this very clear: I am on WINDOWS, so \033[0;35mText WILL NOT WORK.
Sorry to have to emphasize like that, but every possible duplicate I have seen has people saying to use the above code regardless of what OS the question is about.
Now, I know it's possible without too much trouble - ffmpeg does exactly the kind of thing I want to do:
(source: adamhaskell.net)
So how hard can it be?

Use SetConsoleTextAttribute to set the text colour.

Related

Powershell and Adobe OCR [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 1 year ago.
This post was edited and submitted for review 1 year ago and failed to reopen the post:
Original close reason(s) were not resolved
Improve this question
we have many pdf files they are all unlocked they have text, pictures etc. everytime we have to open the file on adobe and do it manually i was thinking maybe there is a better way to do with PowerShell if not yeah we have to do over 1000 files and more are coming but thank you for your answer
Peggy
After looking into it a bit more, I discovered a command-line tool that you can use in tangent with PowerShell. It's called tesseract. For Windows and Linux, download the prebuilt binaries. For MacOS, you need to get use MacPorts or Homebrew.
You'll want to do something like this:
# Using Get-ChildItem's -Include parameter to filter file types
# requires the target path to end in an asterisk. Using just an
# asterisk as the path makes it target the current directory.
foreach ($pdf in (Get-ChildItem * -Include *.pdf))
{
# An array isn't needed, it's just good for arranging arguments
tesseract #(
#INPUT:
$pdf
#OUTPUT:
"$($pdf.Directory)\{OCR} $($pdf.Name)"
#LANGUAGE:
'-l','eng'
)
# The directory is included in the output path so that you can
# change Get-ChildItem's target without adjusting the argument
}
Or, without the fluff:
foreach ($pdf in (Get-ChildItem * -Include *.pdf))
{
tesseract $pdf "$($pdf.Directory)\{OCR} $($pdf.Name)" -l eng
}
Granted, I haven't actually tested tesseract out, but I did read other Q&A pages to derive the appropriate command. Let me know if there's any issues.
Your question is a bit unclear. There is a way to OCR images using PowerShell, such as using this function, and you can convert pdfs to images using this function (it does require imagemagick, which is available here, there are portable options if yuo don't want to install anything). This would effectively allow you to search PDF files that haven't been OCR'd.
However, in terms of directly editing the PDF files with PowerShell to make them into OCR'd PDFs, while PowerShell functionality might help you automate the process, you would first need to find a program that can do that sort of thing from the command line. The PDFs would also have to all be unlocked so that editing them would even be possible (though there are ways to circumvent PDF locks to unlock them).
Unfortunately, I don't really know of any programs that can do that. Maybe it's possible with some advanced Ghostscript parameters, but I haven't looked into it. It is certainly not going to be easy!

How to use escape sequences [duplicate]

This question already has answers here:
Ansi colours on Windows 10, sort of not working
(2 answers)
Closed 3 years ago.
I am trying to get escape sequences to work in a Go application. Specifically the code to move the cursor. fmt.Printf("\033[3;5H")
What should I be printing / writing to in order to make this work? Or am I approaching this the wrong way entirely? Every time I run the code I just get some funky looking characters in the terminal or nothing happens. I am running windows 10.
I have tried using multiple different fmt.Print functions but I get the same results.
// Move the cursor
fmt.Printf("\033[3;5H")
// Print at new position
fmt.Printf("Print this text at the new cursor position")
Turns out you need to enable Virtual Terminal Processing in Windows 10 to use ANSII escape codes
https://github.com/konsorten/go-windows-terminal-sequences

What is the quickest / easiest way to create a new file in the command line? [duplicate]

This question already has answers here:
How to create a file in Linux from terminal window? [closed]
(17 answers)
Closed 5 years ago.
I'm sure that there are many ways to do this (cat > foo.txt, vim, etc) a la https://www.cyberciti.biz/faq/create-files-in-linux-unix-from-bash/ but I'm not advanced enough to understand if there's anything else that's being done by using these different commands to create my file (e.g., perhaps a file created in vim has different properties than one created with the cat command above).
Looking to maximize ease, speed and purity (no additional properties) of the file created. Thanks!
Very easy is to use touch :
touch myfile

What does wc do? And how do you use it to count words in a file? [duplicate]

This question already has answers here:
Whats is the behaviour of the "wc" command?
(2 answers)
Closed 6 years ago.
I'm new to the Linux/Unix world but found this decent online resource https://linuxjourney.com that's sort of explains some general command line code. I'm running an Oracle VM with Ubuntu based variant. I'm away from my computer now so I don't know which version but I'm fairly certain it's bash4
WC (Word Count) is a simple command line utility that displays the number of words in a file. It is especially useful for text files. Word documents, Libre office documents etc are a different matter.
Simply type 'wc ' and it will output the number of words in the file. If you need more information, type 'man wc' in a terminal and it will show you the full list of options.

How to show content of variables in Xcode? [duplicate]

This question already has answers here:
Xcode Debugger: view value of variable
(8 answers)
Closed 9 years ago.
In many cases xCode does not show the content of the variables when I move the mouse over them.
Is there an alternative way to show the content?
For example of simple bytes, arrays of bytes, ...
Is there a way to specify the output format somehow?
There is now much improved variable formatting via the lldb debugger, where you can specify the formatting for your own types. Read the docs on how to specify these, then put them in a python script and in ~/.lldbinit add the line:
command script import path/to/my/formatters.py
For more information on LLDB data formatters see:
http://lldb.llvm.org/python-reference.html
http://llvm.org/svn/llvm-project/lldb/trunk/examples/synthetic/ - has examples for STL formatters
look at the bundled scripts in Xcode.app/Contents/SharedFrameworks/LLDB.framework/Resources/Python/lldb/formatters
Some times Xcode doesn't show the content when place mouse over the variable.for getting the value you can write like po (variable name ) in console.
once check this one

Resources