ConEmu-Color-Themes
ConEmu-Color-Themes copied to clipboard
Install-ConEmuTheme.ps1 script throws this error
PS>.\Install-ConEmuTheme.ps1
cmdlet Install-ConEmuTheme.ps1 at command pipeline position 1
Supply values for the following parameters:
Operation: Add
ThemePathOrName: themes\material-sublime-darker.xml
C:\Users\Me\Documents\WindowsPowerShell\ConEmu-Color-Themes\Install-ConEmuTheme.ps1 : Exception calling
"Save" with "1" argument(s): "Invalid XML document. The document does not have a root element."
At line:1 char:1
+ .\Install-ConEmuTheme.ps1
+ ~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException
+ FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Install-ConEmuTheme.ps1
What am i doing wrong?
It says you need to provide -Operation Add
and -ThemePartOrName <path_to_xml>
parameters.
of which is what i did. the error that i am really concerned about is Exception calling "Save" with "1" argument(s): "Invalid XML document. The document does not have a root element.
Hi - sorry for the late reply.
Just to clarify, are you saying you are getting this error when you do:
.\Install-ConEmuTheme.ps1 Add -ThemePathOrName themes\oceans16-dark.xml
for example?
If so, could you please check if you have %APPDATA%/ConEmu.xml
? I remember ConEmu started using the registry for the settings. Currently you have to have your settings stored at %APPDATA%/ConEmu.xml
for this script to work. (I believe you can change this in the settings).
Please let me know if this works.
@joonro ConEmu.xml
its there, but its empty!!
You should create that file - please follow Manually add color schemes and modify the ConEmu.xml file
part in the README and try to generate the file.
This is the error i am getting now.
C:\Users\Me\Documents\WindowsPowerShell\ConEmu-Color-Themes\Install-ConEmuTheme.ps1 : You cannot call a
method on a null-valued expression.
At line:1 char:1
+ .\Install-ConEmuTheme.ps1 -Operation Add -ThemePathOrName themes\ocea ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException
+ FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Install-ConEmuTheme.ps1
It is hard for me to know what is wrong with the information - you can send me your ConEmu.xml
so I can take a look.
I also encountered the same error because my ConEmu.xml
contains Chinese characters.Pls think about this.
Before using the script, there is a line like
<value name="ConsoleFontName" type="string" data='新宋体'/>
and the file encoding is UTF-8, then i got the error such as @SentinelWarren .So i commented this line to use the script, but when i open ConEmu.xml
again, i found this line get mojibake.
<!-- <value name="ConsoleFontName" type="string" data="鏂板畫浣?/> -->
and the file encoding turned to UTF-8 with BOM
I hope you can solve it.
@joonro, installation via provided powershell script just does not work.
At first, the script seems not to grab provided arguments…
$ Install-ConEmuTheme.ps1 -ConfigPath C:\Far\ConEmu.xml -Operation Add -ThemePathOrName themes\ayu.xml
Supply values for the following parameters:
Operation:
But even after typing arguments manually, the script throws errors…
Operation: Add
ThemePathOrName: themes\ayu.xml
Get-Content : Cannot find path 'C:\Users\Alexander\AppData\Roaming\ConEmu.xml' because it does not exist.
At C:\Far\Install-ConEmuTheme.ps1:59 char:31
+ [Xml]$config = Get-Content <<<< -Path $ConfigPath
+ CategoryInfo : ObjectNotFound: (C:\Users\Alexan...ming\ConEmu.xml:String) [Get-Content], ItemNotFoundException
+ FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.GetContentCommand
C:\Far\Install-ConEmuTheme.ps1 : You cannot call a method on a null-valued expression.
+ CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException
+ FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Install-ConEmuTheme.ps1
Well, it works for me. In the example below, it correctly identifies the theme was already added to config when I tried to add ayu.xml. Then I successfully removed/added the theme. I used a different -ConfigPath
to make sure.
> .\Install-ConEmuTheme.ps1 -ConfigPath C:\Users\Joon\Downloads\ConEmu.xml -Operation Add -ThemePathOrName themes\ayu.xml
C:\Users\joon\Dropbox\Colors\ConEmu\Install-ConEmuTheme.ps1 : Theme was already added to config
At line:1 char:1
+ .\Install-ConEmuTheme.ps1 -ConfigPath C:\Users\Joon\Downloads\ConEmu. ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException
+ FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Install-ConEmuTheme.ps1
> .\Install-ConEmuTheme.ps1 -ConfigPath C:\Users\Joon\Downloads\ConEmu.xml -Operation Remove -ThemePathOrName themes\ayu.xml
> .\Install-ConEmuTheme.ps1 -ConfigPath C:\Users\Joon\Downloads\ConEmu.xml -Operation Add -ThemePathOrName themes\ayu.xml