Issue - I have this large batch of pdf, word & notepad files which are required to be renamed according to the text available in each file.
For eg: I have to open file A, search the entire document for the string which will be used as its name, copy, close the file and rename the file.
After searching for some while I found that autohotkey can help me with this though I'm open to every solution. What I want to do is open the file, search for the name, select the text and use the keystroke to close and rename the file.
Could anyone help me with this?
I'm not going to give you a script but what you want can be done.
You need to collect various pieces of information when you rename a file. One of them being the current file name which you can often grab from the window title. You can use https://autohotkey.com/docs/commands/WinGetTitle.htm
If a filename is wrapped in [ ] you can remove those using https://autohotkey.com/docs/commands/StringReplace.htm
If you know the file path (folder where the file resides in) you can now use https://autohotkey.com/docs/commands/FileMove.htm to rename a file and use https://autohotkey.com/docs/misc/Clipboard.htm as a variable.
You would probably like to retain the extension (.doc, .txt, .pdf) so you can use https://autohotkey.com/docs/commands/SplitPath.htm to grab it and append that to the clipboard when you rename it.
Closing a file depends on your program, sometimes you can send ctrl+w or ctrl+w or you need to use the WinClose command so you need to add in that step before you use FileMove.
Is there a simple way to change / replace the automatically generated Template Miniature with a different image.
I have checked this out for Excel 2016 but the process is similar.
First, the thumbnail is generated and part of the file. There is no official process. A description for brave Office pros is shown below.
You can do this:
First, close Excel!
Get to the location of your template
Make a copy
Rename the file extension to .zip
Unzip the file into a new folder using the Windows Zip utility
Search the tree of files for a file called thumbnail.wmf
Open PowerPoint and create an empty presentation
Use the function "Insert an Image" and add the thumbnail.wmf to the slide
Remove everything else from the slide
Try to ungroup - it fails with a message asking to convert to a drawing object
From here you have two options. Either convert, ungroup, change and proceed or throw away and create a new image from scratch.
Work on image and group your image (the old or a new one), then
Right click on the grouped image and click "Save as picture"
Choose the filetype "wmf" and name it the same as before and overwrite the existing thumbnail.wmf
Go INTO the folder using Windows Explorer of unpacked files, hit Ctrl-A (Select All)
Right click and say "Send to" --> "Compressed (zipped) folder". Give it a new name.
Hit F2 to rename the file
Remove the file extension .zip
Now, open Excel!
Hit "New", "Personal" and you see your template with your custom image in full width and height. Repeat steps 10 to 16 until you're satisfied.
Drawbacks: Once you edit your file in excel and save as template with thumbnails option (advanced properties) switched on, Excel will overwrite your custom wmf-file. You have to repeat the steps "Unpack -> Replace File -> Pack" every time.
I'll post an update once I found a better solution.
Here is an automation of the process that might help with understanding the process described in the answer.
Python 3 code snippet
import zipfile
import shutil
exfilename = 'MYTEMPLATE.xltm'
a_path='C:\\TEMP'
th_path='mythumbnail.wmf'
with zipfile.ZipFile (exfilename, 'r') as zf:
#Extract to temporary folder
zf.extractall(a_path)
#replace the thumbnail
shutil.copyfile(th_path,a_path+'\\docProps\\thumbnail.wmf')
#remake the zip as a new file
shutil.make_archive('TEMP_ARCHIVE','zip',a_path)
#rename back to original, replacing original
shutil.move('TEMP_ARCHIVE.zip',exfilename)
#clean-up temporary files
shutil.rmtree(a_path)
I would like to ask for your help! There is a text file (target.txt) and I would like to crop some lines from it. I thought it would be a good approach to add these lines to a separate file (to_crop.txt) and write a script which parse the target.txt file for the exact content in the to_crop.txt and when it finds and crops it the result file would be overwritten back to the target.txt (make it smaller).
(Why I need this? During a command line installs script I had to append a config file with some parameter lines (#starthere command #finishere) like:
star there
command xyx,bla bla
finish here
I need to create an uninstall script which removes these lines from this config file.) I would like to use a cmd file in command prompt to do it. Thanks for your ideas in advance!
Use sed, the stream editor: sed.
I have my own build system for perl test files, and it works just fine except when capturing input. If I have an open file called, e.g., ~/projects/something.pm, on error the output of the build system will be something like Failed test at /home/username/projects/something.pm line 66.
The regex for capturing works fine, the problem is that sublime thinks that the two files are in different paths, so it opens a new tab, and I just want the open file to be brought up front.
Is there any setting to make this "match"?
EDIT: My .sublime-build file is generated every time I run the build, to support the fact that I may want to run a single test instead of all the file.
I have my own plugin that detects which test I'm using the cursor position and appends that to the command line. It makes no difference though, since the behaviour is always the same, even with a "standard" build.
The contents of the .sublime-build file are like this:
{
"shell_cmd" : "prove $file_path/$file_name" ,
"working_dir" : "/home/username/projects/",
"file_regex": " at (.*.pm) line ([0-9]*)",
}
I've tried replacing /home/username with the ~ character, but for some reason this breaks the build system, and when building I just get a black output panel, with the status bar saying "Building...".
I've found the real problem with a workaround anyway, posted that as an answer.
The problem in this case was that I didn't notice that the main directory of the project (which is generated beforehand), is actually a link to a directory of another user.
This means that if you add a folder to your project and that folder is a link, in the output you'll get the "real" directory, not the link.
Solved by removing the symbolic link folder from the project and adding the destination of the link as a folder to the project and now it works fine.
I changed the colors of the powershell and now I can't change the color of the input text, is always yellow.
I changed the color of the background and the color of the text
The color of the background changed correctly but in the display text the color still is yellow.
Can I do something to reset the colors?
This resets the console colors (e.g., [Console]::BackgroundColor): (Paste in the powershell console)
[Console]::ResetColor()
I realize this is an old question, but I found it in Google and have another solution.
Set-PSReadlineOption -TokenKind Command -ForegroundColor Black
Source
This will change the input text to black. The available color choices are as follows:
Black
DarkBlue
DarkGreen
DarkCyan
DarkRed
DarkMagent
DarkYellow
Gray
DarkGray
Blue
Green
Cyan
Red
Magenta
Yellow
White
You can make this persist by adding it to your profile. It's enough to append the command to the end of the file.
In my case the profile is in: C:\Users\Billy\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1
To get the location of your PS profile type:
$profile
If this file doesn't exist, you can create it with:
New-item –type file –force $profile
(source)
To see the current settings in your profile, use:
Get-PSReadlineOption
(source)
The colors you see by right clicking on the title bar and clicking on Properties are actually stored in the shortcut file itself in the ExtraData section. You can just delete shortcut and recreate it, or you can use a hex editor to change the values. Outside of that, there is not "reset" feature. This is also true for the normal command prompt.
Answer
With respect to the original question, the yellow text is intentional. It is syntax coloring from the PSReadLine module. This coloring is the (new) default for Windows PowerShell.
As PetSerAl mentioned, Remove-Module PSReadline will remove the highlighting for that session. If you want to permanently remove PSReadLine then modify your PowerShell profile with these PowerShell commands:
if (!(Test-Path -Path $PROFILE)) {
New-Item -ItemType File -Path $PROFILE -Force
}
Add-Content $PROFILE "`nRemove-Module PSReadline"
If you want to change the syntax coloring, follow the documentation for Set-PSReadLineOption. Specifically, look at parameters with "color" in their name. And make sure to set the version in the documentation to match your PowerShell version. (One exception is Windows 10 version 1809 and later which uses the PowerShell 6.0 syntax.)
Example
For example, if you wanted to change the command text color from yellow to magenta then (using the PowerShell 6 syntax) you could enter the following into a PowerShell:
Set-PSReadLineOption -Colors #{
"Command" = [ConsoleColor]::Magenta
}
Keep in mind this is temporary and would have to be added to your PowerShell profile to become permanent.
Fixing Shortcut Colors
If, on the other hand, you saw the shortcut properties screen capture in the original question and thought, "Hey, I screwed up my shortcut colors," then this answer is for you.
As Drew Chapin points out, an easy solution to fix that issue is to recreate the shortcut. But if you just create a new shortcut and point it to powershell.exe, you'll get a black and white shell.
If you want the nice blue and white shell, you'll have to do something else.
Before you create new shortcuts, it is a good idea to clear out the ones causing the problem. If you have them pinned somewhere and are not sure where the actual shortcut file is located then below are some common locations. Enter these paths into the File Explorer address bar, one at a time, and poke around. In some instances, I give the path to a parent folder and suggest that you use the search function in File Explorer to search for "powershell" in the subfolders:
shell:Common Desktop
shell:Common Start Menu search for "powershell"
shell:Common Startup
shell:Quick Launch
shell:Start Menu search for "powershell"
shell:Startup
shell:User Pinned search for "powershell"
Creating New PowerShell Shortcuts
Coming back to fresh shortcuts, the do-it-yourself solution is to create a new Windows user and to copy the PowerShell shortcuts from their start menu. You can find the shortcuts by opening File Explorer and navigating to:
shell:Start Menu\Programs\Windows PowerShell
If you don't want to go through the trouble of creating a new user or are unable to do so, I created a PowerShell script that will create the shortcuts for you. Change directory to where you want the shortcuts created. Then either paste the following commands in a PowerShell or save and execute them as a .ps1 file. Remember that the shortcuts will be created in the current working directory.
Example
Open PowerShell.
Change directory to the PowerShell folder in the Start Menu.
set-location "$env:APPDATA\Microsoft\Windows\Start Menu\Programs\Windows PowerShell"
Remove the existing shortcuts (if they're giving you problems).
remove-item .\*.lnk -whatif
Run the script below.
# Base64-encoded PowerShell .lnk files from a new Windows user profile.
# Windows 10.0.17763.615 en-US
$windowsPowerShellLnk = #"
TAAAAAEUAgAAAAAAwAAAAAAAAEbfAgAAIAAAAJuvlrfNas0Bm6+Wt81qzQGAHQKo3WrNAQD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AAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=
"#
# Decode and save to file.
[System.IO.File]::WriteAllBytes("$pwd\Windows PowerShell.lnk", ([System.Convert]::FromBase64String($windowsPowerShellLnk)))
[System.IO.File]::WriteAllBytes("$pwd\Windows PowerShell ISE.lnk", ([System.Convert]::FromBase64String($WindowsPowerShellISE)))
[System.IO.File]::WriteAllBytes("$pwd\Windows PowerShell (x86).lnk", ([System.Convert]::FromBase64String($WindowsPowerShellx86)))
[System.IO.File]::WriteAllBytes("$pwd\Windows PowerShell ISE (x86).lnk", ([System.Convert]::FromBase64String($WindowsPowerShellISEx86)))
# Trailing comment as a selection-aid for Stack Overflow readers.
Also, I have some commentary on the thread to date.
The answers that set out to reset the PSReadLine colors assume that those colors have been permanently set to non-defaults. That is unlikely because you would have to make a change to your PowerShell profile. And you would know if you changed your profile.
The other problem here is that yellow is the intended color for commands in the default PSReadLine scheme. So any reset would only give the original poster the same yellow text.
With respect to non-default colors, an easy test is to close and reopen PowerShell. If, when typing a command, the text is yellow then you're probably OK; whatever was troubling you was limited to that PowerShell session and is now gone.
If you want to check your PowerShell profile for any (permanent) Set-PSReadLineOption commands then enter
notepad $profile
into PowerShell and browse through the text file that opens. If you receive an error then you don't have a profile, (and it can't be the problem).
Edit: as pointed out by #dhobbs in the comments, this is no longer an option in PowerShell 6: https://learn.microsoft.com/en-us/powershell/module/PSReadline/Set-PSReadlineOption?view=powershell-6.
Resetting the PowerShell console colors to their defaults can be done with the following command:
Set-PSReadlineOption -ResetTokenColors
Documentation here: https://msdn.microsoft.com/en-us/powershell/reference/5.1/psreadline/set-psreadlineoption
Add the line to your PowerShell profile to make it have the command run each time a PowerShell console is opened. To see the location of your PowerShell profile, from a PowerShell console type:
$profile
Stolen from Xin, but I cannot comment so you're going to have to accept that
[Console]::ResetColor()
then clear the screen to let the change take effect.
clear
I think that was the problem bucky was having with the previous answer.
Hope this helped!
Is it the ISE you are referring to? If so select Tools > Options and you will see the option to change background and foreground colour. From here you can select "Restore Defaults"
I found this worked. It's the answer from user 577111 I think. We need to put all this into PS.
Set-PSReadLineOption -Colors #{
### Use a ConsoleColor enum
"Error" = [ConsoleColor]::DarkRed
### 24 bit color escape sequence
"String" = "$([char]0x1b)[38;5;100m"
### RGB value
"Command" = "#8181f7" }
I found the MS page linked to in one of the above answers worked for me just now, today, june 2019
ms fix for powershell
I simply pasted their first suggestion - this - into powershell and it seems okay now:
Set-PSReadLineOption -Colors #{
#Use a ConsoleColor enum
"Error" = [ConsoleColor]::DarkRed
#24 bit color escape sequence
"String" = "$([char]0x1b)[38;5;100m"
#RGB value
"Command" = "#8181f7"
}
though I'm not 100% sure because the white background I set is still there. But the yellow is gone, that's for sure.
This is a later edit. I've come back and tried to put all that into a code block instead of just the first line but I can't figure out how to do it.
Point is you must put all the code between the curly braces in and the #tagged lines are comments. Unfortunately the comments and code are all on the same line and I can't fix it. The comment finishes where the " " text begins.
Would have been simpler if I'd taken the comments out I guess. Anyway.. June 2019, this is the only technique that worked for me.
p.s. I now find the fix doesn't work after closing down. When I restart I have to do it again.
You can backup colors using this facility.
https://github.com/lukesampson/concfg/blob/master/README.md
It provides wonderful preset settings that work perfectly.