Sign in to follow this  
Followers 0
alien13

Opening a Site from Program?

6 posts in this topic

Hi,

I was wondering if it was possible to open a website that was entered in the input box?

I tried the following: (this is my websites window) - I have highlighted the parts in red =)

CODE
Func WebSites()

GUISetState(@SW_HIDE, $XSkinGui)

$XSkin2 = XSkinGuiCreate ("Websites", 358, 340, $Skin_Folder)

$XIcon2 = XSkinIcon ($XSkin2, 1)

$WoWSiteFF = GUICtrlCreateButton("WoW Site FireFox", 70, 50, 220, 20)

$WoWSiteIE = GUICtrlCreateButton("WoW Site Internet Explorer", 70, 80, 220, 20)

$warSiteFF = GUICtrlCreateButton("WorldofWar.net FireFox", 70, 110, 220, 20)

$warSiteIE = GUICtrlCreateButton("WorldofWar.net Internet Explorer", 70, 140, 220, 20)

$CurseFF = GUICtrlCreateButton("Curse-Gaming FireFox", 70, 170, 220, 20)

$CurseIE = GUICtrlCreateButton("Curse-Gaming Internet Explorer", 70, 200, 220, 20)

$WebsiteFF = GuiCtrlCreateInput("Firefox", 70, 230, 180, 20) ;Firefox custom site

$FFGO = GuiCtrlCreateButton("Go", 250, 230, 40, 20) ;FF go button

$WebsiteIE = GuiCtrlCreateInput("Internet Explorer", 70, 260, 180, 20) ;Internet Explorer custom site

$IEGO = GuiCtrlCreateButton("Go", 250, 260, 40, 20) ;IE go button

GUISetState(@SW_SHOW)

While 2

$msg2 = GUIGetMsg()

Select

Case $msg2 = $XIcon2[1]

ExitLoop

Case $msg2 = $WoWSiteIE

Run($IEPath & " http://www.worldofwarcraft.com")

Case $msg2 = $WoWSiteFF

Run($FFPath & " http://www.worldofwarcraft.com")

Case $msg2 = $warSiteIE

Run($IEPath & " http://www.worldofwar.net")

Case $msg2 = $warSiteFF

Run($FFPath & " http://www.worldofwar.net")

Case $msg2 = $CurseFF

Run($FFPath & " http://www.curse-gaming.com")

Case $msg2 = $CurseFF

Run($IEPath & " http://www.curse-gaming.com")

Case $msg2 = $FFGO

Run($FFPath)

Sleep(3000)

MouseClick( "Left", 556, 62, 1, 1)

Send ($WebsiteFF)

Case $msg2 = $IEGO

Run($IEPath)

Sleep(3000)

MouseClick( "Left", 568, 43, 1, 1)

Send ($WebsiteIE)

EndSelect

WEnd

GUIDelete($XSkin2)

GUISetState(@SW_SHOW, $XSkinGui)

EndFunc ;==>WebSites

I Made it so the mouse clicks in the address box, because I can't think of another way to get it to go in there. The only problem is it might not work on other peoples computers, as the address box might be in another area.

With another section of my program I have a Setup window where users can input the directory of their programs and it saves to the Config.ini file.

I tried adding this to my program but It keeps coming up with an error =(

So I put it into its own window and now the script loads the separate program but it doesn't write to the ini file for some reason.

Here is my program. To see what I mean extract the "Launcher v1.0" folder to where you want and run the Launcher v1.0.au3 file. When you run the Setup program from inside launcher it wont write to the ini file, but when you run the Setup.exe file inside the "Launcher Files" folder it does.

Sorry if that sounds confusing, if you don't understand it I'll try re-phrase it :)

Thanks, alien13

BTW The program is on my site as its too big to put on here =S


Share this post


Link to post
Share on other sites



im not sure if this is what u ment but.. here it is

Case $msg2 = $FFGO
    $site = GUICtrlRead ($WebsiteFF)
    Run($FFPath & " http://" & $site)       
    Sleep(3000)
Case $msg2 = $IEGO
    $site = GUICtrlRead ($WebsiteIE)
    Run($IEPath & " http://" & $site)       
    Sleep(3000)

Share this post


Link to post
Share on other sites

Yes, that's it, thats perfect. Thanks for that =D


Share this post


Link to post
Share on other sites

OK,

I am working on Launcher v1 but I'm having a few problems. A user suggested that I should have a browse button to search for the programs, that was easy to put in, but I'm stuck on how to get it to put the file location into the input box. (I have the FileOpenDialog code in red).

Users have the ability to choose 5 programs, How would I make it set the path for each separate file. I am stuck on how to do both of these. Each Section for them to choose a program and name is in red and is separate from other code.

CODE
Func FileOpenDialog_button()

FileOpenDialog("Please select a file to launch.", @ProgramFilesDir,"Executables (*.exe)",1 + 2)

EndFunc ;===> Browse

Func Setup()

$IEDir = IniRead("Launcher Files\Info Files\Config.ini", "Launch", "1", "")

$FFDir = IniRead("Launcher Files\Info Files\Config.ini", "Launch", "2", "")

$Program1Dir = IniRead("Launcher Files\Info Files\Config.ini", "Launch", "3", "")

$Program2Dir = IniRead("Launcher Files\Info Files\Config.ini", "Launch", "4", "")

$Program3Dir = IniRead("Launcher Files\Info Files\Config.ini", "Launch", "5", "")

$Program4Dir = IniRead("Launcher Files\Info Files\Config.ini", "Launch", "6", "")

$Program5Dir = IniRead("Launcher Files\Info Files\Config.ini", "Launch", "7", "")

$Label1name = IniRead("Launcher Files\Info Files\Config.ini", "Label", "1", "")

$Label2name = IniRead("Launcher Files\Info Files\Config.ini", "Label", "2", "")

$Label3name = IniRead("Launcher Files\Info Files\Config.ini", "Label", "3", "")

$Label4name = IniRead("Launcher Files\Info Files\Config.ini", "Label", "4", "")

$Label5name = IniRead("Launcher Files\Info Files\Config.ini", "Label", "5", "")

Opt("GUIOnEventMode", 1)

$XSkin5 = XSkinGUICreate("Setup", 400,400, $Skin_Folder)

$XIcon5 = XSkinIcon ($XSkin5, 1)

GUICtrlCreateLabel("IE Path:", 50,52,60,30)

Global $IE = GUICtrlCreateInput($IEDir,110,47,200,20,-1)

$FileOpenDialog_button = GUICtrlCreateButton("Browse", 320, 47, 50, 20)

GUICtrlSetOnEvent($FileOpenDialog_button, "FileOpenDialog_button")

GUICtrlCreateLabel("FF Path:",50,80,60,20)

Global $FF = GUICtrlCreateInput($FFDir, 110,75,200 , 20,-1)

$FileOpenDialog_button = GUICtrlCreateButton("Browse", 320, 75, 50, 20)

GUICtrlSetOnEvent($FileOpenDialog_button, "FileOpenDialog_button")

Global $Program_1 = GUICtrlCreateInput($Program1Dir,110,109,200,20,-1)

$Label_1 = GUICtrlCreateInput($Label1name,110,133,150,20,-1)

$FileOpenDialog_button = GUICtrlCreateButton("Browse", 320, 109, 50, 20)

GUICtrlSetOnEvent($FileOpenDialog_button, "FileOpenDialog_button")

GUICtrlCreateLabel("Program:",50,111,60,20)

GUICtrlCreateLabel("Name:", 50,136,60,20)

Global $Program_2 = GUICtrlCreateInput($Program2Dir,110,157,200,20,-1)

$Label_2 = GUICtrlCreateInput($Label2name,110,181,150,20,-1)

$FileOpenDialog_button = GUICtrlCreateButton("Browse", 320, 157, 50, 20)

GUICtrlSetOnEvent($FileOpenDialog_button, "FileOpenDialog_button")

GUICtrlCreateLabel("Name:", 50,183,60,20)

GUICtrlCreateLabel("Program:",50, 159,60,20)

