Jump to content

My Version Of SWB


ScriptLearner
 Share

Recommended Posts

:) Hey This is my Version Of SWB i got the code form the normal but i edited it hope it helps

#NoTrayIcon
#RequireAdmin
#include <GUIConstants.au3>
#include <IE.au3>
#include <INet.au3>

_IEErrorHandlerRegister()

Global $oIE = ObjCreate("Shell.Explorer.2")
Global $ini = @ScriptDir & "\swb.ini"

Global $read_height = IniRead($ini, "Display", "Height", "")
Global $read_width = IniRead($ini, "Display", "Width", "")
Global $read_homepage = IniRead($ini, "Settings", "Homepage", "")
Global $read_starthomepage = IniRead($ini, "Settings", "StartHomepage", "")

If $read_height = "" Then
IniWrite($ini, "Display", "Height", "600")
IniWrite($ini, "Display", "Width", "800")
$read_height = 600
$read_width = 800
EndIf

If $read_starthomepage = "" Then
$read_starthomepage = "1"
$read_homepage = "www.autoitscript.com/forum"
EndIf

$iniread = IniRead($ini, "URL", "LAST URL", " ")
If $read_starthomepage = "0" Then $read_homepage = $iniread

$gui_main = GUICreate("Scripts Web Browser", $read_width, $read_height + 20, -1, -1, $WS_CLIPSIBLINGS + $WS_OVERLAPPEDWINDOW)

$file_menu = GUICtrlCreateMenu("File")
$fm_open = GUICtrlCreateMenuItem("Open...", $file_menu)
$fm_SaveSource = GUICtrlCreateMenuItem("Save Source", $file_menu)
$fm_sep = GUICtrlCreateMenuItem("", $file_menu)
$fm_exit = GUICtrlCreateMenuItem("Exit", $file_menu)

$view_menu = GUICtrlCreateMenu("View")
$vm_status = GUICtrlCreateMenuItem("Status Bar", $view_menu)
GUICtrlSetState(-1, $GUI_CHECKED)

$bookmark_menu = GUICtrlCreateMenu("ScriptMarks")
$bm_1readini = IniRead($ini, "ScriptMarks", "1", "")


If $bm_1readini Then
$bm_1 = GUICtrlCreateMenuItem("" & $bm_1readini & "", $bookmark_menu)
EndIf
If Not $bm_1readini Then
$bm_1 = GUICtrlCreateMenuItem("New ScriptMarks", $bookmark_menu)
EndIf

$bm_2readini = IniRead($ini, "ScriptMarks", "2", "")
If $bm_2readini Then
$bm_2 = GUICtrlCreateMenuItem("" & $bm_2readini & "", $bookmark_menu)
EndIf
If Not $bm_2readini Then
$bm_2 = GUICtrlCreateMenuItem("ScriptMarks2", $bookmark_menu)
EndIf

$bm_3readini = IniRead($ini, "ScriptMarks", "3", "")
If $bm_3readini Then
$bm_3 = GUICtrlCreateMenuItem("" & $bm_3readini & "", $bookmark_menu)
EndIf
If Not $bm_3readini Then
$bm_3 = GUICtrlCreateMenuItem("ScriptMarks3", $bookmark_menu)
EndIf


$tool_menu = GUICtrlCreateMenu("Tools")
$tm_pref = GUICtrlCreateMenuItem("Preferences...", $tool_menu)
$tm_dini = GUICtrlCreateMenuItem("Delete Settings", $tool_menu)
$tm_ml = GUICtrlCreateMenuItem("Myspace Login", $tool_menu)

$about_menu = GUICtrlCreateMenu("About")
$am_about = GUICtrlCreateMenuItem("About", $about_menu)

$gui_iewindow = GUICtrlCreateObj($oIE, 0, 0, $read_width, $read_height - 45)
GUICtrlSetResizing($gui_iewindow, $GUI_DOCKAUTO)

$address_bar_label = GUICtrlCreateLabel("Enter The Website Address: ", 0, 562, 85, -1)
$address_bar_input = GUICtrlCreateInput($read_homepage, 76, 559, 200, -1)
$address_bar_go = GUICtrlCreateButton("Go >>", 280, 557, 50, -1, $BS_DEFPUSHBUTTON)
$address_bar_stop = GUICtrlCreateButton("Stop", 332, 557, 50, -1)
$address_bar_back = GUICtrlCreateButton("Back", 383, 557, 50, -1)
$address_bar_home = GUICtrlCreateButton("Home", 434, 557, 50, -1)
$address_bar_speak = GUICtrlCreateButton("Speak", 485, 557, 50, -1)

$status_bar = GUICtrlCreateLabel("Loading: " & $read_homepage & "...", 0, 584, $read_width, $read_height, BitOR($SS_SIMPLE, $SS_SUNKEN))

GUISetState(@SW_SHOW, $gui_main)
SoundPlay("C:\WINDOWS\Media\notify.wav")

_IENavigate($oIE, $read_homepage)

