alien13 Posted March 13, 2007 Share Posted March 13, 2007 Hello, (Ill add pictures to understand easier) OK. What I have is a setup window with 6 input boxes, as shown here: The users put in the link to the site. eg - http://www.google.com.au The name. eg - Google.com.au They do this for all or any and click save. It saves this information to the .ini file and once they have restarted it will show up in the websites tab, shown here: It works fine except for I can't get it so that when I click the button it launches the browser(works) and opens the website written in the .ini file(not working). Basically I can't get the script to read the website link written in the .ini file. Here is my script.. its a bit messy=S CODE#include <GUIConstants.au3> #include <Launcher Files\Updater\INetUpdater.au3> #include <Constants.au3> Opt("TrayOnEventMode",1) Opt("TrayMenuMode",1) TraySetOnEvent($TRAY_EVENT_PRIMARYUP,"SpecialEvent") ;TraySetState(2) ; hide --> not needed $Label_1 = IniRead(@ScriptDir & "\Launcher Files\Info Files\Config.ini", "Label", "1", "") $Label_2 = IniRead(@ScriptDir & "\Launcher Files\Info Files\Config.ini", "Label", "2", "") $Label_3 = IniRead(@ScriptDir & "\Launcher Files\Info Files\Config.ini", "Label", "3", "") $Label_4 = IniRead(@ScriptDir & "\Launcher Files\Info Files\Config.ini", "Label", "4", "") $Label_5 = IniRead(@ScriptDir & "\Launcher Files\Info Files\Config.ini", "Label", "5", "") $Names1 = IniRead(@ScriptDir & "\Launcher Files\Info Files\Config.ini", "Names", "1", "") $Names2 = IniRead(@ScriptDir & "\Launcher Files\Info Files\Config.ini", "Names", "2", "") $Names3 = IniRead(@ScriptDir & "\Launcher Files\Info Files\Config.ini", "Names", "3", "") $Links1 = IniRead(@ScriptDir & "\Launcher Files\Info Files\Config.ini", "Links", "1", "") $Links2 = IniRead(@ScriptDir & "\Launcher Files\Info Files\Config.ini", "Links", "2", "") $Links3 = IniRead(@ScriptDir & "\Launcher Files\Info Files\Config.ini", "Links", "3", "") $MainWindow = GUICreate("Launcher", 415, 290) $Tab1 = GUICtrlCreateTab(0, 0, 417, 273) $Programs = GUICtrlCreateTabItem("Programs") ;===>Programs Tab Global $Labels1 = GUICtrlCreateLabel($Label_1, 120, 80, 105, 17, $SS_CENTER + $SS_SUNKEN) ; Program 1 Name $Program_1 = GUICtrlCreateButton("Launch", 237, 80, 70, 17) ; Launch Program 1 Global $Labels2 = GUICtrlCreateLabel($Label_2, 120, 110, 105, 17, $SS_CENTER + $SS_SUNKEN); Program 2 Name $Program_2 = GUICtrlCreateButton("Launch", 237, 110, 70, 17) ; Launch Program 2 Global $Labels3 = GUICtrlCreateLabel($Label_3, 120, 140, 105, 17, $SS_CENTER + $SS_SUNKEN); Program 3 Name $Program_3 = GUICtrlCreateButton("Launch", 237, 140, 70, 17) ; Launch Program 3 Global $Labels4 = GUICtrlCreateLabel($Label_4, 120, 170, 105, 17, $SS_CENTER + $SS_SUNKEN); Program 4 Name $Program_4 = GUICtrlCreateButton("Launch", 237, 170, 70, 17) ; Launch Program 4 Global $Labels5 = GUICtrlCreateLabel($Label_5, 120, 200, 105, 17, $SS_CENTER + $SS_SUNKEN); Program 5 Name $Program_5 = GUICtrlCreateButton("Launch", 237, 200, 70, 17) ; Launch Program 5 $BrowserPath = IniRead(@ScriptDir & "\Launcher Files\Info Files\Config.ini", "Launch", "1", "") $Program1Path = IniRead(@ScriptDir & "\Launcher Files\Info Files\Config.ini", "Launch", "2", "") $Program2Path = IniRead(@ScriptDir & "\Launcher Files\Info Files\Config.ini", "Launch", "3", "") $Program3Path = IniRead(@ScriptDir & "\Launcher Files\Info Files\Config.ini", "Launch", "4", "") $Program4Path = IniRead(@ScriptDir & "\Launcher Files\Info Files\Config.ini", "Launch", "5", "") $Program5Path = IniRead(@ScriptDir & "\Launcher Files\Info Files\Config.ini", "Launch", "6", "") $Websites = GUICtrlCreateTabItem("Websites") ;===>Websites Tab $Site1 = GUICtrlCreateButton($Names1, 105, 50, 220, 20) $Site2 = GUICtrlCreateButton($Names2, 105, 80, 220, 20) $Site3 = GUICtrlCreateButton($Names3, 105, 110, 220, 20) $Website = GuiCtrlCreateInput("www.", 105, 140, 170, 20) ; Custom site $GO = GuiCtrlCreateButton("Go", 275, 140, 50, 20) ; Go button $Google = GuiCtrlCreateInput("Google Search", 105, 170, 170, 20) ;Google search $GoogleGO = GuiCtrlCreateButton("Go", 275, 170, 50, 20) ;Google search go button $Thottbot = GuiCtrlCreateInput("Thottbot Search", 105, 200, 170, 20) ;Thottbot search $TBGO = GuiCtrlCreateButton("Go", 275, 200, 50, 20) ;Thottbot search go button $WoWHead = GuiCtrlCreateInput("WoWHead Search", 105, 230, 170, 20) ;WoWHead search $WoWHeadGO = GuiCtrlCreateButton("Go", 275, 230, 50, 20) ;WoWHead search go button GUICtrlCreateTabItem("") $File = GUICtrlCreateMenu("File") $Exit = GUICtrlCreateMenuItem("Exit", $File) $Options = GUICtrlCreateMenu("Options") $Setup = GUICtrlCreateMenuItem("Setup", $Options) $Update = GUICtrlCreateMenuItem("Update", $Options) $Help = GUICtrlCreateMenu("Help") $About = GUICtrlCreateMenuItem("About", $Help) $Email = GUICtrlCreateMenuitem("Email", $Help) $Thanks = GUICtrlCreateMenuitem("Thanks", $Help) GUISetState(@SW_SHOW) While 1 $tmsg = TrayGetMsg() $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $GUI_EVENT_MINIMIZE GuiSetState(@SW_HIDE) TraySetState(1) ; show TraySetToolTip ("Launcher - Click to restore") Case $Exit ExitLoop Case $Setup Setup() Case $Update Update() Case $About About() Case $Thanks Thanks() Case $Email Email() Case $Program_1 Run($Program1Path) Case $Program_2 Run($Program2Path) Case $Program_3 Run($Program3Path) Case $Program_4 Run($Program4Path) Case $Program_5 Run($Program5Path) Case $Site1 Run($BrowserPath) Case $Site2 Run($BrowserPath) Case $Site3 Run($BrowserPath) Case $GO $site = GUICtrlRead ($Website) Run($BrowserPath & " http://" & $site) Sleep(3000) Case $GoogleGO $site = GUICtrlRead ($Google) Run($BrowserPath & " http://www.google.com.au/search?q=" & StringReplace($Site, " ", "+")) Sleep(3000) Case $TBGO $site = GUICtrlRead ($Thottbot) Run($BrowserPath & " http://www.thottbot.com/?s=" & StringReplace($Site, " ", "+")) Sleep(3000) Case $WoWHeadGO $site = GUICtrlRead ($WoWHead) Run($BrowserPath & " http://www.wowhead.com/?search=" & StringReplace($Site, " ", "+")) Sleep(3000) EndSwitch WEnd Func SpecialEvent() GuiSetState(@SW_Show) TraySetState(2) ; hide EndFunc Func Setup() GUISetState(@SW_HIDE, $MainWindow) $BrowserDir = IniRead(@ScriptDir & "\Launcher Files\Info Files\Config.ini", "Launch", "1", "") $Program1Dir = IniRead(@ScriptDir & "\Launcher Files\Info Files\Config.ini", "Launch", "2", "") $Program2Dir = IniRead(@ScriptDir & "\Launcher Files\Info Files\Config.ini", "Launch", "3", "") $Program3Dir = IniRead(@ScriptDir & "\Launcher Files\Info Files\Config.ini", "Launch", "4", "") $Program4Dir = IniRead(@ScriptDir & "\Launcher Files\Info Files\Config.ini", "Launch", "5", "") $Program5Dir = IniRead(@ScriptDir & "\Launcher Files\Info Files\Config.ini", "Launch", "6", "") $Label1name = IniRead(@ScriptDir & "\Launcher Files\Info Files\Config.ini", "Label", "1", "") $Label2name = IniRead(@ScriptDir & "\Launcher Files\Info Files\Config.ini", "Label", "2", "") $Label3name = IniRead(@ScriptDir & "\Launcher Files\Info Files\Config.ini", "Label", "3", "") $Label4name = IniRead(@ScriptDir & "\Launcher Files\Info Files\Config.ini", "Label", "4", "") $Label5name = IniRead(@ScriptDir & "\Launcher Files\Info Files\Config.ini", "Label", "5", "") $SiteName1 = IniRead(@ScriptDir & "\Launcher Files\Info Files\Config.ini", "Names", "1", "") $SiteName2 = IniRead(@ScriptDir & "\Launcher Files\Info Files\Config.ini", "Names", "2", "") $SiteName3 = IniRead(@ScriptDir & "\Launcher Files\Info Files\Config.ini", "Names", "3", "") $LinkNames1 = IniRead(@ScriptDir & "\Launcher Files\Info Files\Config.ini", "Links", "1", "") $LinkNames2 = IniRead(@ScriptDir & "\Launcher Files\Info Files\Config.ini", "Links", "2", "") $LinkNames3 = IniRead(@ScriptDir & "\Launcher Files\Info Files\Config.ini", "Links", "3", "") $ProgramSetupWindow = GUICreate("Setup", 400,430) $Tab2 = GUICtrlCreateTab(0, 0, 400, 430) $ProgramsTab = GUICtrlCreateTabItem("Programs") ;===>Programs Tab GUICtrlCreateLabel("Browser Path:", 50,52,60,30) Global $Browser = GUICtrlCreateInput($BrowserDir,110,47,200,20,-1) $FileOpenDialog_button1 = GUICtrlCreateButton("Browse", 320, 47, 50, 20) Global $Program_1 = GUICtrlCreateInput($Program1Dir,110,89,200,20,-1) Global $Label_1a = GUICtrlCreateInput($Label1name,110,113,150,20,-1) $FileOpenDialog_button3 = GUICtrlCreateButton("Browse", 320, 89, 50, 20) GUICtrlCreateLabel("Program:",50,91,60,20) GUICtrlCreateLabel("Name:", 50,116,60,20) Global $Program_2 = GUICtrlCreateInput($Program2Dir,110,147,200,20,-1) Global $Label_2a = GUICtrlCreateInput($Label2name,110,171,150,20,-1) $FileOpenDialog_button4 = GUICtrlCreateButton("Browse", 320, 147, 50, 20) GUICtrlCreateLabel("Name:", 50,173,60,20) GUICtrlCreateLabel("Program:",50, 149,60,20) Global $Program_3 = GUICtrlCreateInput($Program3Dir,110,205,200,20,-1) Global $Label_3a = GUICtrlCreateInput($Label3name,110,229,150,20,-1) $FileOpenDialog_button5 = GUICtrlCreateButton("Browse", 320, 205, 50, 20) GUICtrlCreateLabel("Name:", 50,231,60,20) GUICtrlCreateLabel("Program:",50, 207,60,20) Global $Program_4 = GUICtrlCreateInput($Program4Dir,110,263,200,20,-1) Global $Label_4a = GUICtrlCreateInput($Label4name,110,287,150,20,-1) $FileOpenDialog_button6 = GUICtrlCreateButton("Browse", 320, 263, 50, 20) GUICtrlCreateLabel("Program:",50,265,60,20) GUICtrlCreateLabel("Name:", 50,289,60,20) Global $Program_5 = GUICtrlCreateInput($Program5Dir,110,321,200,20,-1) Global $Label_5a = GUICtrlCreateInput($Label5name,110,345,150,20,-1) $FileOpenDialog_button7 = GUICtrlCreateButton("Browse", 320, 321, 50, 20) GUICtrlCreateLabel("Program:",50,323,60,20) GUICtrlCreateLabel("Name:", 50,347,60,20) $okbutton = GUICtrlCreateButton("Save",180,370,40) GUICtrlSetOnEvent($okbutton,"OKButton") $WebsitesTab = GUICtrlCreateTabItem("Websites") ;===>Websites Tab $SiteLabel1 = GuiCtrlCreateLabel("Website Link 1", 160, 50) Global $LinkSite1 = GuiCtrlCreateInput($LinkNames1, 100, 80, 200, 20) Global $LinkName1 = GuiCtrlCreateInput($SiteName1, 100, 110, 200, 20) $SiteLabel2 = GuiCtrlCreateLabel("Website Link 2", 160, 140) Global $LinkSite2 = GuiCtrlCreateInput($LinkNames2, 100, 170, 200, 20) Global $LinkName2 = GuiCtrlCreateInput($SiteName2, 100, 200, 200, 20) $SiteLabel3 = GuiCtrlCreateLabel("Website Link 3", 160, 230) Global $LinkSite3 = GuiCtrlCreateInput($LinkNames3, 100, 260, 200, 20) Global $LinkName3 = GuiCtrlCreateInput($SiteName3, 100, 290, 200, 20) $okbutton = GUICtrlCreateButton("Save",180,370,40) GUICtrlSetOnEvent($okbutton,"OKButton") GUISetState(@SW_SHOW) While 2 $msg2 = GUIGetMsg() Select Case $msg2 = $GUI_EVENT_CLOSE Exitloop Case $msg2 = $okbutton OKButton() Case $msg2 = $FileOpenDialog_button1 $location1 = FileOpenDialog("Please select Path to your Internet Browser.", @ProgramFilesDir,"Executables (*.exe)",1 + 2) If @error = 1 Then WinKill ("Please select a file to launch.") WinActivate ("Setup") EndIf GUICtrlSetData ($Browser,$location1) Case $msg2 = $FileOpenDialog_button3 $location3 = FileOpenDialog("Please select a file to launch.", @ProgramFilesDir,"Executables (*.exe)",1 + 2) If @error = 1 Then WinKill ("Please select a file to launch.") WinActivate ("Setup") EndIf GUICtrlSetData ($Program_1,$location3) Case $msg2 = $FileOpenDialog_button4 $location4 = FileOpenDialog("Please select a file to launch.", @ProgramFilesDir,"Executables (*.exe)",1 + 2) If @error = 1 Then WinKill ("Please select a file to launch.") WinActivate ("Setup") EndIf GUICtrlSetData ($Program_2,$location4) Case $msg2 = $FileOpenDialog_button5 $location5 = FileOpenDialog("Please select a file to launch.", @ProgramFilesDir,"Executables (*.exe)",1 + 2) If @error = 1 Then WinKill ("Please select a file to launch.") WinActivate ("Setup") EndIf GUICtrlSetData ($Program_3,$location5) Case $msg2 = $FileOpenDialog_button6 $location6 = FileOpenDialog("Please select a file to launch.", @ProgramFilesDir,"Executables (*.exe)",1 + 2) If @error = 1 Then WinKill ("Please select a file to launch.") WinActivate ("Setup") EndIf GUICtrlSetData ($Program_4,$location6) Case $msg2 = $FileOpenDialog_button7 $location7 = FileOpenDialog("Please select a file to launch.", @ProgramFilesDir,"Executables (*.exe)",1 + 2) If @error = 1 Then WinKill ("Please select a file to launch.") WinActivate ("Setup") EndIf GUICtrlSetData ($Program_5,$location7) EndSelect WEnd GUIDelete($ProgramSetupWindow) GUISetState(@SW_SHOW, $MainWindow) EndFunc ;==>Setup Func OKButton() IniWrite(@ScriptDir & "\Launcher Files\Info Files\Config.ini", "Launch", "1", GUICtrlRead($Browser)) Iniwrite(@ScriptDir & "\Launcher Files\Info Files\Config.ini", "Launch", "2", GUICtrlRead($Program_1)) IniWrite(@ScriptDir & "\Launcher Files\Info Files\Config.ini", "Launch", "3", GUICtrlRead($Program_2)) IniWrite(@ScriptDir & "\Launcher Files\Info Files\Config.ini", "Launch", "4", GUICtrlRead($Program_3)) IniWrite(@ScriptDir & "\Launcher Files\Info Files\Config.ini", "Launch", "5", GUICtrlRead($Program_4)) IniWrite(@ScriptDir & "\Launcher Files\Info Files\Config.ini", "Launch", "6", GUICtrlRead($Program_5)) IniWrite(@ScriptDir & "\Launcher Files\Info Files\Config.ini", "Label", "1", GUICtrlRead($Label_1a)) IniWrite(@ScriptDir & "\Launcher Files\Info Files\Config.ini", "Label", "2", GUICtrlRead($Label_2a)) IniWrite(@ScriptDir & "\Launcher Files\Info Files\Config.ini", "Label", "3", GUICtrlRead($Label_3a)) IniWrite(@ScriptDir & "\Launcher Files\Info Files\Config.ini", "Label", "4", GUICtrlRead($Label_4a)) IniWrite(@ScriptDir & "\Launcher Files\Info Files\Config.ini", "Label", "5", GUICtrlRead($Label_5a)) IniWrite(@ScriptDir & "\Launcher Files\Info Files\Config.ini", "Links", "1", GUICtrlRead($LinkSite1)) IniWrite(@ScriptDir & "\Launcher Files\Info Files\Config.ini", "Links", "2", GUICtrlRead($LinkSite2)) IniWrite(@ScriptDir & "\Launcher Files\Info Files\Config.ini", "Links", "3", GUICtrlRead($LinkSite3)) IniWrite(@ScriptDir & "\Launcher Files\Info Files\Config.ini", "Names", "1", GUICtrlRead($LinkName1)) IniWrite(@ScriptDir & "\Launcher Files\Info Files\Config.ini", "Names", "2", GUICtrlRead($LinkName2)) IniWrite(@ScriptDir & "\Launcher Files\Info Files\Config.ini", "Names", "3", GUICtrlRead($LinkName3)) GUICtrlSetData ($Site1, GUICtrlRead ($LinkName1)) GUICtrlSetData ($Site2, GUICtrlRead ($LinkName2)) GUICtrlSetData ($Site3, GUICtrlRead ($LinkName3)) GUICtrlSetData ($Labels1, GUICtrlRead ($Label_1a)) GUICtrlSetData ($Labels2, GUICtrlRead ($Label_2a)) GUICtrlSetData ($Labels3, GUICtrlRead ($Label_3a)) GUICtrlSetData ($Labels4, GUICtrlRead ($Label_4a)) GUICtrlSetData ($Labels5, GUICtrlRead ($Label_5a)) MsgBox(64, "Setup", "Setup is complete. Please restart for changes to take effect.") EndFunc ;==>OKButton Func Update() SplashTextOn("Launcher", "Checking for updates....", 250, 30, -1, -1, 0) _INetUpdater ("v1.7.1", "http://www.alien13.jumbahost.com/Launcher/CurrentVersion/", "version.ini", "Setup.rar") SplashOff() EndFunc ;==>Update Func About() GUISetState(@SW_HIDE, $MainWindow) $AboutWindow = GuiCreate ("About", 250, 150) $Logo = GUICtrlCreatePic(@ScriptDir & "\Launcher Files\Images\About.jpg", 80, 5, 93, 39) $Info = GUICtrlCreateLabel("Launcher is a small program that is designed to make launching programs and websites easier. ", 20, 55, 230, 50) $CR = GUICtrlCreateLabel("Copyright © 2007 alien13 All Rights reserved.", 20, 100, 230, 20) $HomePage = GuiCtrlCreateButton("Home Page", 95, 120) GUISetState(@SW_SHOW) While 3 $msg3 = GUIGetMsg() Select Case $msg3 = $GUI_EVENT_CLOSE ExitLoop Case $msg3 = $HomePage Run($BrowserPath & " http://www.alien13.jumbahost.com/?page=Launcher") EndSelect WEnd GUIDelete($AboutWindow) GUISetState(@SW_SHOW, $MainWindow) EndFunc ;==>About Func Email() GUISetState(@SW_HIDE, $MainWindow) $EmailWindow = GuiCreate ("Email", 170, 50) $My_Email = GUICtrlCreateLabel("If you have any suggestions or feedback you can email me at: jimbeam14@gmail.com", 10, 5, 160, 40) GUISetState(@SW_SHOW) While 4 $msg4 = GUIGetMsg() Select Case $msg4 = $GUI_EVENT_CLOSE ExitLoop EndSelect WEnd GUIDelete($EmailWindow) GUISetState(@SW_SHOW, $MainWindow) EndFunc ;==>Email Func Thanks() GUISetState(@SW_HIDE, $MainWindow) $ThanksWindow = GuiCreate ("Thanks!", 240, 60) $Thanks = GUICtrlCreateLabel("I would like to thank Phantom, Paulie, Valuater and Psibernetic for helping me with some coding problems.", 10, 5, 230, 50) GUISetState(@SW_SHOW) While 5 $msg5 = GUIGetMsg() Select Case $msg5 = $GUI_EVENT_CLOSE ExitLoop EndSelect WEnd GUIDelete($ThanksWindow) GUISetState(@SW_SHOW, $MainWindow) EndFunc ;==> Thanks for the help guys/girls =) alien13 Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted March 13, 2007 Moderators Share Posted March 13, 2007 Try ShellExecute() and or take a look at http://www.autoitscript.com/forum/index.php?showtopic=30777 for "Run" options with URLs. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
CrewXp Posted March 13, 2007 Share Posted March 13, 2007 (edited) Yikes!! The program is not very dynamic and clean. Well to start, Add this as a function somewhere in your code: Func _OpenWeb($URL) $oWeb = ObjCreate("Shell.Application") $oWeb.Open($URL) EndFunc The code above is a function used to open a webpage, just like you want. It's better than what you had in mostly a sense that maybe some other users have different browsers and don't really want to configure the location where theirs is at.... That and.. it works! Code Example: _OpenWeb("http://www.crewxp.com") Or in to be used with the variable in that part of your program.... _OpenWeb("http://"&$site) That's a much better way of doing it... and your ini seems to work just fine, a little messy, but fine to me. ps: Fix all those long folder paths, and use some dircreate's to make the folders if they don't exist. I'm out.. Been up 30 hours straight... (with 2 hours sleep) Edited March 13, 2007 by CrewXp Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted March 13, 2007 Moderators Share Posted March 13, 2007 Yeah, that web open is actually in the link I sent you too... but I'm modding the function a bit anyway right now. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
alien13 Posted March 13, 2007 Author Share Posted March 13, 2007 Cool thanks for the help. I managed to get it to work =) heheh, yeah Its a bit messy but It's easy to find it all for me 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