Archive

Archive for January, 2008

VBScript function to capitalize a Greek string ignoring punctuation marks

Function Caps(txt)
Dim result
result = ""
Dim i
Dim c
for i = 1 to len(txt)
  c = UCase(mid(txt,i,1))
  select case c
   case "Ά"
    c="Α"
   case "Έ"
    c="Ε"
   case "Ή"
    c="Η"
   case "Ί"
    c="Ι"
   case "Ϊ"
    c="Ι"
   case "Ό"
    c="Ο"
   case "Ύ"
    c="Υ"
   case "Ϋ"
    c="Υ"
   case "Ώ"
    c="Ω"
  end select
  result = result + c
next
Caps=result
End Function

Categories: Posts

VBScript sample to split a string in multiple parts

const s = ",, 200, 300,400 ,500 , 600,,b,"

Dim r
r = split(s,",")
dim i
for i=lbound(r) to ubound(r)
MsgBox(r(i))
next

Categories: Posts

Replace script (in VBScript) for Windows Script Host

You can also find this script at http://tranXform.onestop.net

‘*** Replace_console.vbs (console version)
‘*** (C)opyright George Birbilis (birbilis@kagi.com)
‘*** Use/modify freely as long as you give credit to the original author
‘*** Version: 20060928

if wscript.arguments.count<>3 then
wscript.echo "Syntax: replace.vbs filename fromToken toToken"
wscript.quit
end if

SET fso=CreateObject("Scripting.FileSystemObject")

filename=wscript.arguments(0)
fromToken=wscript.arguments(1)
toToken=wscript.arguments(2)

ON ERROR RESUME NEXT

wscript.echo "Opening "+filename
SET file=fso.OpenTextFile(filename,1)
if err.number>0 then
wscript.echo err.description
wscript.quit
end if
contents=file.ReadAll
contents=replace(contents,fromToken,toToken)
file.close

wscript.echo "Saving "+filename
SET file=fso.OpenTextFile(filename,2)
if err.number>0 then
wscript.echo err.description
wscript.quit
end if
SET contents=file.write(contents)
file.close

SET file=nothing
SET fso=nothing

wscript.echo "Done"
wscript.echo ‘show an empty line

Categories: Posts

Downgrading Vista Ultimate to Vista Premium

  Sometime last year I had a friend with a TURBO-X laptop (from Greek company Plaisio), dated several years ago, that couldn’t get WinXP reinstalled on it (was freezing at a random time during installation, sometimes even at initial stages when formatting the disk etc.).

  I had tried Vista CD (from MSDN Premium package that I received from MS as a gift, being a Microsoft MVP) on it for it’s memory check tool (an alternative is to use UBUNTU or EDUBUNTU [Debian Linux] Live CD that has MemTest86+ memory testing tool) and it worked fine. That thing made me try to install Vista Ultimate on it and again it installed and worked fine (even with Aero effects working, although the laptop didn’t have much memory as it was more expensive at the time it had been purchased).

Since the license for the Vista Ultimate was on me, I made the guy buy a Vista upgrade package for WinXP and then I had to fool Vista Ultimate that it was XP to allow the XP to Vista upgrade DVD to install on it. To do this I turned off the UAC (User Access Control) feature of Vista (you know, the one that prompts you for confirmation all the time – that is cause the shell GUI isn’t running as admin for security reasons – a bit similar practice is followed on Linux btw). To turn UAC off I used the respective Tool from the Tools tab of "System Configuration" application (use Start/Run and type "msconfig" to launch it, or type "System Configuration" at Start/Search on Vista.

Also, I right-clicked the installation executable (I think it was Setup.exe) from the XP to Vista Upgrade DVD and from Properties dialog I went to the "Compatibility" tab and set it to run as if it was "Windows XP". Then launched the installer from inside Vista and all went fine (note that I didn’t use the "Run as administrator" option from the properties window, but preferred to turn-off UAC instead since the Setup.exe would unpack other installers and run them at lower credentials instead making it fail later on during the installation process).

I didn’t need to turn on UAC again, after the "downgrading" it was turned on by itself (obviously by the installer). It’s nice that Vista is still build on XP (or could say NT) foundation and a totally different beast, else I wouldn’t have been able to pull this trick off.

Categories: Posts
Follow

Get every new post delivered to your Inbox.

Join 920 other followers

%d bloggers like this: