Commits

rcmarvin committed 30ab0d6

Update instruction to utilize the Firefox save feature

Comments (0)

Files changed (4)

A_exportData.bat

-@echo off
-cd /d "%~dp0"
-
-set novacom=
-set sqlite=
-set palmdb=
-
-if exist "C:\Program Files\Palm, Inc\novacom.exe" set novacom=C:\Program Files\Palm, Inc\novacom.exe
-if exist "C:\Program Files(x86)\Palm, Inc\novacom.exe" set novacom=C:\Program Files(x86)\Palm, Inc\novacom.exe
-
-if "%novacom%"=="" call "%~dp0lib\error.bat" [ERROR] novacom not found!
-if not "%novacom%"=="" echo [INFO] novacom found = %novacom%
-
-if exist lib\sqlite3.exe set sqlite=%~dp0lib\sqlite3.exe
-if "%sqlite%"=="" call "%~dp0lib\error.bat" [ERROR] sqlite3 not found!
-if not "%sqlite%"=="" echo [INFO] sqlite3 found
-
-if exist PalmDatabase.db3 set palmdb=%~dp0PalmDatabase.db3
-if "%palmdb%"=="" call "%~dp0lib\error.bat" [ERROR] PalmDatabase.db3 not found!
-if not "%palmdb%"=="" echo [INFO] PalmDatabase.db3 found
-
-if "%sqlite%"=="" goto exit
-if "%novacom%"=="" goto exit
-if "%palmdb%"=="" goto exit
-
-:export_db3
-rem type "%~dp0lib\export_co.sql" | "%sqlite%" "%palmdb%" > ct_old.json.js
-type "%~dp0lib\export_m_db3.sql" | "%sqlite%" "%palmdb%" > message.json.js
-goto done
-
-:export_db8
-"%novacom%" -w put file://media/internal/export_db8.sh < "%~dp0lib\export_db8.sh"
-if errorlevel 1 call "%~dp0lib\error.bat" [ERROR] Error transferring export shell script to WebOS device
-if errorlevel 1 goto exit
-"%novacom%" -w run "file://bin/sh /media/internal/export_db8.sh"
-if errorlevel 1 call "%~dp0lib\error.bat" [ERROR] Error occurred when request to run export script
-if errorlevel 1 goto exit
-"%novacom%" -w get file://media/internal/persons.json.js > "%~dp0persons.json.js"
-if errorlevel 1 call "%~dp0lib\error.bat" [ERROR] Cannot retrieve persons.json.js
-"%novacom%" -w get file://media/internal/ct_current.json.js.1 > "%~dp0ct_current.json.js"
-if errorlevel 1 call "%~dp0lib\error.bat" [ERROR] Cannot retrieve ct_current.json.js
-
-
-:done
-echo Process completed successfully.
-
-:exit
-pause
+@echo off
+cd /d "%~dp0"
+
+set novacom=
+set sqlite=
+set palmdb=
+
+if exist "C:\Program Files\Palm, Inc\novacom.exe" set novacom=C:\Program Files\Palm, Inc\novacom.exe
+if exist "C:\Program Files(x86)\Palm, Inc\novacom.exe" set novacom=C:\Program Files(x86)\Palm, Inc\novacom.exe
+
+if "%novacom%"=="" call "%~dp0lib\error.bat" [ERROR] novacom not found!
+if not "%novacom%"=="" echo [INFO] novacom found = %novacom%
+
+if exist lib\sqlite3.exe set sqlite=%~dp0lib\sqlite3.exe
+if "%sqlite%"=="" call "%~dp0lib\error.bat" [ERROR] sqlite3 not found!
+if not "%sqlite%"=="" echo [INFO] sqlite3 found
+
+if exist PalmDatabase.db3 set palmdb=%~dp0PalmDatabase.db3
+if "%palmdb%"=="" call "%~dp0lib\error.bat" [ERROR] PalmDatabase.db3 not found!
+if not "%palmdb%"=="" echo [INFO] PalmDatabase.db3 found
+
+if "%sqlite%"=="" goto exit
+if "%novacom%"=="" goto exit
+if "%palmdb%"=="" goto exit
+
+:export_db3
+rem type "%~dp0lib\export_co.sql" | "%sqlite%" "%palmdb%" > ct_old.json.js
+type "%~dp0lib\export_m_db3.sql" | "%sqlite%" "%palmdb%" > message.json.js
+goto done
+
+:export_db8
+"%novacom%" -w put file://media/internal/export_db8.sh < "%~dp0lib\export_db8.sh"
+if errorlevel 1 call "%~dp0lib\error.bat" [ERROR] Error transferring export shell script to WebOS device
+if errorlevel 1 goto exit
+"%novacom%" -w run "file://bin/sh /media/internal/export_db8.sh"
+if errorlevel 1 call "%~dp0lib\error.bat" [ERROR] Error occurred when request to run export script
+if errorlevel 1 goto exit
+"%novacom%" -w get file://media/internal/persons.json.js > "%~dp0persons.json.js"
+if errorlevel 1 call "%~dp0lib\error.bat" [ERROR] Cannot retrieve persons.json.js
+"%novacom%" -w get file://media/internal/ct_current.json.js.1 > "%~dp0ct_current.json.js"
+if errorlevel 1 call "%~dp0lib\error.bat" [ERROR] Cannot retrieve ct_current.json.js
+
+
+:done
+echo Process completed successfully.
+
+:exit
+pause
 	else
 	{
 		var writeFile=function writeFile(url,data){
-					// Reference: https://developer.mozilla.org/en/Code_snippets/File_I%2F%2FO
-					// and also TiddlyWiki
+					/* Reference:
+							https://developer.mozilla.org/en/Code_snippets/File_I%2F%2FO
+							http://www.mozilla.org/projects/security/components/jssec.html
+							and also TiddlyWiki
+					*/
 					try {
 						netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
 						var iOService = Components.classes["@mozilla.org/network/io-service;1"]
 			sms.GenerateMessageScript(function(content){
 				var result=writeFile(document.location.href.toString().replace(/json\.html/,'ins.sh'),content);
 				if (!result)
-					document.getElementById('stepBContent').value=content+"\n";
+				{
+					document.getElementById('importScript').value=content+"\n";
+					document.getElementById('importPlanA').style.display="none";
+					document.getElementById('importPlanB').style.display="inherit";
+				}
 			});
 		}, false);
 	}
 	// Firefox will remember button "disabled" state when normal reload/refresh is used
