Apr 20

A Great Windows Installer – Install Simple

So as we all know you need to deploy your software somehow….
In most cases WinZip self extractor would do but it does not look professional in any way, or for others Microsoft’s Package and Deployment wizard just creates too many file (or you just don’t use visual studio at all…).
So there are many free tools or some that cost an arm and a leg (I personally think that anything over $100 is too high for something that does not generate revenue for me).
So I was looking for a simple application that would package my software and scripts in a nice way and won’t break the bank.

I found a few open source application like NSIS that are either too robust for me with their full blown installer or too simple with their Zip2Exe plug in.

So I found Install Simple – Linky via Google and had a quick run with it.

So the main things I liked on it were
* Simplicity – easy and straight forward
* Similar look to a full installer – the installer looks like it was built with a full blown installer
* Packages – Save your packages
* Registry Control – I code everything “Registry” in my apps but it’s a nice feature
* Ability to change the look of the GUI (not much but enough)
* Uninstall feature

Some Cons
* No options for silent command line execution – I need silent installs
* Can’t change the icon of the package – Not a big one but would be a great feature!
* Can’t Execute files after install is done – Now this one is a must! even with a question during the compiling process and if after a reboot it could be added to the runounce of windows
* “Registry” pull data from the registry and utilize it with the installer

Here is a quick guide on how to use it
1. Run Install Simple
Enter you information – Band Text is in the PRO version
1

Click on read more to follow the guide
Read More »

Posted in Development, General | Tagged , , , | Leave a comment
Apr 08

Off-Topic My First Android Application The Stig Facts

The Stig Facts

This application thought me a lot about android development and this application will be the base for the coming guides that include Android Development, Layout, Some Design (as mine is not amazing), Database! and more

Now back to the application
The Stig is the Chuck Norris of the auto world
Just something about “The Stig”
The Stig is a character in the British motoring television show Top Gear. The character plays on the anonymity of racing drivers’ full-face helmets, with the running joke that nobody knows who, or indeed what, is inside the character’s racing suit.

Link To App On Market – Linky

qrcode

Posted on – Linky

Posted in Android | Tagged , , , | Leave a comment
Feb 11

Changing Computers IP Addresses with VBScript

So now that we changed the machine name and user names we might need to change some IP’s….

As you can see below you will need to specify the IP’s somehow (hard coded right now) with a MSGBOX, Registry read, text file, Machine name etc

'----------------------------------------------------------------------

	const HKLM   = &H80000002
	
	Set WshShell = CreateObject("WScript.Shell")
        Set objFSO = CreateObject("Scripting.FileSystemObject")
	Set oNetwork = CreateObject("WScript.Network")
	
	strCurrentComputerName = oNetwork.ComputerName

	'Setup IP's you want to implament, you can add logic for MSGBOX etc.		
		strComputer = "."
		IPAddress = "10.11.12.13"
		dGateway = "10.11.12.11"
		arrIPAddress = Array(IPAddress)
		arrSubnetMask = Array("255.255.255.128")
		arrGateway = Array(dGateway)
		arrDNSServers = Array("12.107.200.146")
		
		Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
		Set colNetAdapters = objWMIService.ExecQuery("Select * from Win32_NetworkAdapterConfiguration where IPEnabled=TRUE")
	
		For Each objNetAdapter in colNetAdapters
		     errEnableStatic = objNetAdapter.EnableStatic(arrIPAddress, arrSubnetMask)
		     errGateways = objNetAdapter.SetGateways(arrGateway)
		     intSetDNSServers = objNetAdapter.SetDNSServerSearchOrder(arrDNSServers)
		Next
	
		If intSetDNSServers = 0 Then
		    MSGBOX("Server IPs set to: IPAddress = " & IPAddress)
		Else
			MSGBOX("Error setting server info.")
	 	End If
Posted in Scripting | Tagged , , , , | 4 Comments
Feb 10

Rename Machine Name with VBS

So… we renamed a user name with VBS here – Linky but now we need to change the machine name.
How simple is that? very

As you can see below specify a machine name under
strNewName = “InRimServer”
So “InRimServer” is the hard coded name of the script but you can change this with a MSGBOX or pull the value from other locations….
And initiate a reboot in the end of the script (or manually afterwards)



