LordJugag Posted October 6, 2010 Share Posted October 6, 2010 Hello!I need help, I want to change the option Random URL with Next URL.Please give me instructions or tutorials ... or modify the original code:expandcollapse popupFunc _Random() $Ranpg = Random(1, 18, 1) Switch $Ranpg Case 1 $oIE.Navigate ("www.google.com") Case 2 $oIE.Navigate ("www.youtube.com") Case 3 $oIE.Navigate ("www.justinreno.tk") Case 4 $oIE.Navigate ("www.autoitscript.com") Case 3 $oIE.Navigate ("www.autoitscript.com/forum") Case 6 $oIE.Navigate ("www.answers.com") Case 7 $oIE.Navigate ("www.swbforum.tk") Case 8 $oIE.Navigate ("http://www.youtube.com/watch?v=0dBu5X3TvNw") Case 9 $oIE.Navigate ("http://www.youtube.com/watch?v=PSYxT9GM0fQ") Case 10 $oIE.Navigate ("www.familyguy.com") Case 11 $oIE.Navigate ("www.jareno18forums.tk") Case 12 $oIE.Navigate ("about:blank") Case 13 $oIE.Navigate ("www.msn.com") Case 14 $oIE.Navigate ("www.microsoft.com") Case 15 $oIE.Navigate ("www.apple.com") Case 16 $oIE.Navigate ("http://www.youtube.com/watch?v=nsCXZczTQXo") Case 17 $oIE.Navigate ("http://www.youtube.com/watch?v=qmVn6b7DdpA") Case 18 $oIE.Navigate ("http://www.youtube.com/watch?v=O7txeOlujTc") EndSwitch EndFunc ;==>_RandomPartially code is from Simple Web Browser without IE UDFThanks a lot! Link to comment Share on other sites More sharing options...
wakillon Posted October 6, 2010 Share Posted October 6, 2010 Like this ? expandcollapse popupGlobal $_Next ; Func _Random() $_Next = $_Next + 1 If $_Next > 18 Then $_Next = 1 Switch $_Next Case 1 $oIE.Navigate ("www.google.com") Case 2 $oIE.Navigate ("www.youtube.com") Case 3 $oIE.Navigate ("www.justinreno.tk") Case 4 $oIE.Navigate ("www.autoitscript.com") Case 3 $oIE.Navigate ("www.autoitscript.com/forum") Case 6 $oIE.Navigate ("www.answers.com") Case 7 $oIE.Navigate ("www.swbforum.tk") Case 8 $oIE.Navigate ("http://www.youtube.com/watch?v=0dBu5X3TvNw") Case 9 $oIE.Navigate ("http://www.youtube.com/watch?v=PSYxT9GM0fQ") Case 10 $oIE.Navigate ("www.familyguy.com") Case 11 $oIE.Navigate ("www.jareno18forums.tk") Case 12 $oIE.Navigate ("about:blank") Case 13 $oIE.Navigate ("www.msn.com") Case 14 $oIE.Navigate ("www.microsoft.com") Case 15 $oIE.Navigate ("www.apple.com") Case 16 $oIE.Navigate ("http://www.youtube.com/watch?v=nsCXZczTQXo") Case 17 $oIE.Navigate ("http://www.youtube.com/watch?v=qmVn6b7DdpA") Case 18 $oIE.Navigate ("http://www.youtube.com/watch?v=O7txeOlujTc") EndSwitch EndFunc ;==>_Random AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts Link to comment Share on other sites More sharing options...
LordJugag Posted October 6, 2010 Author Share Posted October 6, 2010 Hm... error $_Next = $_Next + 1$_Next = ^ ERROR Link to comment Share on other sites More sharing options...
wakillon Posted October 6, 2010 Share Posted October 6, 2010 Hm... error Have you put"Global$_Next"at the start of the script ? AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts Link to comment Share on other sites More sharing options...
LordJugag Posted October 6, 2010 Author Share Posted October 6, 2010 Have you put"Global$_Next"at the start of the script ?Yes... Link to comment Share on other sites More sharing options...
wakillon Posted October 6, 2010 Share Posted October 6, 2010 (edited) If I test only the function : expandcollapse popupGlobal $_Next While 1 _Random() Sleep ( 2000 ) WEnd Func _Random() $_Next = $_Next + 1 If $_Next > 18 Then $_Next = 1 ConsoleWrite ( "$_Next : " & $_Next & @Crlf ) Switch $_Next Case 1 ;$oIE.Navigate ("www.google.com") Case 2 ;$oIE.Navigate ("www.youtube.com") Case 3 ;$oIE.Navigate ("www.justinreno.tk") Case 4 ;$oIE.Navigate ("www.autoitscript.com") Case 3 ;$oIE.Navigate ("www.autoitscript.com/forum") Case 6 ;$oIE.Navigate ("www.answers.com") Case 7 ;$oIE.Navigate ("www.swbforum.tk") Case 8 ;$oIE.Navigate ("http://www.youtube.com/watch?v=0dBu5X3TvNw") Case 9 ;$oIE.Navigate ("http://www.youtube.com/watch?v=PSYxT9GM0fQ") Case 10 ;$oIE.Navigate ("www.familyguy.com") Case 11 ;$oIE.Navigate ("www.jareno18forums.tk") Case 12 ;$oIE.Navigate ("about:blank") Case 13 ;$oIE.Navigate ("www.msn.com") Case 14 ;$oIE.Navigate ("www.microsoft.com") Case 15 ;$oIE.Navigate ("www.apple.com") Case 16 ;$oIE.Navigate ("http://www.youtube.com/watch?v=nsCXZczTQXo") Case 17 ;$oIE.Navigate ("http://www.youtube.com/watch?v=qmVn6b7DdpA") Case 18 ;$oIE.Navigate ("http://www.youtube.com/watch?v=O7txeOlujTc") EndSwitch EndFunc ;==>_Random It give me : $_Next : 1 $_Next : 2 $_Next : 3 $_Next : 4 $_Next : 5 $_Next : 6 $_Next : 7 $_Next : 8 $_Next : 9 $_Next : 10 $_Next : 11 $_Next : 12 $_Next : 13 $_Next : 14 $_Next : 15 $_Next : 16 $_Next : 17 $_Next : 18 $_Next : 1 $_Next : 2 $_Next : 3 $_Next : 4 $_Next : 5 $_Next : 6 So, it works well ! Edited October 6, 2010 by wakillon AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts Link to comment Share on other sites More sharing options...
LordJugag Posted October 6, 2010 Author Share Posted October 6, 2010 You have checked with source code from browser? I ask because don't work Link to comment Share on other sites More sharing options...
wakillon Posted October 6, 2010 Share Posted October 6, 2010 You have checked with source code from browser? I ask because don't work Can you post your script, it will be more easy to find the error ! AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts Link to comment Share on other sites More sharing options...
LordJugag Posted October 6, 2010 Author Share Posted October 6, 2010 expandcollapse popup#NoTrayIcon #Include <INet.au3> #Include <String.au3> 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("", $read_width, $read_height + 20, -1, -1, 0x04000000 + 0x00CF0000) $file_menu = GUICtrlCreateMenu("File") $fm_newwind = GUICtrlCreateMenuItem("New Window", $file_menu) $fm_sep = GUICtrlCreateMenuItem("", $file_menu) $fm_open = GUICtrlCreateMenuItem("Open", $file_menu) $fm_sep = GUICtrlCreateMenuItem("", $file_menu) $fm_print = GUICtrlCreateMenuItem("Print", $file_menu) $fm_sep = GUICtrlCreateMenuItem("", $file_menu) $fm_savas = GUICtrlCreateMenuItem("Save As", $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, 1) $tool_menu = GUICtrlCreateMenu("Tools") $tm_pref = GUICtrlCreateMenuItem("Preferences", $tool_menu) $tm_sep = GUICtrlCreateMenuItem("", $tool_menu) $tm_ru = GUICtrlCreateMenuItem("Random URL", $tool_menu) $tm_sep = GUICtrlCreateMenuItem("", $tool_menu) $tm_gu = GUICtrlCreateMenuItem("Get Current URL", $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, 0x0001) $address_bar_label = GUICtrlCreateLabel("Enter Address: ", 0, 562, 85, -1) $address_bar_input = GUICtrlCreateInput($read_homepage, 76, 559, 200, -1) $address_bar_go = GUICtrlCreateButton("Go >>", 280, 557, 50, -1, 0x0001) $address_bar_stop = GUICtrlCreateButton("Stop", 330, 557, 50, -1) $address_bar_back = GUICtrlCreateButton("Back", 380, 557, 50, -1) $address_bar_forward = GUICtrlCreateButton("Forward", 430, 557, 50, -1) $address_bar_refresh = GUICtrlCreateButton("Refresh", 480, 557, 50, -1) $address_bar_home = GUICtrlCreateButton("Home", 530, 557, 50, -1) $address_bar_speak = GUICtrlCreateButton("Speak", 580, 557, 50, -1) $status_bar = GUICtrlCreateLabel("Loading: " & $read_homepage & "...", 0, 584, $read_width, $read_height, BitOR(11, 0x1000)) GUISetState() AnimateTitle($gui_main, "Simple Web Browser 3.0 - Created by Justin Reno", 100) $oIE.Navigate ($read_homepage) $gui_pref = GUICreate("Preferences", 298, 230, 359, 233) $group1 = GUICtrlCreateGroup("Settings", 16, 16, 265, 170) $label_home = GUICtrlCreateLabel("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 Homepage") EndIf #cs $pref_Status_Status = 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) #ce $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 WinSetTitle($gui_main, "", "Simple Web Browser 3.0 - Created by Justin Reno - " & $oIE.locationURL ()) If $oIE.Busy () Then $url = $oIE.LocationURL () _StatusChange("Loading: " & $url & "...") Else _StatusChange("Done.") EndIf $msg = GUIGetMsg(1) Switch $msg[0] Case - 3 $update = $oIE.LocationURL () IniWrite($ini, "URL", "LAST URL", $update) FileDelete(@TempDir & "\SWBHelpFile.exe") Exit ;File Menu Case $fm_newwind ShellExecute(@ScriptFullPath) Case $fm_open Local $file = FileOpenDialog("Simple Web Browser 3.0 : Select file", @ScriptDir, "All Files (*.*)") If @error <> 1 Then _StatusChange("Loading: " & $file & "...") $oIE.Navigate ($file) EndIf Case $fm_print $oIE.document.parentwindow.Print () Case $fm_savas $oIE.document.execCommand ("SaveAs") Case $fm_SaveSource $IE = _INetGetSource("" & $update & "") FileWrite(@DesktopDir & "\websource.html", $IE) MsgBox(0, "Simple Web Browser 3.0", "Saved to desktop as websource.html") Case $fm_exit $update = $oIE.LocationURL () IniWrite($ini, "URL", "LAST URL", $update) Exit ;View Menu Case $vm_status $size = WinGetPos("Simple Web Browser") If BitAND(GUICtrlRead($vm_status), 1) = 4 Then GUICtrlSetState($vm_status, 4) GUICtrlSetState($status_bar, 32) WinMove("Simple Web Browser", "", $size[0], $size[1], $size[2], $size[3] - 15) Else GUICtrlSetState($vm_status, 1) GUICtrlSetState($status_bar, 16) WinMove("Simple Web Browser", "", $size[0], $size[1], $size[2], $size[3] + 15) EndIf Case $tm_pref GUISetState(@SW_SHOW, $gui_pref) Case $tm_ru _Random() Case $tm_gu $update = $oIE.LocationURL () MsgBox(0, "Simple Web Browser 3.0", "URL:" & $update & "") ClipPut($update) 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) ;About Menu Case $am_about FileDelete(@TempDir & "\SWBHelpFile.exe") InetGet("http://h1.ripway.com/mrreno/SWBHelpFile.exe", @TempDir & "\SWBHelpFile.exe", 1, 0) ShellExecute(@TempDir & "\SWBHelpFile.exe") ;Address Bar Buttons Case $address_bar_go $addy = GUICtrlRead($address_bar_input) _StatusChange("Loading: " & $addy & "...") $oIE.Navigate ($addy) _StatusChange("Done.") Case $address_bar_stop $oIE.Stop () Case $address_bar_back $oIE.GoBack () Case $address_bar_forward $oIE.GoForward () Case $address_bar_refresh $oIE.document.execCommand ("Refresh") Case $address_bar_home $read_homepageini = IniRead($ini, "Settings", "Homepage", "") $oIE.Navigate ($read_homepageini) GUICtrlSetData($address_bar_input, $read_homepage) Case $address_bar_speak Dim $voice = ObjCreate("Sapi.SpVoice") Speak($oIE.document.selection.createRange.text & @CR, 0, 100) 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 Global $_Next While 1 _Random() Sleep ( 2000 ) WEnd Func _Random() $_Next = $_Next + 1 If $_Next > 18 Then $_Next = 1 ConsoleWrite ( "$_Next : " & $_Next & @Crlf ) Switch $_Next Case 1 ;$oIE.Navigate ("www.google.com") Case 2 ;$oIE.Navigate ("www.youtube.com") Case 3 ;$oIE.Navigate ("www.justinreno.tk") Case 4 ;$oIE.Navigate ("www.autoitscript.com") Case 3 ;$oIE.Navigate ("www.autoitscript.com/forum") Case 6 ;$oIE.Navigate ("www.answers.com") Case 7 ;$oIE.Navigate ("www.swbforum.tk") Case 8 ;$oIE.Navigate ("http://www.youtube.com/watch?v=0dBu5X3TvNw") Case 9 ;$oIE.Navigate ("http://www.youtube.com/watch?v=PSYxT9GM0fQ") Case 10 ;$oIE.Navigate ("www.familyguy.com") Case 11 ;$oIE.Navigate ("www.jareno18forums.tk") Case 12 ;$oIE.Navigate ("about:blank") Case 13 ;$oIE.Navigate ("www.msn.com") Case 14 ;$oIE.Navigate ("www.microsoft.com") Case 15 ;$oIE.Navigate ("www.apple.com") Case 16 ;$oIE.Navigate ("http://www.youtube.com/watch?v=nsCXZczTQXo") Case 17 ;$oIE.Navigate ("http://www.youtube.com/watch?v=qmVn6b7DdpA") Case 18 ;$oIE.Navigate ("http://www.youtube.com/watch?v=O7txeOlujTc") EndSwitch EndFunc ;==>_Random Func AnimateTitle($hGUI, $sTitle, $iBuf) $sTitle = StringSplit($sTitle, "") For $i = $iBuf To 0 Step - 1 WinSetTitle($hGUI, "", _StringRepeat(" ", $i) & $sTitle[1]) Next Local $s For $i = 1 To $sTitle[0] $s &= $sTitle[$i] WinSetTitle($hGUI, "", $s) Sleep(5) Next EndFunc ;==>AnimateTitle Link to comment Share on other sites More sharing options...
wakillon Posted October 6, 2010 Share Posted October 6, 2010 Ok !And like that ? expandcollapse popup#NoTrayIcon #Include <INet.au3> #Include <String.au3> Global $oIE = ObjCreate("Shell.Explorer.2") Global $ini = @ScriptDir & "\swb.ini" Global $_Next 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("", $read_width, $read_height + 20, -1, -1, 0x04000000 + 0x00CF0000) $file_menu = GUICtrlCreateMenu("File") $fm_newwind = GUICtrlCreateMenuItem("New Window", $file_menu) $fm_sep = GUICtrlCreateMenuItem("", $file_menu) $fm_open = GUICtrlCreateMenuItem("Open", $file_menu) $fm_sep = GUICtrlCreateMenuItem("", $file_menu) $fm_print = GUICtrlCreateMenuItem("Print", $file_menu) $fm_sep = GUICtrlCreateMenuItem("", $file_menu) $fm_savas = GUICtrlCreateMenuItem("Save As", $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, 1) $tool_menu = GUICtrlCreateMenu("Tools") $tm_pref = GUICtrlCreateMenuItem("Preferences", $tool_menu) $tm_sep = GUICtrlCreateMenuItem("", $tool_menu) $tm_ru = GUICtrlCreateMenuItem("Random URL", $tool_menu) $tm_sep = GUICtrlCreateMenuItem("", $tool_menu) $tm_gu = GUICtrlCreateMenuItem("Get Current URL", $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, 0x0001) $address_bar_label = GUICtrlCreateLabel("Enter Address: ", 0, 562, 85, -1) $address_bar_input = GUICtrlCreateInput($read_homepage, 76, 559, 200, -1) $address_bar_go = GUICtrlCreateButton("Go >>", 280, 557, 50, -1, 0x0001) $address_bar_stop = GUICtrlCreateButton("Stop", 330, 557, 50, -1) $address_bar_back = GUICtrlCreateButton("Back", 380, 557, 50, -1) $address_bar_forward = GUICtrlCreateButton("Forward", 430, 557, 50, -1) $address_bar_refresh = GUICtrlCreateButton("Refresh", 480, 557, 50, -1) $address_bar_home = GUICtrlCreateButton("Home", 530, 557, 50, -1) $address_bar_speak = GUICtrlCreateButton("Speak", 580, 557, 50, -1) $status_bar = GUICtrlCreateLabel("Loading: " & $read_homepage & "...", 0, 584, $read_width, $read_height, BitOR(11, 0x1000)) GUISetState() AnimateTitle($gui_main, "Simple Web Browser 3.0 - Created by Justin Reno", 100) $oIE.Navigate ($read_homepage) $gui_pref = GUICreate("Preferences", 298, 230, 359, 233) $group1 = GUICtrlCreateGroup("Settings", 16, 16, 265, 170) $label_home = GUICtrlCreateLabel("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 Homepage") EndIf #cs $pref_Status_Status = 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) #ce $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 WinSetTitle($gui_main, "", "Simple Web Browser 3.0 - Created by Justin Reno - " & $oIE.locationURL ()) If $oIE.Busy () Then $url = $oIE.LocationURL () _StatusChange("Loading: " & $url & "...") Else _StatusChange("Done.") EndIf $msg = GUIGetMsg(1) Switch $msg[0] Case - 3 $update = $oIE.LocationURL () IniWrite($ini, "URL", "LAST URL", $update) FileDelete(@TempDir & "\SWBHelpFile.exe") Exit ;File Menu Case $fm_newwind ShellExecute(@ScriptFullPath) Case $fm_open Local $file = FileOpenDialog("Simple Web Browser 3.0 : Select file", @ScriptDir, "All Files (*.*)") If @error <> 1 Then _StatusChange("Loading: " & $file & "...") $oIE.Navigate ($file) EndIf Case $fm_print $oIE.document.parentwindow.Print () Case $fm_savas $oIE.document.execCommand ("SaveAs") Case $fm_SaveSource $IE = _INetGetSource("" & $update & "") FileWrite(@DesktopDir & "\websource.html", $IE) MsgBox(0, "Simple Web Browser 3.0", "Saved to desktop as websource.html") Case $fm_exit $update = $oIE.LocationURL () IniWrite($ini, "URL", "LAST URL", $update) Exit ;View Menu Case $vm_status $size = WinGetPos("Simple Web Browser") If BitAND(GUICtrlRead($vm_status), 1) = 4 Then GUICtrlSetState($vm_status, 4) GUICtrlSetState($status_bar, 32) WinMove("Simple Web Browser", "", $size[0], $size[1], $size[2], $size[3] - 15) Else GUICtrlSetState($vm_status, 1) GUICtrlSetState($status_bar, 16) WinMove("Simple Web Browser", "", $size[0], $size[1], $size[2], $size[3] + 15) EndIf Case $tm_pref GUISetState(@SW_SHOW, $gui_pref) Case $tm_ru _Random() Case $tm_gu $update = $oIE.LocationURL () MsgBox(0, "Simple Web Browser 3.0", "URL:" & $update & "") ClipPut($update) 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) ;About Menu Case $am_about FileDelete(@TempDir & "\SWBHelpFile.exe") InetGet("http://h1.ripway.com/mrreno/SWBHelpFile.exe", @TempDir & "\SWBHelpFile.exe", 1, 0) ShellExecute(@TempDir & "\SWBHelpFile.exe") ;Address Bar Buttons Case $address_bar_go $addy = GUICtrlRead($address_bar_input) _StatusChange("Loading: " & $addy & "...") $oIE.Navigate ($addy) _StatusChange("Done.") Case $address_bar_stop $oIE.Stop () Case $address_bar_back $oIE.GoBack () Case $address_bar_forward $oIE.GoForward () Case $address_bar_refresh $oIE.document.execCommand ("Refresh") Case $address_bar_home $read_homepageini = IniRead($ini, "Settings", "Homepage", "") $oIE.Navigate ($read_homepageini) GUICtrlSetData($address_bar_input, $read_homepage) Case $address_bar_speak Dim $voice = ObjCreate("Sapi.SpVoice") Speak($oIE.document.selection.createRange.text & @CR, 0, 100) 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 Func _Random() $_Next = $_Next + 1 If $_Next > 18 Then $_Next = 1 ConsoleWrite ( "$_Next : " & $_Next & @Crlf ) Switch $_Next Case 1 $oIE.Navigate ("www.google.com") Case 2 $oIE.Navigate ("www.youtube.com") Case 3 $oIE.Navigate ("www.justinreno.tk") Case 4 $oIE.Navigate ("www.autoitscript.com") Case 3 $oIE.Navigate ("www.autoitscript.com/forum") Case 6 $oIE.Navigate ("www.answers.com") Case 7 $oIE.Navigate ("www.swbforum.tk") Case 8 $oIE.Navigate ("http://www.youtube.com/watch?v=0dBu5X3TvNw") Case 9 $oIE.Navigate ("http://www.youtube.com/watch?v=PSYxT9GM0fQ") Case 10 $oIE.Navigate ("www.familyguy.com") Case 11 $oIE.Navigate ("www.jareno18forums.tk") Case 12 $oIE.Navigate ("about:blank") Case 13 $oIE.Navigate ("www.msn.com") Case 14 $oIE.Navigate ("www.microsoft.com") Case 15 $oIE.Navigate ("www.apple.com") Case 16 $oIE.Navigate ("http://www.youtube.com/watch?v=nsCXZczTQXo") Case 17 $oIE.Navigate ("http://www.youtube.com/watch?v=qmVn6b7DdpA") Case 18 $oIE.Navigate ("http://www.youtube.com/watch?v=O7txeOlujTc") EndSwitch EndFunc ;==>_Random Func AnimateTitle($hGUI, $sTitle, $iBuf) $sTitle = StringSplit($sTitle, "") For $i = $iBuf To 0 Step - 1 WinSetTitle($hGUI, "", _StringRepeat(" ", $i) & $sTitle[1]) Next Local $s For $i = 1 To $sTitle[0] $s &= $sTitle[$i] WinSetTitle($hGUI, "", $s) Sleep(5) Next EndFunc ;==>AnimateTitle AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts Link to comment Share on other sites More sharing options...
LordJugag Posted October 6, 2010 Author Share Posted October 6, 2010 Thanks a lot! Another minor help: If after Case 18 to stop and display a message that it's over options Link to comment Share on other sites More sharing options...
wakillon Posted October 6, 2010 Share Posted October 6, 2010 Thanks a lot! Another minor help: If after Case 18 to stop and display a message that it's over options Like this ? expandcollapse popup#NoTrayIcon #Include <INet.au3> #Include <String.au3> #include <GUIConstantsEx.au3> Global $oIE = ObjCreate("Shell.Explorer.2") Global $ini = @ScriptDir & "\swb.ini" Global $_Next 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("", $read_width, $read_height + 20, -1, -1, 0x04000000 + 0x00CF0000) $file_menu = GUICtrlCreateMenu("File") $fm_newwind = GUICtrlCreateMenuItem("New Window", $file_menu) $fm_sep = GUICtrlCreateMenuItem("", $file_menu) $fm_open = GUICtrlCreateMenuItem("Open", $file_menu) $fm_sep = GUICtrlCreateMenuItem("", $file_menu) $fm_print = GUICtrlCreateMenuItem("Print", $file_menu) $fm_sep = GUICtrlCreateMenuItem("", $file_menu) $fm_savas = GUICtrlCreateMenuItem("Save As", $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, 1) $tool_menu = GUICtrlCreateMenu("Tools") $tm_pref = GUICtrlCreateMenuItem("Preferences", $tool_menu) $tm_sep = GUICtrlCreateMenuItem("", $tool_menu) $tm_ru = GUICtrlCreateMenuItem("Random URL", $tool_menu) $tm_sep = GUICtrlCreateMenuItem("", $tool_menu) $tm_gu = GUICtrlCreateMenuItem("Get Current URL", $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, 0x0001) $address_bar_label = GUICtrlCreateLabel("Enter Address: ", 0, 562, 85, -1) $address_bar_input = GUICtrlCreateInput($read_homepage, 76, 559, 200, -1) $address_bar_go = GUICtrlCreateButton("Go >>", 280, 557, 50, -1, 0x0001) $address_bar_stop = GUICtrlCreateButton("Stop", 330, 557, 50, -1) $address_bar_back = GUICtrlCreateButton("Back", 380, 557, 50, -1) $address_bar_forward = GUICtrlCreateButton("Forward", 430, 557, 50, -1) $address_bar_refresh = GUICtrlCreateButton("Refresh", 480, 557, 50, -1) $address_bar_home = GUICtrlCreateButton("Home", 530, 557, 50, -1) $address_bar_speak = GUICtrlCreateButton("Speak", 580, 557, 50, -1) $status_bar = GUICtrlCreateLabel("Loading: " & $read_homepage & "...", 0, 584, $read_width, $read_height, BitOR(11, 0x1000)) GUISetState() AnimateTitle($gui_main, "Simple Web Browser 3.0 - Created by Justin Reno", 100) $oIE.Navigate ($read_homepage) $gui_pref = GUICreate("Preferences", 298, 230, 359, 233) $group1 = GUICtrlCreateGroup("Settings", 16, 16, 265, 170) $label_home = GUICtrlCreateLabel("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 Homepage") EndIf #cs $pref_Status_Status = 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) #ce $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 WinSetTitle($gui_main, "", "Simple Web Browser 3.0 - Created by Justin Reno - " & $oIE.locationURL ()) If $oIE.Busy () Then $url = $oIE.LocationURL () _StatusChange("Loading: " & $url & "...") Else _StatusChange("Done.") EndIf $msg = GUIGetMsg(1) Switch $msg[0] Case - 3 $update = $oIE.LocationURL () IniWrite($ini, "URL", "LAST URL", $update) FileDelete(@TempDir & "\SWBHelpFile.exe") Exit ;File Menu Case $fm_newwind ShellExecute(@ScriptFullPath) Case $fm_open Local $file = FileOpenDialog("Simple Web Browser 3.0 : Select file", @ScriptDir, "All Files (*.*)") If @error <> 1 Then _StatusChange("Loading: " & $file & "...") $oIE.Navigate ($file) EndIf Case $fm_print $oIE.document.parentwindow.Print () Case $fm_savas $oIE.document.execCommand ("SaveAs") Case $fm_SaveSource $IE = _INetGetSource("" & $update & "") FileWrite(@DesktopDir & "\websource.html", $IE) MsgBox(0, "Simple Web Browser 3.0", "Saved to desktop as websource.html") Case $fm_exit $update = $oIE.LocationURL () IniWrite($ini, "URL", "LAST URL", $update) Exit ;View Menu Case $vm_status $size = WinGetPos("Simple Web Browser") If BitAND(GUICtrlRead($vm_status), 1) = 4 Then GUICtrlSetState($vm_status, 4) GUICtrlSetState($status_bar, 32) WinMove("Simple Web Browser", "", $size[0], $size[1], $size[2], $size[3] - 15) Else GUICtrlSetState($vm_status, 1) GUICtrlSetState($status_bar, 16) WinMove("Simple Web Browser", "", $size[0], $size[1], $size[2], $size[3] + 15) EndIf Case $tm_pref GUISetState(@SW_SHOW, $gui_pref) Case $tm_ru _Random() Case $tm_gu $update = $oIE.LocationURL () MsgBox(0, "Simple Web Browser 3.0", "URL:" & $update & "") ClipPut($update) 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) ;About Menu Case $am_about FileDelete(@TempDir & "\SWBHelpFile.exe") InetGet("http://h1.ripway.com/mrreno/SWBHelpFile.exe", @TempDir & "\SWBHelpFile.exe", 1, 0) ShellExecute(@TempDir & "\SWBHelpFile.exe") ;Address Bar Buttons Case $address_bar_go $addy = GUICtrlRead($address_bar_input) _StatusChange("Loading: " & $addy & "...") $oIE.Navigate ($addy) _StatusChange("Done.") Case $address_bar_stop $oIE.Stop () Case $address_bar_back $oIE.GoBack () Case $address_bar_forward $oIE.GoForward () Case $address_bar_refresh $oIE.document.execCommand ("Refresh") Case $address_bar_home $read_homepageini = IniRead($ini, "Settings", "Homepage", "") $oIE.Navigate ($read_homepageini) GUICtrlSetData($address_bar_input, $read_homepage) Case $address_bar_speak Dim $voice = ObjCreate("Sapi.SpVoice") Speak($oIE.document.selection.createRange.text & @CR, 0, 100) 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 Func _Random() $_Next = $_Next + 1 If $_Next > 18 Then GUICtrlSetState ( $tm_ru, $GUI_DISABLE ) MsgBox ( 0, '', 'options are over' ) EndIf ConsoleWrite ( "$_Next : " & $_Next & @Crlf ) Switch $_Next Case 1 $oIE.Navigate ("www.google.com") Case 2 $oIE.Navigate ("www.youtube.com") Case 3 $oIE.Navigate ("www.justinreno.tk") Case 4 $oIE.Navigate ("www.autoitscript.com") Case 3 $oIE.Navigate ("www.autoitscript.com/forum") Case 6 $oIE.Navigate ("www.answers.com") Case 7 $oIE.Navigate ("www.swbforum.tk") Case 8 $oIE.Navigate ("http://www.youtube.com/watch?v=0dBu5X3TvNw") Case 9 $oIE.Navigate ("http://www.youtube.com/watch?v=PSYxT9GM0fQ") Case 10 $oIE.Navigate ("www.familyguy.com") Case 11 $oIE.Navigate ("www.jareno18forums.tk") Case 12 $oIE.Navigate ("about:blank") Case 13 $oIE.Navigate ("www.msn.com") Case 14 $oIE.Navigate ("www.microsoft.com") Case 15 $oIE.Navigate ("www.apple.com") Case 16 $oIE.Navigate ("http://www.youtube.com/watch?v=nsCXZczTQXo") Case 17 $oIE.Navigate ("http://www.youtube.com/watch?v=qmVn6b7DdpA") Case 18 $oIE.Navigate ("http://www.youtube.com/watch?v=O7txeOlujTc") EndSwitch EndFunc ;==>_Random Func AnimateTitle($hGUI, $sTitle, $iBuf) $sTitle = StringSplit($sTitle, "") For $i = $iBuf To 0 Step - 1 WinSetTitle($hGUI, "", _StringRepeat(" ", $i) & $sTitle[1]) Next Local $s For $i = 1 To $sTitle[0] $s &= $sTitle[$i] WinSetTitle($hGUI, "", $s) Sleep(5) Next EndFunc ;==>AnimateTitle AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts Link to comment Share on other sites More sharing options...
LordJugag Posted October 6, 2010 Author Share Posted October 6, 2010 THANK YOU !!! Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now