Global $Program_3 = GUICtrlCreateInput($Program3Dir,110,205,200,20,-1)

$Label_3 = GUICtrlCreateInput($Label3name,110,229,150,20,-1)

$FileOpenDialog_button = GUICtrlCreateButton("Browse", 320, 205, 50, 20)

GUICtrlSetOnEvent($FileOpenDialog_button, "FileOpenDialog_button")

GUICtrlCreateLabel("Name:", 50,231,60,20)

GUICtrlCreateLabel("Program:",50, 207,60,20)

Global $Program_4 = GUICtrlCreateInput($Program4Dir,110,253,200,20,-1)

$Label_4 = GUICtrlCreateInput($Label4name,110,277,150,20,-1)

$FileOpenDialog_button = GUICtrlCreateButton("Browse", 320, 257, 50, 20)

GUICtrlSetOnEvent($FileOpenDialog_button, "FileOpenDialog_button")

GUICtrlCreateLabel("Program:",50,255,60,20)

GUICtrlCreateLabel("Name:", 50,279,60,20)

Global $Program_5 = GUICtrlCreateInput($Program5Dir,110,301,200,20,-1)

$Label_5 = GUICtrlCreateInput($Label5name,110,325,150,20,-1)

$FileOpenDialog_button = GUICtrlCreateButton("Browse", 320, 301, 50, 20)

GUICtrlSetOnEvent($FileOpenDialog_button, "FileOpenDialog_button")

GUICtrlCreateLabel("Program:",50,303,60,20)

GUICtrlCreateLabel("Name:", 50,327,60,20)

$okbutton = GUICtrlCreateButton("Set",160,350,40)

GUICtrlSetOnEvent($okbutton,"OKButton")

$exitbutton=GUICtrlCreateButton("Exit",200,350,40)

GUICtrlSetOnEvent($exitbutton,"EXITButton")

GUISetOnEvent($GUI_EVENT_CLOSE,"CLOSEClicked")

GUISetState(@SW_SHOW)

While 5

$msg5 = GUIGetMsg()

Select

Case $msg5 = $XIcon5[1]

Exitloop

Case $msg5 = $okbutton

OKButton()

Case $msg5 = $FileOpenDialog_button() ; IS THIS RIGHT? IT WORKS BUT IT DOESN'T LOOK RIGHT?!?

EndSelect

WEnd

GUIDelete($XSkin5)

GUISetState(@SW_SHOW, $XSkinGui)

EndFunc ;==>Setup

Func OKButton()

IniWrite("Launcher Files\Info Files\Config.ini", "Launch", "1", GUICtrlRead($IE))

Iniwrite("Launcher Files\Info Files\Config.ini", "Launch", "2", GUICtrlRead($FF))

Iniwrite("Launcher Files\Info Files\Config.ini", "Launch", "3", GUICtrlRead($Program_1))

Iniwrite("Launcher Files\Info Files\Config.ini", "Launch", "4", GUICtrlRead($Program_2))

Iniwrite("Launcher Files\Info Files\Config.ini", "Launch", "5", GUICtrlRead($Program_3))

Iniwrite("Launcher Files\Info Files\Config.ini", "Launch", "6", GUICtrlRead($Program_4))

Iniwrite("Launcher Files\Info Files\Config.ini", "Launch", "7", GUICtrlRead($Program_5))

Iniwrite("Launcher Files\Info Files\Config.ini", "Label", "1", GUICtrlRead($Label_1))

Iniwrite("Launcher Files\Info Files\Config.ini", "Label", "2", GUICtrlRead($Label_2))

Iniwrite("Launcher Files\Info Files\Config.ini", "Label", "3", GUICtrlRead($Label_3))

Iniwrite("Launcher Files\Info Files\Config.ini", "Label", "4", GUICtrlRead($Label_4))

Iniwrite("Launcher Files\Info Files\Config.ini", "Label", "5", GUICtrlRead($Label_5))

MsgBox(64, "Setup", "Setup is complete.")

EndFunc ;==>OKButton

Func EXITButton()