'----------------------------------------------------------------------

	const HKLM   = &H80000002
	
	Set WshShell = CreateObject("WScript.Shell")
    Set objFSO = CreateObject("Scripting.FileSystemObject")
	Set oNetwork = CreateObject("WScript.Network")
	
	strCurrentComputerName = oNetwork.ComputerName
 	
 	strNewName = "InRimServer"
 	
	strKeyPath   = "System\CurrentControlSet\Control\ComputerName\ComputerName"
	set objReg = GetObject("winmgmts:\\" & strCurrentComputerName & "\root\default:StdRegProv")
	intRC = objReg.SetStringValue(HKLM, strKeyPath, "ComputerName", strNewName)
	
	if intRC <> 0 Then
		MSGBOX("Error setting ComputerName value: " & intRC)
	Else
		MSGBOX("Successfully set ComputerName value to " & strNewName)
	end if
	
	strKeyPath   = "System\CurrentControlSet\Services\Tcpip\Parameters"
	intRC = objReg.SetStringValue(HKLM, strKeyPath, "NV Hostname", strNewName)
	if intRC <> 0 Then
		MsgBox("Error setting NV Hostname value: " & intRC)
	Else
		MsgBox("Successfully set NV Hostname value to " & strNewName)
	end if
 	
 	'Remove the comments if you want an auto reboot
' 	MsgBox("Rebooting system...")
' 	WScript.Echo "Rebooting system..."
'	Set OpSysSet = GetObject("winmgmts:{impersonationLevel=impersonate,(Shutdown)}//" & strComputer).ExecQuery("select * from Win32_OperatingSystem where Primary=true")
'    for each OpSys in OpSysSet
'        OpSys.Reboot()
'    Next    

Posted in Scripting | Tagged , | 1 Comment
Feb 01

Rename Users with VBScript

This question came through the red phone line (well email)…. (and there were two questions but I’ll save the other for a different post….)
And it’s quite simple but we are going to cheat here and use a net user command.

So we need to determine a few things well just one thing, Is the user name constant name or does it change?

So this is how my script would look like
I’m going to look at this as if the user is a constant user (name does not change)

' Set some objects
    Set WshShell = CreateObject("WScript.Shell")
    Set objFSO = CreateObject("Scripting.FileSystemObject")

    Set objWMIService = GetObject("winmgmts:\\.\root\cimv2")

'get our constant user name from the system (change the UserNameHere)
Set colItems = objWMIService.ExecQuery ("Select * from Win32_UserAccount Where Name = 'UserNameHere'")	
	For Each objItem in colItems
	  objItem.Rename "NewUserNameHere"
	next
'change the user name
 WshShell.Run "cmd /c net user UserNameHere /fullname: NewUserNameHere", 1, true 

Kinda simple, but what happens if you don’t know the user name and simply want to change the user name?
I don’t think this is a good idea but lets say we just want to add some characters to the user…

So we are going to add a few lines and change a few lines…

' Set some objects
    Set WshShell = CreateObject("WScript.Shell")
    Set objFSO = CreateObject("Scripting.FileSystemObject")

    Set objWMIService = GetObject("winmgmts:\\.\root\cimv2")
'set and get the current user account
    Set objNetwork = CreateObject("WScript.Network")
    strUserName = objNetwork.UserName

'get our constant user name from the system remember we got the current user before

Set colItems = objWMIService.ExecQuery ("Select * from Win32_UserAccount Where Name = '" & strUserName & "'")	
	For Each objItem in colItems
	  objItem.Rename strUserName & "Tech"
	next
'change the user name
 WshShell.Run "cmd /c net user "& strUserName &" /fullname: """ & strUserName & "Tech""", 1, true 
MsgBox "cmd /c net user "& strUserName &" /fullname: " & strUserName & "Tech"

Don’t forget to add some protection and logging, and if you need to change your auto login etc…
As well you might not need the MsgBox and you will need to reboot.

Posted in Development, Scripting | Tagged , , , | 1 Comment
Jan 17

VBScripts – Generic Templates for download

Hello Readers,

I’ve added a download section where I will provide templates for Generic Scripts that you can modify and use.
No Credit needed simply enjoy.
Hit the Download section on the top.

Have fun with this one 🙂

Set wshShell = wscript.CreateObject("WScript.Shell")
do
wscript.sleep 100
CreateObject("SAPI.SpVoice").Speak "You don't need to see my identification... Join the Droid... " 
Loop
Posted in Scripting | Tagged , , , | Leave a comment
Jan 10

Android Development – how to start? Start Here now

Android Dev

