Jump to content
Ketarin forum

Prototype Template Problem


Omniferum
 Share

Recommended Posts

Below is my attempt at a prototype template, i've only recently decided to actually try and use them. The only thing though is that if all we are supposed to do is add a Guid="" to the revelant spot then why won't ketarin import the below template when I add the Guid?

 

Without the Guid there this template works perfectly.

 

I'm not sure what i'm missing to make THIS a proper prototype template.

 

Can anyone help?

 

The error I get is "Failed to import the file: Unexpected end of file while parsing CDATA has occured. Line 4, position 30."

 

<?xml version='1.0' encoding='utf-8'?>
<Jobs>
 <ApplicationJob xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" Guid="d50a8125-c88a-4a28-9512-356ec933e423">
   <WebsiteUrl>{page}</WebsiteUrl>
   <UserNotes />
   <IgnoreFileInformation>false</IgnoreFileInformation>
   <DownloadBeta>Default</DownloadBeta>
   <CheckForUpdatesOnly>false</CheckForUpdatesOnly>
   <VariableChangeIndicator>version</VariableChangeIndicator>
   <CanBeShared>true</CanBeShared>
   <ShareApplication>false</ShareApplication>
   <ExclusiveDownload>false</ExclusiveDownload>
   <UserAgent>{sfua}</UserAgent>
   <HttpReferer />
   <Variables>
  <item>
    <key>
	  <string>download</string>
    </key>
    <value>
	  <UrlVariable>
	    <RegexRightToLeft>false</RegexRightToLeft>
	    <VariableType>RegularExpression</VariableType>
	    <Regex>folder.*?([^"']+files[^"']+\.\w\w\w)</Regex>
	    <Url>http://sourceforge.net{refer2}</Url>
	    <Name>download</Name>
	  </UrlVariable>
    </value>
  </item>
  <item>
    <key>
	  <string>name</string>
    </key>
    <value>
	  <UrlVariable>
	    <RegexRightToLeft>false</RegexRightToLeft>
	    <VariableType>RegularExpression</VariableType>
	    <Regex><title>(.*?)[\s-]+</Regex>
	    <Url>{page}</Url>
	    <Name>name</Name>
	  </UrlVariable>
    </value>
  </item>
  <item>
    <key>
	  <string>page</string>
    </key>
    <value>
	  <UrlVariable>
	    <RegexRightToLeft>false</RegexRightToLeft>
	    <VariableType>RegularExpression</VariableType>
	    <Regex> = '(http://s.*?)["']</Regex>
	    <Url><placeholder name="Application URL" /></Url>
	    <Name>page</Name>
	  </UrlVariable>
    </value>
  </item>
  <item>
    <key>
	  <string>refer1</string>
    </key>
    <value>
	  <UrlVariable>
	    <RegexRightToLeft>false</RegexRightToLeft>
	    <VariableType>RegularExpression</VariableType>
	    <Regex>folder.*?([^"']+files[^"']+)</Regex>
	    <Url>{page}\files</Url>
	    <Name>refer1</Name>
	  </UrlVariable>
    </value>
  </item>
  <item>
    <key>
	  <string>refer2</string>
    </key>
    <value>
	  <UrlVariable>
	    <RegexRightToLeft>false</RegexRightToLeft>
	    <VariableType>RegularExpression</VariableType>
	    <Regex>folder.*?([^"']+files[^"']+)</Regex>
	    <Url>http://sourceforge.net{refer1}</Url>
	    <Name>refer2</Name>
	  </UrlVariable>
    </value>
  </item>
  <item>
    <key>
	  <string>version</string>
    </key>
    <value>
	  <UrlVariable>
	    <RegexRightToLeft>false</RegexRightToLeft>
	    <VariableType>RegularExpression</VariableType>
	    <Regex>Last Update.*?>([\d\-]+)</Regex>
	    <Url>{page}</Url>
	    <Name>version</Name>
	  </UrlVariable>
    </value>
  </item>
   </Variables>    <ExecuteCommand>/*This is a comment line, the line below is the C# script. It will run the instructions found in the Setup Tab*/
app.Install(null);</ExecuteCommand>
   <ExecutePreCommand />
   <ExecuteCommandType>CS</ExecuteCommandType>
   <ExecutePreCommandType>Batch</ExecutePreCommandType>
   <SetupInstructions>
  <SetupInstruction xsi:type="CustomSetupInstruction">
    <Code>::Use this if the file you are downloading is a binary that can be unzipped and run
{7z} x "{file}" -o"{temppath}{appname:regexreplace: \(.*\):}" -y
for /f "tokens=2 delims=[]" %a in ('dir /b /s "{temppath}{appname:regexreplace: \(.*\):}\*.exe" ^| find /v /n "" ^| findstr /c:[1]') do set dir=%~dpa*
{copyfolder} "%dir%" "{installpath}{category}\{appname:regexreplace: \(.*\):}\"
rd /s /q "{temppath}{appname:regexreplace: \(.*\):}"</Code>
    <Type>Batch</Type>
  </SetupInstruction>
  <SetupInstruction xsi:type="CustomSetupInstruction">
    <Code>::Use this if the file you are downloading is an executable that can be UniExtracted and run
{ue} "{file}" "{temppath}{appname:regexreplace: \(.*\):}"
for /f "tokens=2 delims=[]" %a in ('dir /b /s "{temppath}{appname:regexreplace: \(.*\):}\*.exe" ^| find /v /n "" ^| findstr /c:[1]') do set dir=%~dpa*
{copyfolder} "%dir%" "{installpath}{category}\{appname:regexreplace: \(.*\):}\"
rd /s /q "{temppath}{appname:regexreplace: \(.*\):}"</Code>
    <Type>Batch</Type>
  </SetupInstruction>
  <SetupInstruction xsi:type="CustomSetupInstruction">
    <Code>::Use this if your file cannot be installed automatically and needs to be run manually after Ketarin finishes
START CMD /C "ECHO Re: {appname} You will have to run this file manually after Ketarin finishes updating && PAUSE"
&</Code>
    <Type>Batch</Type>
  </SetupInstruction>
  <SetupInstruction xsi:type="CustomSetupInstruction">
    <Code>::Use this if your download is a standalone executable which just needs to be copied to the right place
{copyfile} "{file}" "{installpath}{category}\{appname:regexreplace: \(.*\):}\"</Code>
    <Type>Batch</Type>
  </SetupInstruction>
   </SetupInstructions>
   <Category><placeholder name="Category" options="{categories}" /></Category>
   <SourceType>FixedUrl</SourceType>
   <DeletePreviousFile>true</DeletePreviousFile>
   <Enabled>true</Enabled>
   <FileHippoId />
   <TargetPath>{downloadpath}{category}\</TargetPath>
   <FixedDownloadUrl>{download}</FixedDownloadUrl>
   <Name><placeholder name="Name of application" variable="name" /></Name>
 </ApplicationJob>
</Jobs>

Link to comment
Share on other sites

I don't get to the part where I can give input values, it just gives that CDATA error instantly. Dragging and dropping the .xml into the ketarin makes nothing happen. Using the 'import' function from the menu gives me that error I stated in the first post. Copying and pasting the code directly into Ketarin doesn't achieve anything either like it does for other templates.

 

It really is only when that Guid="" is added, otherwise it is fine.

 

But yeah I don't even get to the 'input values' part, it just fails outright. I am obviously using the latest b2

Link to comment
Share on other sites

Is it possible that the Guid you're trying to use already exists in your database? Export all, search for the guid.

 

Alternatively, the only thing I can think of is maybe you've got some other problem with the XML. What editor are you using? Maybe it's performing a lazy encoding in the background, and that's causing the problem. The file I attached which is just a copy & paste of the code you posted above, has an MD5 of "7682ceef 3877bc94 d433e054 8ed68d70". Download and test the attachment, THEN open it up in your editor, save it and test again.

prototype.xml

Link to comment
Share on other sites

I've even tried to import the prototype template from here https://ketarin.org/...__fromsearch__1

 

Same error i'm given if I keep the Guid in. Deleting the <SourceTemplate><![CDATA[]]></SourceTemplate> doesn't affect the ability to import it.

 

I don't see what the problem is. I made a FRESH Ketarin (just unzipped it and created a blank jobs.db file in the same folder) and the template imports perfectly fine into the new/untouched ketarin.

 

Deleting all the apps out of my original Ketarin install lets me import the template perfectly fine.

 

Odd though when I export my old ketarin to an .xml I can't re-import it. Gives me an error code in some line somewhere. A problem more peculiar than I originally thought but why would my other apps have any affect on this bloody thing? Re-importing the global variables/settings is fine, it still lets me import my prototype template. I'm just not sure why it is 'other apps' in my ketarin that is affecting my using any part of prototype templates.

 

Any ideas flo?

 

EDIT:

 

I get different errors on re-importing my entire jobs.xml depending on how I export it. If I do it via cli or the menu option "Export all" it gives me an error on a certain line, if I just highlight them all in ketarin, hit ctrl+c and paste it into a blank XML it gives me a different error from a different line upon importing. My exported stuff contains a lot of that CDATA stuff, is that really necessary or can it be causing any of these difficulties?

Link to comment
Share on other sites

Ok so it is something to do with the soucetemplate tags i've found.

 

If I use notepad++

 

Use extended regex replace \r\n and replace it with zxczxczxc (to make it all one line) and then regex replace <soucetemplate>.*?</sourcetemplate> with nothing, to delete all instances of it, it will re-import my large database back perfectly fine and I can then add prototype templates.

 

The ONLY thing I want to know before I make this my official piece of usage is DOES that sourcetemplate or CDATA stuff have ANYTHING important in them? I don't want to find 'odd problems' down the line because accidentally it turns out they WERE important

Link to comment
Share on other sites

I'm still testing with a blank ketarin (with a jobs.db in the same folder)

 

The trouble is anything I change in the placeholders Ketarin never prompts me to "update" the apps i've added previously. Can someone please point to me or post a FULLY working prototype template that, when you import it, it goes "Would you like to update other apps wiht this Guid?" or whatever the prompt actually is? I've never seen it personally

Link to comment
Share on other sites

Hi, Omni - check out my recent iOS template. It's a pretty simple prototype template and functionally only relies on one input variable. The others are either cosmetic or are behavioral effects like deleting the previous download or the category.

 

Something to understand, however, is that templates based on prototype templates don't ever re-prompt you. Instead, they use the previous input values to replace the functional behaviors, selections and variables with the previous answers you assigned. Those values are (currently) preserved thru any proto-template changes in assignment order. Thus, you'll only see the "update apps" prompt once - and don't have an option to re-assign or fix values.

Link to comment
Share on other sites

  • 4 weeks later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.