Exit

EndFunc

Func CLOSEClicked()

Exit

EndFunc

Also I can't get my XIcon to work, I want it to close this Setup window and go back to my Main window.

Any help once again is greatly appreciated. Even a link to a thread, guide, etc would be great.

Thanks, alien13


Share this post


Link to post
Share on other sites

Hope this helps. I removed the FileOpenDialog func and made the Path to the .exe the the user selects go into the input box.

Func Setup()
$IEDir = IniRead("Launcher Files\Info Files\Config.ini", "Launch", "1", "")
$FFDir = IniRead("Launcher Files\Info Files\Config.ini", "Launch", "2", "")
$Program1Dir = IniRead("Launcher Files\Info Files\Config.ini", "Launch", "3", "")
$Program2Dir = IniRead("Launcher Files\Info Files\Config.ini", "Launch", "4", "")
$Program3Dir = IniRead("Launcher Files\Info Files\Config.ini", "Launch", "5", "")
$Program4Dir = IniRead("Launcher Files\Info Files\Config.ini", "Launch", "6", "")
$Program5Dir = IniRead("Launcher Files\Info Files\Config.ini", "Launch", "7", "")
$Label1name = IniRead("Launcher Files\Info Files\Config.ini", "Label", "1", "")
$Label2name = IniRead("Launcher Files\Info Files\Config.ini", "Label", "2", "")
$Label3name = IniRead("Launcher Files\Info Files\Config.ini", "Label", "3", "")
$Label4name = IniRead("Launcher Files\Info Files\Config.ini", "Label", "4", "")
$Label5name = IniRead("Launcher Files\Info Files\Config.ini", "Label", "5", "")

$XSkin5 = XSkinGUICreate("Setup", 400,400, $Skin_Folder)
$XIcon5 = XSkinIcon ($XSkin5, 1)

GUICtrlCreateLabel("IE Path:", 50,52,60,30)
Global $IE = GUICtrlCreateInput($IEDir,110,47,200,20,-1)
$FileOpenDialog_button1 = GUICtrlCreateButton("Browse", 320, 47, 50, 20)

GUICtrlCreateLabel("FF Path:",50,80,60,20)
Global $FF = GUICtrlCreateInput($FFDir, 110,75,200 , 20,-1)
$FileOpenDialog_button2 = GUICtrlCreateButton("Browse", 320, 75, 50, 20)

Global $Program_1 = GUICtrlCreateInput($Program1Dir,110,109,200,20,-1)
$Label_1 = GUICtrlCreateInput($Label1name,110,133,150,20,-1)
$FileOpenDialog_button3 = GUICtrlCreateButton("Browse", 320, 109, 50, 20)
GUICtrlCreateLabel("Program:",50,111,60,20)
GUICtrlCreateLabel("Name:", 50,136,60,20)

Global $Program_2 = GUICtrlCreateInput($Program2Dir,110,157,200,20,-1)
$Label_2 = GUICtrlCreateInput($Label2name,110,181,150,20,-1)
$FileOpenDialog_button4 = GUICtrlCreateButton("Browse", 320, 157, 50, 20)
GUICtrlCreateLabel("Name:", 50,183,60,20)
GUICtrlCreateLabel("Program:",50, 159,60,20)

Global $Program_3 = GUICtrlCreateInput($Program3Dir,110,205,200,20,-1)
$Label_3 = 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,253,200,20,-1)
$Label_4 = GUICtrlCreateInput($Label4name,110,277,150,20,-1)
$FileOpenDialog_button6 = GUICtrlCreateButton("Browse", 320, 257, 50, 20)
GUICtrlCreateLabel("Program:",50,255,60,20)
GUICtrlCreateLabel("Name:", 50,279,60,20)

Global $Program_5 = GUICtrlCreateInput($Program5Dir,110,301,200,20,-1)
$Label_5 = GUICtrlCreateInput($Label5name,110,325,150,20,-1)
$FileOpenDialog_button7 = GUICtrlCreateButton("Browse", 320, 301, 50, 20)
GUICtrlCreateLabel("Program:",50,303,60,20)
GUICtrlCreateLabel("Name:", 50,327,60,20)