So i’m going to share the next two three months of my journey….
Currently I work as a Project Manager for a software company and from time to time I do some development for my customers (Automation Scripts, Visual Basic and C#) but I really like it for fun…
Now what would be more fun than making a few $$$ (or as some would say “Coin” here in our southern area)

So? what am I talking about and what am I going to share and show? and why did I pick android and not iOS or WP7 or BlackBerry (note I didn’t note WebOS well maybe I did… you got me now.)
I’m going to start with Why Android:
1. Y’all have a computer so the cost to start developing is cheap (don’t have to buy a mac or anything of sort)
2. Android based phones are cheap if you want a REAL phone to play around with and I already have three (Samsung Captivate, HTC Aria and a Dell Streak on the way)
3. Android Market only costs $25
4. I like Android (although I was an iPhone user and still have an iPad…. simply get more done with an android phone)

So as i’ve covered the why android let’s move on to what i’m going to share:
1. I’m going to share most of my ideas but will start with two small App/Util (you will know soon)
2. I will share all the revenue coming from the applications and the website (AdSense etc), not trying rub it in if I do end up making some coin just trying to give you and idea of your ROI (as you time is money)
3. How I started and tips and tricks along the way (and BTW i’m really starting now I’ve never done any Java…)
4. Guides for anything I do and some source code that will turn into open source…..

And now the why am I doing this?
1. I don’t know
2. Sounds like fun
3. Hope to get some comments out of people to hear what they think of my journey (not that nasty Dodge… I drive a Merc and not that merc 😉 )
4. Still thinking about it

How’s this going to work?
I opened a new Site www.inrim.net and I will have everything Android over there (so we have a clean start…..)
Every week I will post a few posts (now I sound like…. just repeating my self) about guides where to start costs etc.

It’s going to be fun so join me there

Posted in Android, My Sites | Tagged , , , | Leave a comment
Jan 10

To DIM or not to DIM that is the question, VBScript Variables

So I got an email from someone asking me based on the code snippets I place on my site why don’t I “Option Explicit” and declare my variables….

So what are variables and what do you do with them?
I’m not going to write to much but pull from another location – Source
Do you remember algebra from school? x=5, y=6, z=x+y
Do you remember that a letter (like x) could be used to hold a value (like 5), and that you could use the information above to calculate the value of z to be 11?
These letters are called variables, and variables can be used to hold values (x=5) or expressions (z=x+y).

So now that you know what variables are, let’s talk about variable type’s in VBScript’s and why I don’t use them…

In VBScript, all variables are of type variant, that can store different types of data, unlike other languages like VB that you need to declare the variable type like Integer, Decimal etc
You can declare variables in VBScript by starting you code with

Option Explicit
Dim MySpaceShip
MySpaceShip = "Some Odd Name or Value"

So in VB you would need to declare what your variable would hold something like

Dim MySpaceShip As String ' --> While string can be any value of characters and numbers....
Dim MySpaceShipSpeed As Integer ' --> My Space Ship's speed can only be in number values.....

There are more values but I won’t get into that as I said VBScript variables are always variant’s that can hold any value numeric or alphanumeric.

Some Rules
A variable can have a short name, something like Y would work but you should put some more details, let’s say MySpaceShip.
Rules for VBScript variable names:
They have to begin with a letter!
The varicable cannot contain a period “.”, the value they hold can
Length max is only 255 long

So back to VBScript and DIMing……
Why don’t I? the answer is quite simple, I create all scripts with VBS Edit and I don’t feel the need to declare anything (problems will start if you try to use the same variable twice without doing something with the old value)
So here is a good example of DIMing with and issue

'----------------------------------------------------------------------
' Yeshai Bouskila - Some Script
'----------------------------------------------------------------------    
  	set objShell = CreateObject("Wscript.Shell")
  	set objFSO = CreateObject("Scripting.FileSystemObject")
'----------------------------------------------------------------------
	' Some Variables for Date, Year TOD
	D = Day(Date)
	Y = Year(Date)-2000
	T = Hour(Time) & Minute(Time)
	WScript.Echo(Y)
	WScript.Echo(T)
	
	Y = "Yeshai"
	T = "What???"
	WScript.Echo(Y)
	WScript.Echo(T)

So as you can see above I’ve used my Y and T variable’s twice…. first time they had my Year and Time value and second time they got the values I assigned to them, Yeshai and What???
Here is my quick test output screen

Microsoft (R) Windows Script Host Version 5.6
Copyright (C) Microsoft Corporation 1996-2001. All rights reserved.
11
2255
Yeshai
What???
***** script completed – exit code: 0 *****

Now in a real world you would write it like so:

	Option Explicit
'----------------------------------------------------------------------
' Yeshai Bouskila - Some Script
'----------------------------------------------------------------------    
  	set objShell = CreateObject("Wscript.Shell")
  	set objFSO = CreateObject("Scripting.FileSystemObject")
'----------------------------------------------------------------------
	' Some Variables for Date, Year TOD
	Dim D, Y, T
	D = Day(Date)
	Y = Year(Date)-2000
	T = Hour(Time) & Minute(Time)
	WScript.Echo(Y)
	WScript.Echo(T)
	
	Dim Y,T
	Y = "Yeshai"
	T = "What???"
	WScript.Echo(Y)
	WScript.Echo(T)

And the error would be “Testing.vbs(19, 6) Microsoft VBScript compilation error: Name redefined” (From my output box of VBS Edit) but you would get the same error if you run the file.

So bottom line here do what ever you want to do, one persons best practice is not always the right way, an you don’t have to listen to me as i’m not a real developer but do this both for fun and work….

Posted in Visual Basic | Tagged , , , , , | 1 Comment
Dec 30

Get Directory Path of an executing Batch file

Might not be needed for most of you out there that don’t use Batch files but what the heck.

So I was writing this simple app that will capture all my DLL and EXE files into a batch files to register and unregister them…. Please don’t ask me why (You can ask the QA team).

And one issue I found that if you run the batch file from a different folder was that is will execute the content of the batch file on the current working folder E.g batch file runs from C:\SomeFolder\ but you are in  C:\SomeOtherFolder\

So a simple addition at the beging of the batch file will return move to the correct folder.
Simply add “cd /d %~dp0” to the batch file and the execution will run on the folder.

Found this online (Some say he is wanted by the CIA, and that if he could be bothered, he could crack the Da Vinci code in 43 seconds. All we know is, he’s called The Stig. I don’t have The Stig’s number so I use Google).
Source – Linky

Posted in Development, From Other Sites, Scripting | Tagged , , , , | Leave a comment
Dec 26

VBScript – Using SUB’s and not the Sandwich and Functions

So, you have seen how do use some of my ideas (Well not only mine as you can find them across the WWW but this is my Blog so they are mine for this POST….)  and one of them was the WriteToLog Sub So let’s talk about SUB’s and Functions what we can do and use them for.

So what’s the big idea? and whats the difference between a SUB and a Function?
Both the SUB and the Functions are Procedues that can be called within your script and execute some functionality without writing lines of code over and over….
There is one major difference between SUB’s and Functions and it’s that a Function can return a value and a SUB can only run the proceduer.
So just as an example my WriteToLog SUB is called from withing the script’s and writes to a file based on arguments provided like Text, Time, File information ETC.
And as another Example that I will write about in a future date a Function that will return if  “RegistryItemExists” or “FileVersion” you catch my drift here…

A SUB (Again not the one from Subway) is a Subroutine or some might call it a procedure are basically an instance of code that you are going to use multiple times around your script but only right the main portion ounce.

So how do you start?
The Sub will Start with a Sub and a Value as well as some Arguments here is an example of a Copy SUB

Sub xCopyFile(xCopyFrom, xCopyTo)
----> Here goes the code
End Sub

So in this case I will write all my code inside the sub where xCopyFrom, xCopyTo will get values from the execution line in your code
So my execution line could look like

xCopyFile = "C:\Test.txt", "C:\Temp\Test.txt"

In this case
“C:\Test.txt” = “xCopyFrom” argument
“C:\Temp\Test.txt” = “xCopyTo” argument

And my real SUB could do some other things like verify that the destination

Now a Function
So a Function is writen in the same generic way to open and close the function


Function FileVersion(FileName)

-----> Code goes here

End Function

And in this case i’m going to get a file version for components I want to upgrade on the system and do something if needed…..
So the Code behind the function is simple as well (you do need some more code on your script…)


Function FileVersion(FileName)

FileVersion = objFSO.GetFileVersion(FileName)

End Function

So in this case from the script I will call the function in this way
MonitorFolderApp = FileVersion(“C:\MonitorApp\MonitorApp.Exe”)

So
MonitorFolderApp is the variable I want to assign the version to
= FileVersion calls the function
and (“what ever arguments”, “Some More Arguments”)  are the arguments you pass on to the Function

You might say why should I use a function just for one line of code? well you might be correct but here is an example for checking if a registry key exists as a function (I found this online somewhere, I will need to find where so I can give them some credit!)

Function xRegItemEX (xRegKey)
 On Error Resume Next
 
 If (Right(xRegKey, 1) = "\") Then
 objShell.RegRead xRegKey
 Select Case Err
 Case 0:
 xRegItemEX = true
 Case &h80070002:
 ErrDescription = Replace(Err.description, xRegKey, "")
 Err.clear
 objShell.RegRead "HKEY_ERROR\"
 If (ErrDescription <> Replace(Err.description, "HKEY_ERROR\", "")) Then
 xRegItemEX = true
 Else
 xRegItemEX = false
 End If
 Case Else:
 xRegItemEX = false
 End Select
 Else
 objShell.RegRead xRegKey
 
 Select Case Err
 Case 0:
 xRegItemEX = true
 Case Else
 xRegItemEX = false
 End Select
 End If
 On Error Goto 0
End Function
 
Posted in Scripting | Tagged , , , , , , , | Leave a comment