-	document.getElementById('refresh').addEventListener('click', function(){return;document.location.href=document.location.href;}, false);
+	document.getElementById('refresh').addEventListener('click', function(){document.location.href=document.location.href;}, false);
 	document.getElementById('step2How').addEventListener('click', function(){var e=document.getElementById('step2');e.style.display=(e.style.display===""?"inherit":"");}, false);
-	document.getElementById('step3bHow').addEventListener('click', function(){var e=document.getElementById('step3b');e.style.display=(e.style.display===""?"inherit":"");}, false);
-	//document.getElementById('step3cHow').addEventListener('click', function(){var e=document.getElementById('step3c');e.style.display=(e.style.display===""?"inherit":"");}, false);
-	//document.getElementById('step4How').addEventListener('click', function(){var e=document.getElementById('step4');e.style.display=(e.style.display===""?"inherit":"");}, false);
+	document.getElementById('step6How').addEventListener('click', function(){var e=document.getElementById('step6');e.style.display=(e.style.display===""?"inherit":"");}, false);
 	log.toggle();
 };
 </script>
 		Step 1: Put PalmDatabase.db3 in the same directory as this file.
 	</div>
 	<div style="padding-top: 1em">
-		Step 2: Run A_exportData.bat
+		Step 2: Run A_exportData.cmd
 		<br />
 		Note for any "<span style="color: red">[ERROR]</span>" when running the script.
 		<br />
 		When no error occurred, message.json.js should be generated.
-		<div style="padding-top: 0.5em">
-			<span id="step2How" class="how" style="cursor: pointer">What happened?</span><div id="step2" class="how hidden">* message.json.js is exported from db3 database, using export_m_db3.sql.</div>
+		<div style="padding: 0.5em 0em 0.5em 0em">
+			<span id="step2How" class="how" style="cursor: pointer">What happened?</span><div id="step2" class="how hidden">* message.json.js is exported based on SMS in db3 database, using export_m_db3.sql.</div>
 		</div>
 	</div>
 
 	<div style="padding-top: 1em">
-		Step 2b: Refresh the page
+		Step 3: Refresh the page to let it load the recently created message.json.js
 		<br />
 		<input id="refresh" type="button" value="Refresh ..." />
 	</div>
 	