$gui_pref = GUICreate("Preferences", 298, 230, 359, 233)
$group1 = GUICtrlCreateGroup("Settings", 16, 16, 265, 170)
$label_home = GUICtrlCreateLabel("Scripts Homepage:", 32, 40, 59, 17)
$input_add = GUICtrlCreateInput($read_homepage, 96, 40, 161, 21)
$label_start = GUICtrlCreateLabel("On Startup:", 32, 80, 58, 17)
$combo_startup = GUICtrlCreateCombo("", 96, 80, 161, 25)
If $read_starthomepage = "0" Then
GUICtrlSetData(-1, "Start with Homepage|Start with Last Visited", "Start with Last Visited")
Else
GUICtrlSetData(-1, "Start with Homepage|Start with Last Visited", "Start with Last Visited")
EndIf
$pref_width_label = GUICtrlCreateLabel("Display Width", 32, 110, 58, 71)
$pref_width_input = GUICtrlCreateInput($read_width, 80, 115, 58, 20)
$pref_height_label = GUICtrlCreateLabel("Display Height", 32, 140, 58, 71)
$pref_height_input = GUICtrlCreateInput($read_height, 80, 145, 58, 20)
$button_apply = GUICtrlCreateButton("Apply", 120, 190, 75, 25, 0)
$button_close = GUICtrlCreateButton("Close", 208, 190, 75, 25, 0)
GUISetState(@SW_HIDE, $gui_pref)


While 1
If _IEPropertyGet($oIE, "busy") Then
$url = _IEPropertyGet($oIE, "locationurl")
_StatusChange("Loading: " & $url & "...")
Else
_StatusChange("Done.")
EndIf

$msg = GUIGetMsg()
Switch $msg
Case $GUI_EVENT_CLOSE
If WinGetHandle('') = $gui_main Then
MsgBox(0, "Scripts Web Browser", "Thank you for using Scripts Web Browser")
SoundPlay("C:\WINDOWS\Media\Windows XP Recycle.wav")
Exit
Else
GUISetState(@SW_HIDE, WinGetHandle(''))
EndIf
;File Menu
Case $fm_exit
MsgBox(0, "Scripts Web Browser", "Thank you for using Scripts Web Browser")
SoundPlay("C:\WINDOWS\Media\Windows XP Recycle.wav")
Exit
Case $fm_open
Local $file = FileOpenDialog("Select file...", @ScriptDir, "All Files (*.*)")
If @error <> 1 Then
_StatusChange("Loading: " & $file & "...")
_IENavigate($oIE, $file)
EndIf
Case $fm_SaveSource
$source = InputBox("Scripts Web Browser", "Whats is the Website URL you want to save the source from?")
$IE = _INetGetSource("" & $source & "")
FileWrite(@DesktopDir & "\websource.html", $IE)
MsgBox(0, "Scripts Web Browser", "Saved to desktop as websource.html")
;View Menu
Case $vm_status
$size = WinGetPos("Scripts Web Browser")
If BitAND(GUICtrlRead($vm_status), $GUI_CHECKED) = $GUI_CHECKED Then
GUICtrlSetState($vm_status, $GUI_UNCHECKED)
GUICtrlSetState($status_bar, $GUI_HIDE)
WinMove("Scripts Web Browser", "", $size[0], $size[1], $size[2], $size[3] - 15)
Else
GUICtrlSetState($vm_status, $GUI_CHECKED)
GUICtrlSetState($status_bar, $GUI_SHOW)
WinMove("Scripts Web Browser", "", $size[0], $size[1], $size[2], $size[3] + 15)
EndIf
; Tools Menu
Case $tm_dini
MsgBox(0, "Scripts Web Browser", "This will delete all of Scripts Web Browsers Settings; Continue?")
FileDelete($ini)
Case $tm_pref
GUISetState(@SW_SHOW, $gui_pref)
Case $button_close
GUISetState(@SW_HIDE, $gui_pref)
Case $button_apply
$getwidth = GUICtrlRead($pref_width_input)
$getheight = GUICtrlRead($pref_height_input)
IniWrite($ini, "Display", "Width", $getwidth)
IniWrite($ini, "Display", "Height", $getheight)
$gethome = GUICtrlRead($input_add)
$getstarthome = GUICtrlRead($combo_startup)
If $getstarthome = "Start with Homepage" Then
IniWrite($ini, "Settings", "StartHomepage", "1")
Else
IniWrite($ini, "Settings", "StartHomepage", "0")
EndIf
IniWrite($ini, "Settings", "Homepage", $gethome)
GUISetState(@SW_HIDE, $gui_pref)
_StatusChange("Configuration written successfully.")
Sleep(1000)
Case $tm_ml
MsgBox(0, "Scripts Web Browser", "I created Myspace login sense I used it so much. It will NEVER steal any info you use. If you dont trust the Script browser with your info, exit now!")
$usernothere = IniRead($ini, "Myspace", "Username:", "")
If Not $usernothere Then
$user = InputBox("Myspace Login", "Whats your username?")
$pass = InputBox("Myspace Login", "Whats your password?", "", "*")
$sqml = MsgBox(4, "Simple Web Browser", "Do you want me to save your username and password for future logins?")
If $sqml = 6 Then
IniWrite($ini, "Myspace", "Username:", "" & $user & "")
IniWrite($ini, "Myspace", "Password:", "" & $pass & "")
EndIf
If $sqml = 7 Then
EndIf
EndIf
$Useristhere = IniRead($ini, "Myspace", "Username:", "")
If $Useristhere Then
$user = IniRead($ini, "Myspace", "Username:", "")
$pass = IniRead($ini, "Myspace", "Password:", "")
EndIf
$sEmail = "" & $user & ""
$sPassword = "" & $pass & ""
$sURL = "http://www.myspace.com/"
$oIE = _IECreate($sURL)
WinActivate("MySpace - Windows Internet Explorer")
WinSetState("MySpace - Windows Internet Explorer", "", @SW_MAXIMIZE)
$oForm = _IEFormGetObjByName($oIE, "theForm")
$oEmail = _IEFormElementGetObjByName($oForm, "email")
$oPassword = _IEFormElementGetObjByName($oForm, "password")
$oButton = _IEGetObjByName($oForm, "ctl00_Main_SplashDisplay_ctl01_loginbutton")
_IEFormElementSetValue($oEmail, $sEmail)
_IEFormElementSetValue($oPassword, $sPassword)
_IEAction($oButton, "click")
;Bookmark Menu
Case $bm_1
$inireadbm_1 = IniRead($ini, "ScriptMarks", "1", "")
If Not $inireadbm_1 Then
$bm1 = InputBox("Scripts Web Browser", "Type in the address of the ScriptMark:")
IniWrite($ini, "ScriptMarks", "1", "" & $bm1 & "")
GUICtrlSetData($bm_1, $bm1)
EndIf
If $inireadbm_1 Then
_StatusChange("Loading: " & $bm_1readini & "...")
_IENavigate($oIE, $bm_1readini)
EndIf

