Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Install-ConEmuTheme.ps1 script throws this error #15

Open
SentinelWarren opened this issue Jun 7, 2017 · 10 comments
Open

Install-ConEmuTheme.ps1 script throws this error #15

SentinelWarren opened this issue Jun 7, 2017 · 10 comments

Comments

@SentinelWarren
Copy link

SentinelWarren commented Jun 7, 2017

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?

@daniyel
Copy link

daniyel commented Jun 22, 2017

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

@SentinelWarren
Copy link
Author

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.

@joonro
Copy link
Owner

joonro commented Jun 26, 2017

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.

@SentinelWarren
Copy link
Author

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

@joonro
Copy link
Owner

joonro commented Jul 1, 2017

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.

@SentinelWarren
Copy link
Author

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

@joonro
Copy link
Owner

joonro commented Jul 2, 2017

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.

@oneone1995
Copy link

oneone1995 commented Aug 16, 2017

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.

@sergeevabc
Copy link

@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

@joonro
Copy link
Owner

joonro commented Nov 20, 2018

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants