Page 1 of 2 12>
Topic Options
#155897 - 2006-01-25 08:28 AM Translate it to KIX?
kingfisher Offline
Fresh Scripter

Registered: 2005-12-28
Posts: 28
Who can do me a favor to translate the code to KIX?
Code:
 









Any feedback is appreciated.

Top
#155898 - 2006-01-25 09:35 AM Re: Translate it to KIX?
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11629
Loc: CA
sure no problem

Code:
 
 
 
 
 
 
 
 
 


Top
#155899 - 2006-01-25 12:16 PM Re: Translate it to KIX?
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
you must be kidding?
I bet it would be more like this with kix:
Code:

_________________________
!

download KiXnet

Top
#155900 - 2006-01-25 12:19 PM Re: Translate it to KIX?
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11629
Loc: CA
Do I see a new Golf challenge coming on
Top
#155901 - 2006-01-25 12:19 PM Re: Translate it to KIX?
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Only Jooel could have Lonken-golfed that code smaller.
Top
#155902 - 2006-01-25 12:24 PM Re: Translate it to KIX?
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
one could also try this but the functioning is not quaranteed in all cases:

ode:

_________________________
!

download KiXnet

Top
#155903 - 2006-01-25 12:29 PM Re: Translate it to KIX?
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11629
Loc: CA
I sort of like this version myself, but difficult to use and not very portable

 
 

Top
#155904 - 2006-01-25 12:36 PM Re: Translate it to KIX?
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
indeed.

ps. shortened that one from the end and right a little.
_________________________
!

download KiXnet

Top
#155905 - 2006-01-25 12:49 PM Re: Translate it to KIX?
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11629
Loc: CA
Indeed... I see where you're going. This is almost like PHP Golfing



Top
#155906 - 2006-01-25 12:51 PM Re: Translate it to KIX?
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11629
Loc: CA
Okay, just joking KingFisher.

Please preview your code in the future to make sure you posted what you think you did.

I assume you want to convert some VBScript to KiXtart which is often very easy to do. There are some items that KiXtart doesn't support but not much.

Please post the real code and we'll have a look at it.
 

Top
#155907 - 2006-01-26 04:37 AM Re: Translate it to KIX?
kingfisher Offline
Fresh Scripter

Registered: 2005-12-28
Posts: 28
I am so, so sorry!
I have a additional problem why I can not paste codes directly from Notepad.exe?
*************






***************

Top
#155908 - 2006-01-26 06:09 AM Re: Translate it to KIX?
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11629
Loc: CA
Try clearing your cache, try a different browser.

Try running this script on your system but MAKE SURE you have KiXtart 4.52 Beta 2 as it WILL NOT work correctly with any earlier version.

WARNING If you do run this script it will remove all Internet Explorer cache,cookies, history for every profile on the system as well as Java cached files and all %temp% files.
 
 
Code:

Break On
Dim $SO
$SO=SetOption('Explicit','On')
$SO=SetOption('NoVarsInStrings','On')
$SO=SetOption('NoMacrosInStrings','On')
 
ClearTemporary()
 