Case $bm_2
$inireadbm_2 = IniRead($ini, "ScriptMarks", "2", "")
If Not $inireadbm_2 Then
$bm2 = InputBox("Scripts Web Browser", "Type in the address of the ScriptMark:")
IniWrite($ini, "ScriptMarks", "2", "" & $bm2 & "")
GUICtrlSetData($bm_2, $bm2)
EndIf
If $inireadbm_2 Then
_StatusChange("Loading: " & $inireadbm_2 & "...")
_IENavigate($oIE, $inireadbm_2)
EndIf

Case $bm_3
$inireadbm_3 = IniRead($ini, "ScriptMarks", "3", "")
If Not $inireadbm_3 Then
$bm3 = InputBox("Scripts Web Browser", "Type in the address of the ScriptMarks:")
IniWrite($ini, "Bookmarks", "3", "" & $bm3 & "")
GUICtrlSetData($bm_3, $bm3)
EndIf
If $inireadbm_3 Then
_StatusChange("Loading: " & $inireadbm_3 & "...")
_IENavigate($oIE, $inireadbm_3)
EndIf
;About Menu
Case $am_about
MsgBox(0, "Scripts Web Browser", "Scripts Web Browser was created purely in AutoitV3 . Script Learner © 2007. All rights reserved.")
; Address Bar Buttons
Case $address_bar_go
$addy = GUICtrlRead($address_bar_input)
_StatusChange("Loading: " & $addy & "...")
_IENavigate($oIE, $addy)
_StatusChange("Done.")
IniWrite($ini, "URL", "LAST URL", $addy)
Case $address_bar_stop
_IEAction($oIE, "stop")
Case $address_bar_back
_IEAction($oIE, "back")
Case $address_bar_home
$read_homepageini = IniRead($ini, "Settings", "Homepage", "")
_IENavigate($oIE, $read_homepageini)
GUICtrlSetData($address_bar_input, $read_homepage)
Case $address_bar_speak
$txt = InputBox("Scripts Web Browser", "Text to Speech is still very limited. For now you have to enter text in here. Easy way is to copy and paste the text.")
Dim $voice = ObjCreate("Sapi.SpVoice")
$empty = ""
$txt2 = "" & $txt & ""
If $txt2 = $empty Then
Speak("You did not put input.", 0, 100)
Else
Speak($txt2, 0, 100)
EndIf
EndSwitch
WEnd
Func _StatusChange($message)
GUICtrlSetData($status_bar, $message)
EndFunc;==>_StatusChange
Func Speak($text, $Rate, $Volme)
$voice.Rate = $Rate
$voice.Volume = $Volme
$voice.Speak($text)
EndFunc;==>Speak

Hope This IS Good

Edited by ScriptLearner
Link to comment
Share on other sites

Hmmmm, typically when you swipe someones code for your own and post on it you would want to at least credit the original author. I am not seeing any props to Justin Reno. I do like the one addition you added with the myspace, would be nice to see you work on developing that to where it might encrypt the user/pass in the ini and read it encypted. That could be your own code to boast about...

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...