Open file dialog exe for vbScript
So I created this exe which will take some information as command line parameter and writes the file name to iostream. This information can be now read using the script and be used.
Example for Open File
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
Dim objWshShell, objExec
Dim strExecCmd
Dim tmp
strExecCmd = """" & strScriptPath & "OpnFile.exe"""
strExecCmd = strExecCmd & " ""1""""Hex File (*.hex)""""*.hex""""Hex""""Open Hex File"""
Set objWshShell = CreateObject("WScript.Shell")
Set objExec = objWshShell.Exec(strExecCmd)
Do While objExec.Status = 0
WScript.Sleep 100
Loop
If objExec.ExitCode = 0 Then
tmp = Split(objExec.StdOut.ReadLine(), "~")
strHexFile = tmp(0)
MsgBox "Save file " & strHexFile
Else
WScript.Quit
End If
Example for Save File
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
Dim objWshShell, objExec
Dim strExecCmd
Dim tmp
strExecCmd = """" & strScriptPath & "OpnFile.exe"""
strExecCmd = strExecCmd & " ""0""""Hex File (*.hex)""""*.hex""""Hex""""Save Hex File"""
Set objWshShell = CreateObject("WScript.Shell")
Set objExec = objWshShell.Exec(strExecCmd)
Do While objExec.Status = 0
WScript.Sleep 100
Loop
If objExec.ExitCode = 0 Then
tmp = Split(objExec.StdOut.ReadLine(), "~")
strHexFile = tmp(0)
MsgBox "Save file " & strHexFile
Else
WScript.Quit
End If
Screenshots
You can download the example scripts here. I have also published a post about another script which uses this technique.
vbscript for detecting usb serial com port number (can be used with avrdude for programming avr)
PnP device information for the FTDI chip in my development board
Class GUID: {4D36E978-E325-11CE-BFC1-08002BE10318}
Description: USB Serial Port
Device ID: FTDIBUS\VID_0403+PID_6001+A700DZAFA\0000
Manufacturer: FTDI
Name: USB Serial Port (COM4)
PNP Device ID: FTDIBUS\VID_0403+PID_6001+A700DZAFA\0000
Service: FTSER2K
Same name string is also showed as the name of the device if we open the windows device manager.
The script I have listed below will use the Name string to find the com port and then uses it.
' +----------------------------------------------------------------------------+
' | Arun |
' | frmkla@gmail.com |
' | http://collectns.blogspot.com |
' |----------------------------------------------------------------------------|
' | Copyright (c) 1998-2011 Arun. All rights reserved. |
' +----------------------------------------------------------------------------+
Option Explicit
Const BAUDRATE = "19200" 'Set "" if baud rate setting is not necessary
Const AVR_PARTNO = "m32"
Dim strPortName' As String
Dim objArgs
Dim strHexFile
Dim strScriptPath
strScriptPath = Replace(WScript.ScriptFullName, WScript.ScriptName, "")
Set objArgs = WScript.Arguments
strPortName = GetComPort
If strPortName = "" Then
MsgBox "Cannot find the USB COM Port" & vbCrLf & "Please verify the USB conncetion"
Else
If objArgs.Count <> 1 Then
'MsgBox "Usage " & WScript.ScriptName &" <Hex File>"
Dim objWshShell, objExec
Dim strExecCmd
Dim tmp
strExecCmd = """" & strScriptPath & "OpnFile.exe"""
strExecCmd = strExecCmd & " ""1""""Hex File (*.hex)""""*.hex""""Hex""""Open Hex File"""
Set objWshShell = CreateObject("WScript.Shell")
Set objExec = objWshShell.Exec(strExecCmd)
Do While objExec.Status = 0
WScript.Sleep 100
Loop
If objExec.ExitCode = 0 Then
tmp = Split(objExec.StdOut.ReadLine(), "~")
strHexFile = tmp(0)
Else
WScript.Quit
End If
Else
strHexFile = objArgs.Item(0)
End If
Dim oShell
Dim strRunCMD
'Generate command string
strRunCMD = """" & strScriptPath & "avrdude"" "
strRunCMD = strRunCMD & "-C " & """" & strScriptPath & "avrdude.conf"" "
strRunCMD = strRunCMD & "-p" & AVR_PARTNO & " -cstk500v1 -P\\.\" & strPortName
If (BAUDRATE <> "") Then strRunCMD = strRunCMD & " -b" & BAUDRATE
strRunCMD = strRunCMD & " -D -Uflash:w:""" & strHexFile & """:i"
'Execute the upload command
Set oShell = WScript.CreateObject ("WScript.Shell")
oShell.run strRunCMD
'Wscript.Echo strRunCMD
Set oShell = Nothing
End If
'
Function GetComPort()
Dim strComputer
Dim objWMIService
Dim colItems
Dim objItem
Dim objRgx 'As RegExp
Dim objRegMatches 'As MatchCollection
Dim strDevName
GetComPort = ""
strComputer = "."
Set objWMIService = GetObject( _
"winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery _
("Select * from Win32_PnPEntity")
For Each objItem In colItems
If ("FTSER2K" = objItem.Service) And ("FTDI" = objItem.Manufacturer) Then
set objRgx = CreateObject("vbScript.RegExp")
strDevName = objItem.Name
objRgx.Pattern = "COM[0-9]+"
Set objRegMatches = objRgx.Execute(strDevName)
If objRegMatches.Count = 1 Then
GetComPort = objRegMatches.Item(0).Value
Else
End If
End If
Next
End Function
Click here to download a copy of the script with avrdude and other support files.
Center Justification for C - printf
1
2
3
4
5
6
7
8
9
10
void f(char *s)
{
printf("---%*s%*s---\n",10+strlen(s)/2,s,10-strlen(s)/2,"");
}
int main(int argc, char **argv)
{
f("uno");
f("quattro");
return 0;
}
Portable WinAVR - Compile AVR code on PC where WinAVR is not installed
from chip45
You can try WinAVRTM out with Portable WinAVRTM, a version that doesn't require an install. And when you get hooked on WinAVRTM, you can put Portable WinAVRTM on a USB key and take it everywhere with you! School, work, the library, the dentist, and more!
Button Magnet search in Chennai, India
The toy shop from which I bought the magnet
Beyond Compare Portable Version
Beyond Compare and options
Beyond compare is one of my favourate diff tool. It has lot of options like
these are a few features out of hundreds..
Recently I was trying to get a portable version of beyond compare from internet. But later I relaised that the installer itself provides an option for portable installation. Even the lisence will be available in the portable copy.
Here I have uploaded my copy of Beyond Compare Portable installation.Beyond Compare Portable Install
Portable C/C++ Compiler with portable msys
It will be handy to have a C compiler which is ready to be used without installing.Mingw is the windows version of the open source gcc compiler suite. It can be used to compile both C and C++. It is possible to use the Mingw from one pc to another by copying the C:\Mingw folder, but there is some problem regarding the folder path settings and update functionality.
Portable mingw from portableapps.com is a portable version of mingw compiler which contains batch scripts to invoke the commandline with the environment variables set and also has an update batch script. Previous versions of this package even has the msys environment.
Here I have uploaded my copy of Mingw Portable installation. In which the larger file is an older version, but contains msys.
Guruvayoor - To see lord guruvayoorappan
C Code to find endianness (little endian or big endian)
Example Code
1
2
3
4
5
6
7
8
9
10
#include <stdio.h>
int main()
{
unsigned short int Var1 = 0xAA55;
unsigned char *p = (unsigned char *)&Var1;
printf("Lower byte = 0x%02X\n", *p);
printf("Higher byte = 0x%02X\n", *(p+1));
}
Memory map in case of Little Endian Architecture
OutputMemory map in case of Big Endian Architecture
Pasted below is the output of the program compiled and executed on my netbook running on Intel atom processor.
G:\Working\c_programs>gcc EndiannessCheck.c
G:\Working\c_programs>a.exe
Lower byte = 0x55
Higher byte = 0xAA
G:\Working\c_programs>
Here you can see that first byte printed using the pointer p is 0x55 and second byte is 0xAA. Since lower byte lies in the lower address it is Little endian architecture.
Ameya-yokocho Market (Ameyoko), Ueno-Okachimachi, Tokyo, Japan
These are some pictures which I took during my visit to this market on 10th October 2010.
Ameya Yokocho or briefly known as Ameyoko is a bustle market street paralleling Yamanote Line tracks between Okachimachi and Ueno Station. Shops, restaurants, outdoor food stalls or what the local called as 'Yatai' are practically operating from sunrise till dark takes over under a stretch of concrete train tracks.
This is one of the best Asian Bazaars, here you will find a little bit of everything, and much of it at bargain basement prices, once a black market, it has become one of Tokyo’s most vibrant places with a huge array of food, clothing, jewellery, toys and cosmetics. you can buy anything from the latest pair of jeans to seaweed or pickled octopus tentacles.
Ameyoko is a busy market street along the Yamanote line tracks between Okachimachi and Ueno Station, the site of a black market after World War Two.
Ameyoko, located in the area between Ueno and Okachimachi, is a busy bazaar-style market. It has hundreds of stalls for about 400 meters alongside and under the elevated track that runs between JR Okachimachi Station and JR Ueno Station. Ameyoko is famous for its unique atmosphere - jam packed stores, buyers bargaining and negotiating with the sellers, and vendors out-shouting each other at the top of their lungs to attract buyers.
Okachimachi is the biggest and most famous permanent open-air market in Tokyo(pics). From Louis Vuitton bags and Gucci belts to Yakitori meals on the street, anything can be found.
Some videos found on youtube and other sites
Ameyoko Market in Tokyo
Ameyoko Market
Ameya Yokocho: An Amazing Shopping District in Tokyo!
JAPAN TRIP - Let's walk Tokyo, Ameya Yokocho of Ueno together
Tokyo Ameyoko Ueno Best Market in Town
Repartioning dell Notebook hard disk
Note: If you are following these steps, then take a backup of your data before proceeding. And do at your own risk.
Screenshotes
Creating Gparted USB Using Unetbootin
Following screenshots are taken with Gparted live boot CD running from a Qemu virtual machine.
Gparted live CD - Boot Screen
Gparted live cd - Desktop
Gpared - Resize ntfs os partition
Gparted - Create new Exetented partion
Gparted - Creating logical partitions
Gparted - After creating the partitions, Click Apply
Gparted - Writing changes to the disk
Tarakeshwar temple, Yerwada, Pune
Some pictures of the temple
Temple gate near main road
Path to the temple
Temple entrance
Tarakeshwar Temple
Recovering data from hard disk with corrupted partition table
dd if=(fd0)/grldr.mbr of=(hd0) => Wrong method
Instead of doing the steps dd if=(fd0)/grldr.mbr of=(sd0) bs=440 count=1
dd if=(fd0)/grldr.mbr of=(sd0) skip=1 seek=1
Partition Layout - Before writing mbr wrongly
Partition Layout - After writing mbr wrongly