+	<div style="padding-top: 1em">
+		<div>Step 4: Click the following button to generate shell script to insert messages to WebOS db8</div>
+		<input id="stepB" type="button" value="Generate!" />
+		<div id="importPlanA" style="padding-left: 3em">
+			The following "Internet Security" window will be prompted:
+			<br />
+			<img src="lib/firefox_warning.png" />
+			<br />
+			when Firefox try to save data to your computer. Click "Allow".
+			<br />
+			A shell script file "ins.sh" should be created
+		</div>
+		<div id="importPlanB" style="display: none">
+			<textarea id="importScript"></textarea>
+			<div>Copy the above script and save it to ins.sh<br />Use <a href="http://notepad-plus-plus.org/">Notepad++</a> or other capable editors to save the script as UNIX format.
+		</div>
+		</div>
+	</div>
+
+	<div style="padding-top: 1em">
+		<div>Step 5: Start WebOS Emulator / (For real device: Turn on developer mode and connect your device to the computer)<br /><span style="font-weight: bold; padding-left: 3em">Turn on "Airplane mode"</span> on the WebOS device</div>
+	</div>
+
 	<hr />
 	<div style="color: red; font-size: 2em;font-weight: bold;">
 		Steps on below will modify WebOS db8 database!
 	</div>	
-	<div style="padding-top: 1em">
-		<div>Step 3a: Click the following button to generate shell script to insert messages to WebOS db8</div>
-		<input id="stepB" type="button" value="Generate!" /><br />
-		<textarea id="stepBContent"></textarea>
-		<div>Copy the above script and save it to ins.sh<br />Use <a href="http://notepad-plus-plus.org/">Notepad++</a> or other capable editors to save the script as UNIX format.
-		</div>
-	</div>
 
 	<div style="padding-top: 1em">
-		<div>Step 3b: Start WebOS Emulator / (For real device: Turn on developer mode and connect your device to the computer)<br /><span style="font-weight: bold">Turn on "Airplane mode"</span> on the WebOS device</div>
-	</div>
-
-	<div style="padding-top: 1em">
-		<div>Step 3c: Transfer to script ins.sh to WebOS device and run it.</div>
-		<div style="padding-top: 0.5em">
-			<span id="step3bHow" class="how" style="cursor: pointer;">Details ...</span><div id="step3b" class="how hidden">* use novacom to transfer ins.sh to WebOS device<br />&nbsp;&nbsp;novacom put file://media/internal/ins.sh &lt; ins.sh<br />* use novacom to open WebOS terminal:<br />&nbsp;&nbsp;novacom -t open tty://<br />* Run the shell script after the terminal is opened ("root@" should be shown)<br />&nbsp;&nbsp;sh /media/internal/ins.sh<br />* Close the terminal<br />&nbsp;&nbsp;exit</div>
+		<div>Step 6: Transfer the file ins.sh to WebOS device and run it.</div>
+		<div style="padding: 0.5em 0em 0.5em 0em">
+			<span id="step6How" class="how" style="cursor: pointer;">Details ...</span><div id="step6" class="how hidden">* use novacom to transfer ins.sh to WebOS device<br />&nbsp;&nbsp;novacom put file://media/internal/ins.sh &lt; ins.sh<br />* use novacom to open WebOS terminal:<br />&nbsp;&nbsp;novacom -t open tty://<br />* Run the shell script after the terminal is opened ("root@" should be shown)<br />&nbsp;&nbsp;sh /media/internal/ins.sh<br />* Close the terminal<br />&nbsp;&nbsp;exit</div>
 		</div>
+		After the script is executed, the WebOS device will continue to process the data.
+		<br />
+		It may take some time before all of the message appeared in the related conversation thread.
+		<br />
+		With my Pre- (@500Mhz stock speed), it can process around 100 messages per minute.
 	</div>
 
 	<div style="height: 1em"></div>
 	<div style="position: fixed; bottom: 0; left: 0; background-color: white; border-top: 1px black solid; width: 100%;font-size: 0.9em">
-		Last updated: 5 June 2011;version 0.4.8
+		Last updated: 6 June 2011;version 0.4.9
 	</div>
 </div>
 </body>
   The MIT License - Copyright (c) 2011 
 */
 
-
+"use strict";
 if (!Array.isArray)
 {
 	Array.isArray = Array.isArray || function(o) { return Object.prototype.toString.call(o) === '[object Array]'; };