Showing posts with label Script. Show all posts
Showing posts with label Script. Show all posts

Friday, July 3, 2009

How To Export Access Database into Text File Using vbScript

Yah daripada ngga ada kerjaan.... Ini ada sesuatu yg bisa bikin otak kita kejang dikit^^

Note :
Database dan datanya tidak dilampirkan jadi siapin sendiri yach~
Simpan Database difolder yang sama dengan file vbs berikut.
Modalnya cuma Copy paste kedalam Notepad aja.
Lalu save dengan format ".vbs"
Buat yang masih belum tau cara nge-save filenya :
Setelah Dialog Box Save As terbuka, simpan file : "AccessIntoTextFile.vbs" [jangan lupa tanda petiknya^^]
Untuk menjalankan double click file vbs tersebut.

Here we go....

'==============================================
'Script is start form here
'How To Export Access Database into Text File Using vbScript
'File : AccessIntoTextFile.vbs
'==============================================

Const adOpenStatic = 3
Const adLockOptimistic = 3

'Siapkan penampungnya
Set objConnection = CreateObject("ADODB.Connection")
Set objRecordSet = CreateObject("ADODB.Recordset")

'Siapkan Text File
Set objFSOW = CreateObject("Scripting.FileSystemObject")
Set objFileW = objFSOW.CreateTextFile(".\" & "ExportResult.txt", True)

'membuka Koneksi menuju Access
objConnection.Open _
"Provider = Microsoft.Jet.OLEDB.4.0; " & _
"Data Source = " & ".\" & "Database.mdb"

'Query isi Database
objRecordSet.Open "SELECT name, address " & _
"FROM CustMaster", objConnection, adOpenStatic, adLockOptimistic

'Membaca hasil query baris pertama sampai terakhir
objRecordSet.MoveFirst

Do Until objRecordSet.EOF = True
objFileW.Writeline objRecordSet(0) & " " & objRecordSet(1)
objRecordSet.MoveNext
Loop

'Tutup koneksi, semua file dan bersihkan penghubung
objRecordSet.Close
objConnection.Close
objFileW.Close

'End of Script.

HiHi

Friday, June 27, 2008

How To Show Missing 'Desktop icon' in XP

Few days ago, i lost my 'Desktop' icon from Quick Launch. Maybe it's not a big problem, but when i opened so many applications and then need to access some files on my Desktop, it's become to be so unconvenient. I have to minimized all the window one by one. tensionActually you can use windows key with 'M', but for some types of keyboard seems don't have this Windows Key. But after googling, i find an article which explained How To Recreate this Extraordinary Shortcut.peace

To recreate it :

* Click Start->Run
* In the "open" box, type "notepad" (without the quotes)
* Click ok
* Copy the following lines in your new notepad window :

[Shell]
Command=2
IconFile=explorer.exe,3
[Taskbar]
Command=ToggleDesktop

* Click "File" in the notepad menu and select "Save As"
* Save the file to your desktop as Show Desktop.scf
* Drag the new icon from your desktop to your Quick Launch toobar and select "Move here"

If you can't move the new Desktop icon to your Quick Launch toolbar for whatever reason, you can also try the following technique :

* Right-click the new show desktop icon on your desktop and select copy
* Open Windows Explorer and navigate to
C:\Documents and Settings\\Application Data\Microsoft\Internet Explorer\Quick Launch (replacing with the username for which you want to restore the show desktop icon)
* In the right pane of the explorer window, right-click an empty spot and select "paste"

Maybe you don't see the Application Data folder in your Explorer. To see it, you must enable visibility for hidden folders :

* In Windows Explorer, click the menu "Tools" and select "Folder Options..."
* Click the "View" tab
* Under "Advanced Settings", select "Show hidden files and folders"
* Click ok

Reference : This site.

Thursday, June 5, 2008

Gunanya Ada Internet Part 1

Mulai sekarang aku akan catetin beberapa link yang biasanya aku pake disaat-saat bosen, santai, sibuk atau lagi kepepet buat nyari sesuatu yang aku sendiri ngga tau.

Ini dia listnya :

1. Kamus Indonesia-Inggris-Indonesia : Sederet

Kamus online ini kayaknya lebih mantep daripada Kamus.net. Mungkin karena lebih terawat aja & ngga banyak error page-nya.

2. Penerjemah Inggris-Jepang-Inggris : 翻訳-Yahoo

Bisa dibilang ini salah satu tools yang paling lumayan deh buat nerjemahin bahasa Jepang, soalnya terbukti waktu bikin laporan akhir training aku copy mentah-mentah terjemahan dari sini & cuma dikit banget yang perlu aku edit. Dan ternyata sensei-pun ngga komentar apa-apa.

3. Jadwal Kereta Jepang : 路線情報-Yahoo

Karena disini mo kemana-mana pasti pake transportasi publik, jadinya kita harus tau jalur-jalur dan berapa harga tiket yang diperluin. Jadinya serahkan saja pada si Yahoo karena emang dia yang paling terpercaya. Dulu pernah sangsi juga, tapi akhirnya nyadar kalo ini emang paling TOP deh(kecuali keretanya telat ya^^).

4. Buku Online : Books-Google

Ini buat sampingan buat yang dikantor suka bengong. Dari fiksi, non-fiksi, ilmiah, dll semuanya ada. TAPI ngga semua full version. Jadi aku saranin cari buku yang tipe-tipe novel Jadul punya aja, dijamin bisa dibaca lengkap.

5. Cerita Anak Negeri : KOKI

Sekali lagi buat yang memang lagi bengong & ngga tau mau ngapain, boleh deh diintip kisah-kisah dari macem-macem orang Indo sejagat ini. Siapa tau bisa membuka mata seluas cakrawala walaupun cuma dari bilik warnet yang kecil plus mempelajari cara pikir orang lain. Cuma jangan protes kalo ada tulisan yang ngga bermutu ato ngga penting deh. Silahkan komentar di kolom komentarnya aja

6. Resep Masakan : DetikFood

Hari ini masak apa ya? Atau, Pengen belajar masak tapi ngga tau mau mulai darimana? Kayaknya detikfood emang paling cocok, walaupun hasilnya juga tergantung dari koki yang masak tapi ngga ada salahnya coba diliat siapa tau ada resep-resep yang bisa dicoba.

7. Berita Indonesia : Kompas, Detik

Biar tinggal di luar negeri, ngga,au dong kalo sampe ketinggalan berita di kampung halaman tercinta. Jangan lupa untuk ngecek 2 site ini buat sekedar ngeliat headline-nya aja. Kenapa kog headline-nya aja? Ya sapa tau males baca berita tapi pas mau ngomong ama temen lagi ngga ada topik baru, tinggal sebut aja headline berita yang tadi dibaca trus ajukan pertanyaan 5W1H seputar headline tadi ketemen kamu itu(dijamin lama-lama dia ngga mau lagi ngeladenin kamu).

8. Belaja buat Web beserta Script dan kawan-kawannya : w3schools

Di web ini kita bisa belajar tentang cara-cara membangun web sederhana plus semua yang berhubungan dengan web.

9. Nonton Film, Anime Korea- Japan Online : my Soju, Crunchyroll

Tapi buat nonton lewat site ini otomatis butuh internet yang agak dikit cepet dari lelet koneksinya. Jadi buat yang diIndo harus nonton sabil elus-elus dada deh kalo sampe nontonnya ngga nyaman(awas jangan ngelus dada sebelahnya ya!!).

10. TV Indonesia Online : ImediaBiz

Buat yang kangen ama sinetron-sinetron Indonesia ato gossip-gossip terbaru silahkan dipilih aja channel mana yang kamu suka.

Sekian buat kali ini listnya.

Thursday, May 15, 2008

Windows Script 2

'**************************************
'File : UserInput.vbs
'
'The Script implement user Input
'& MessageBox with VBScript
'**************************************

Option Explicit
'declare several variable
Dim Msg, Result
Dim Title, Text1, Text2
Dim Check

Check = TRUE

'define dialog box variables

Msg = "Please Input your Name."
Title = "WSH Sample User Input"
Text1 = "User Input is canceled!"
Text2 = "Hi "

do while Check=TRUE
'Using the InputBox function
Result = InputBox(Msg, Title, "Inge", 100, 100)

'Evaluate input
If Result = "" then
WScript.Echo Text1
Else
WScript.Echo Text2 + Result + "!"
End If

Msg = "Try Again."
Title = "MsgBoxDemo"

if MsgBox(Msg, _
vbYesNo + vbQuestion, _
Title) = vbYes then
Check = TRUE
Else
Check = FALSE
MsgBox "Bye-bye!"
End If
Loop

WScript.Quit()

'End

Thursday, May 1, 2008

Windows Script 1

Mari belajar Windows Script bersama-sama. Caranya gampang banget kog, soalnya aku juga baru mulai belajar juga. Jadi bahan-bahan yang diperlukan :
1. Komputer
2. Notepad
3. Jari untuk mengetik.

Contoh pertama, bagaimana caranya membuat sebuah alert.

File : Hello world.js, Type : JScript

//************************************
//Filename : Hello world.js
//************************************
Wscript.Echo(“Hello world”);

//End

=============================
File : Hello world.vbs, Type : VBScript

'************************************
'Filename : Hello world.vbs
'************************************
Option Explicit
Dim Message
Dim Title

Message = "Hello world"
Title = "Hello"

MsgBox Message, VBInformation + vbOKOnly, Title

'End
=============================


Gampang bukan? Oya untuk liat hasilnya double click aja file “Hello world.js” atau “Hello world.vbs” itu tadi.

Bersambung…
Related Posts Plugin for WordPress, Blogger...