$okbutton = GUICtrlCreateButton("Set",160,350,40)
GUICtrlSetOnEvent($okbutton,"OKButton")
$exitbutton=GUICtrlCreateButton("Exit",200,350,40)
GUICtrlSetOnEvent($exitbutton,"EXITButton")
GUISetOnEvent($GUI_EVENT_CLOSE,"CLOSEClicked")

GUISetState(@SW_SHOW)
While 5
$msg5 = GUIGetMsg()
    Select
Case $msg5 = $XIcon5[1]
    Exitloop
Case $msg5 = $okbutton
    OKButton()
Case $msg5 = $FileOpenDialog_button1
    $location = FileOpenDialog("Please select Path to Internet Explorer.exe.", @ProgramFilesDir,"Executables (*.exe)",1 + 2)
    If @error = 1 Then 
        WinKill ("Please select a file to launch.")
        WinActivate ("Setup")
    EndIf
    GUICtrlSetData ($IE,$location)
Case $msg5 = $FileOpenDialog_button2
    $location = FileOpenDialog("Please select Path to Firefox.exe.", @ProgramFilesDir,"Executables (*.exe)",1 + 2)
    If @error = 1 Then 
        WinKill ("Please select a file to launch.")
        WinActivate ("Setup")
    EndIf
    GUICtrlSetData ($FF,$location)
Case $msg5 = $FileOpenDialog_button3
    $location = 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,$location)
Case $msg5 = $FileOpenDialog_button4
    $location = 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,$location)
Case $msg5 = $FileOpenDialog_button5
    $location = 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,$location)
Case $msg5 = $FileOpenDialog_button6
    $location = 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,$location)
Case $msg5 = $FileOpenDialog_button7
    $location = 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,$location)
EndSelect
WEnd
GUIDelete($XSkin5)
GUISetState(@SW_SHOW, $XSkinGui)
EndFunc ;==>Setup

Func OKButton()
IniWrite("Launcher Files\Info Files\Config.ini", "Launch", "1", GUICtrlRead($IE))
Iniwrite("Launcher Files\Info Files\Config.ini", "Launch", "2", GUICtrlRead($FF))
Iniwrite("Launcher Files\Info Files\Config.ini", "Launch", "3", GUICtrlRead($Program_1))
Iniwrite("Launcher Files\Info Files\Config.ini", "Launch", "4", GUICtrlRead($Program_2))
Iniwrite("Launcher Files\Info Files\Config.ini", "Launch", "5", GUICtrlRead($Program_3))
Iniwrite("Launcher Files\Info Files\Config.ini", "Launch", "6", GUICtrlRead($Program_4))
Iniwrite("Launcher Files\Info Files\Config.ini", "Launch", "7", GUICtrlRead($Program_5))
Iniwrite("Launcher Files\Info Files\Config.ini", "Label", "1", GUICtrlRead($Label_1))
Iniwrite("Launcher Files\Info Files\Config.ini", "Label", "2", GUICtrlRead($Label_2))
Iniwrite("Launcher Files\Info Files\Config.ini", "Label", "3", GUICtrlRead($Label_3))
Iniwrite("Launcher Files\Info Files\Config.ini", "Label", "4", GUICtrlRead($Label_4))
Iniwrite("Launcher Files\Info Files\Config.ini", "Label", "5", GUICtrlRead($Label_5))
MsgBox(64, "Setup", "Setup is complete.")
EndFunc ;==>OKButton

Func EXITButton()
Exit
EndFunc

Func CLOSEClicked()
Exit
EndFunc

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

Awesome. Thanks so much for this. I will let everyone know that you have helped me with this.

Thanks, alien13 =D

*EDIT* I'm having trouble getting it to write to the ini file after I click browse it seems to only write stuff to the ini if i type it in? How would I go about fixing this?

Or is it just me? Here is a link to it compiled and everything if you want to see.

Edited by alien13

Share this post


Link to post
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
Sign in to follow this  
Followers 0