ConEmu-Color-Themes icon indicating copy to clipboard operation
ConEmu-Color-Themes copied to clipboard

Install-ConEmuTheme.ps1 script throws this error

Open SentinelWarren opened this issue 7 years ago • 10 comments

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?

SentinelWarren avatar Jun 07 '17 13:06 SentinelWarren

It says you need to provide -Operation Add and -ThemePartOrName <path_to_xml> parameters.

daniyel avatar Jun 22 '17 12:06 daniyel

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.

SentinelWarren avatar Jun 23 '17 19:06 SentinelWarren

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 avatar Jun 26 '17 03:06 joonro

@joonro ConEmu.xml its there, but its empty!!

SentinelWarren avatar Jun 26 '17 10:06 SentinelWarren

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.

joonro avatar Jul 01 '17 21:07 joonro

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

SentinelWarren avatar Jul 02 '17 00:07 SentinelWarren

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.

joonro avatar Jul 02 '17 19:07 joonro

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.

oneone1995 avatar Aug 16 '17 08:08 oneone1995

@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

sergeevabc avatar Nov 20 '18 16:11 sergeevabc

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

joonro avatar Nov 20 '18 18:11 joonro