Function ClearTemporary()
Dim $ProL,$PL,$Tmp,$DV
$ProL = ExpandEnvironmentVars(ReadValue('HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList','ProfilesDirectory'))
$PL = Dir($ProL)
$DV = DelKey('HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\UserAssist\{5E6AB780-7743-11CF-A12B-00AA004AE837}\Count')
$DV = DelKey('HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\UserAssist\{75048700-EF1F-11D0-9888-006097DEACF9}\Count')
While $PL <>''
If $PL
If Not InStr($PL,'.') And Not InStr($PL,'..')
If Exist($ProL+'\'+$PL+'\Local Settings\Temporary Internet Files\Content.IE5\index.dat')
RD $ProL+'\'+$PL+'\Local Settings\Temporary Internet Files\Content.IE5\' /S
If @ERROR DEL $ProL+'\'+$PL+'\Local Settings\Temporary Internet Files\Content.IE5\index.dat' /P EndIf
MD $ProL+'\'+$PL+'\Local Settings\Temporary Internet Files\Content.IE5'
EndIf
If Exist($ProL+'\'+$PL+'\Cookies\index.dat')
RD $ProL+'\'+$PL+'\Cookies\' /S
If @ERROR DEL $ProL+'\'+$PL+'\Cookies\index.dat' /P EndIf
MD $ProL+'\'+$PL+'\Cookies\'
EndIf
If Exist($ProL+'\'+$PL+'\Local Settings\History\History.IE5\index.dat')
RD $ProL+'\'+$PL+'\Local Settings\History\History.IE5\' /S
If @ERROR DEL $ProL+'\'+$PL+'\Local Settings\History\History.IE5\index.dat' /P EndIf
MD $ProL+'\'+$PL+'\Local Settings\History\History.IE5\'
EndIf
If Exist($ProL+'\'+$PL+'\Local Settings\Temp')
RD $ProL+'\'+$PL+'\Local Settings\TEMP\' /S
MD $ProL+'\'+$PL+'\Local Settings\TEMP'
EndIf
If Exist($ProL+'\'+$PL+'\Application Data\Sun\Java\Deployment\cache\')
RD $ProL+'\'+$PL+'\Application Data\Sun\Java\Deployment\cache\' /S
MD $ProL+'\'+$PL+'\Application Data\Sun\Java\Deployment\cache'
EndIf
If Exist($ProL+'\'+$PL+'\.jpi_cache\')
RD $ProL+'\'+$PL+'\.jpi_cache\' /S
MD $ProL+'\'+$PL+'\.jpi_cache'
EndIf
EndIf
EndIf
$PL = Dir()
Loop
If Exist('%windir%\system32\config\systemprofile\Local Settings\Temporary Internet Files\Content.IE5\index.dat')
RD '%windir%\system32\config\systemprofile\Local Settings\Temporary Internet Files\Content.IE5\' /S
If @ERROR DEL '%windir%\system32\config\systemprofile\Local Settings\Temporary Internet Files\Content.IE5\index.dat' /P EndIf
MD '%windir%\system32\config\systemprofile\Local Settings\Temporary Internet Files\Content.IE5\'
EndIf
If Exist('%windir%\system\config\systemprofile\Local Settings\Temporary Internet Files\Content.IE5\index.dat')
RD '%windir%\system\config\systemprofile\Local Settings\Temporary Internet Files\Content.IE5\' /S
If @ERROR DEL '%windir%\system\config\systemprofile\Local Settings\Temporary Internet Files\Content.IE5\index.dat' /P EndIf
MD '%windir%\system\config\systemprofile\Local Settings\Temporary Internet Files\Content.IE5\'
EndIf
If Exist('%windir%\Application Data\Sun\Java\Deployment\cache\')
RD '%windir%\Application Data\Sun\Java\Deployment\cache\' /S
MD '%windir%\Application Data\Sun\Java\Deployment\cache'
EndIf
If Exist('%windir%\Temporary Internet Files\Content.IE5\index.dat')
If @INWIN=2
Dim $RC
RD '%windir%\Temporary Internet Files\Content.IE5\' /S
$RC=WriteProfileString ('%windir%\Wininit.ini','rename','NUL','%windir%'+'\TEMPOR~1\CONTENT.IE5\INDEX.DAT')
Else
RD '%windir%\Temporary Internet Files\Content.IE5\' /S
If @ERROR DEL '%windir%\Temporary Internet Files\Content.IE5\index.dat' /P EndIf
MD '%windir%\Temporary Internet Files\Content.IE5'
EndIf
EndIf
$Tmp = '%temp%'
If Exist($Tmp)
If Len($Tmp) >4
RD $Tmp+'\' /s
MD $Tmp
EndIf
EndIf
Exit @ERROR
EndFunction



Top
#155909 - 2006-01-26 09:39 AM Re: Translate it to KIX?
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
Quote:

why I can not paste codes directly from Notepad.exe




That is a strange one. Language / character set perhaps?

Top
#155910 - 2006-01-26 11:09 AM Re: Translate it to KIX?
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
hmm...
the inputbox is a standard html stuff, so he wouldn't be able to copy&paste anything anywhere in his system if he can't paste here.
_________________________
!

download KiXnet

Top
#155911 - 2006-01-26 12:24 PM Re: Translate it to KIX?
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
I would have thought so too, but I assume that the stuff does paste ok, otherwise he would see it missing from the input box before submitting the post. Interesting that the end of line characters seem to be there. I wonder if changing to "using UBBCode/HTML" or "without UBBCode/HTML" might help.
Top
#155912 - 2006-01-26 01:13 PM Re: Translate it to KIX?
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4673
Loc: The Netherlands
Looking at the source code of the page I see this. Looks like this is the code that kingfisher wanted to post. It's a JavaScript. The board sees it as a script it should run so it is not shown.

Is this the script you originally wanted to post Kingfisher?

Code:

{
//////////////////////////Main Program
var WshShell = WScript.CreateObject("WScript.Shell");

///////////OS Info
var envSystem = WshShell.Environment("SYSTEM");
var OS = "98";
OS = envSystem("OS");

/////////////Batch File Path
var batchPath = "\\\\godetia\\inventory\\test\\alloy.bat";

////////////////////////StartTimer
jTimer();

function jTimer()
{
WshShell.Popup("Timer Started", 2, "Timer Status"); //for Testing
var i, nowDate, runningHour, runningMinute, timeResult;
i = true;
while (i)
{
nowDate = new Date();
runningSecond = 01;
runningMinute = 01;
runningHour = 12;
timeResult = nowDate.getHours() - runningHour;
// timeResult = nowDate.getMinutes() - runningMinute;
// timeResult = nowDate.getSeconds() - runningSecond;
if (timeResult == 0 && nowDate.getMinutes() == runningMinute )
{
var strThisTime = "Now is " + nowDate.getHours() + ":" + nowDate.getMinutes();
if (OS == "")
{
OS = "Windows 95/98"
WshShell.Popup("OS is : " + OS + "\n" + strThisTime, 2); //for testing
WshShell.Run("cmd /C start " + batchPath, "3", true);
}
else
{
WshShell.Popup("OS is : " + OS + "\n" + strThisTime, 2); //for testing
WshShell.Run("cmd /C start " + batchPath, "3", true);
}
}
///////////running interval
WScript.Sleep(59000);
}
WshShell.Popup("Timer Stop", 2, "Timer Status"); //for Testing
}
}
catch (e)
{
var test = e;
}



Edited by Mart (2006-01-26 01:15 PM)
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#155913 - 2006-01-26 08:12 PM Re: Translate it to KIX?
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11629
Loc: CA
Yep, that's his code, but you left out a little bit (so you could post I suppose)


<package>
<job id="wmi_01">
<script language="JScript">

try
{
//////////////////////////Main Program
var WshShell = WScript.CreateObject("WScript.Shell");

///////////OS Info
var envSystem = WshShell.Environment("SYSTEM");
var OS = "98";
OS = envSystem("OS");

/////////////Batch File Path
var batchPath = "\\\\godetia\\inventory\\test\\alloy.bat";

////////////////////////StartTimer
jTimer();

function jTimer()
{
WshShell.Popup("Timer Started", 2, "Timer Status"); //for Testing
var i, nowDate, runningHour, runningMinute, timeResult;
i = true;
while (i)
{
nowDate = new Date();
runningSecond = 01;
runningMinute = 01;
runningHour = 12;
timeResult = nowDate.getHours() - runningHour;
// timeResult = nowDate.getMinutes() - runningMinute;
// timeResult = nowDate.getSeconds() - runningSecond;
if (timeResult == 0 && nowDate.getMinutes() == runningMinute )
{
var strThisTime = "Now is " + nowDate.getHours() + ":" + nowDate.getMinutes();
if (OS == "")
{
OS = "Windows 95/98"
WshShell.Popup("OS is : " + OS + "\n" + strThisTime, 2); //for testing
WshShell.Run("cmd /C start " + batchPath, "3", true);
}
else
{
WshShell.Popup("OS is : " + OS + "\n" + strThisTime, 2); //for testing
WshShell.Run("cmd /C start " + batchPath, "3", true);
}
}
///////////running interval
WScript.Sleep(59000);
}
WshShell.Popup("Timer Stop", 2, "Timer Status"); //for Testing
}
}
catch (e)
{
var test = e;
}

</script>
</job>

</package>

Top
#155914 - 2006-01-26 09:40 PM Re: Translate it to KIX?
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4673
Loc: The Netherlands
Quote:


Yep, that's his code, but you left out a little bit (so you could post I suppose)
....





Yep.
Got no postprep so all stuff in between the less then and greater then brackets get executed as part of the pages code and therefore does not show. Don’t know where the package and job stuff is for but i guess it's from some kind of app that somehow requires it. Afaics it’s not needed for the translation but what do I know, I’m blind and unknowing in the JavaScript world
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#155915 - 2006-01-27 01:40 AM Re: Translate it to KIX?
kingfisher Offline
Fresh Scripter

Registered: 2005-12-28
Posts: 28
Thank you all, your discuss makes me clearly, and your spirit is admired.
Yes, it's my codes, please give me some suggestion.

Top
#155916 - 2006-01-27 09:37 AM Re: Translate it to KIX?
kingfisher Offline
Fresh Scripter

Registered: 2005-12-28
Posts: 28
The codes is a timer, when users logon, the script stays at background,once time came out, it launchs a batch file. How to write a such timer with Kix and users can not see the console window?

Any idea?

Top
Page 1 of 2 12>


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 1376 anonymous users online.
Newest Members
batdk82, StuTheCoder, M_Moore, BeeEm, min_seow
17885 Registered Users

Generated in 0.077 seconds in which 0.03 seconds were spent on a total of 13 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org