masonje Posted December 21, 2005 Share Posted December 21, 2005 I'm not able to get this to run correctly. It will compile, and run the GUI, but errors out on the _srvConnect() function The error is attached and below is the code... #include <GuiConstants.au3> $ipParce = StringLeft(@IPAddress1, 6) $homeIPparce = "10.70." ;parced to 6 digits, including decimals $url = "domain.com" $vncPath = "C:\Program Files\RealVNC\VNC4\vncviewer.exe" ;set var to make compiler stop complaining.... $port = "" $server = "" ;Setup GUI GUICreate("VNC Connect", 152, 90, (@DesktopWidth - 152) / 2, (@DesktopHeight - 110) / 2, $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS) $Button_Tower = GUICtrlCreateButton("Tower", 10, 10, 130, 30) $Button_Linux = GUICtrlCreateButton("Server2", 10, 50, 130, 30) Func _srvConnect() ;Determin home or outside network If $ipParce = $homeIPparce Then $run = $vncPath & " " & $server Run($run) Exit Else $run = $vncPath & " " & $url & ':' & $port Run($run) Exit EndIf Exit EndFunc ;==>_srvConnect ;Start GUI GUISetState() While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $Button_Tower ;set port and server infor for Button_1 $port = "4444" $server = "10.70.1.11" ;Connect to server _srvConnect($port & $server) Case $msg = $Button_Linux ;set port and server infor for Button_2 $port = "5555" $server = "10.70.1.12" ;Connect to server _srvConnect($port & $server) EndSelect WEnd Exit PS, the personal stuff has all been changed, so don't bother! Also I attached my real source file so it can be read w/ the tabs.guiconnect_posted.au3 Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted December 21, 2005 Moderators Share Posted December 21, 2005 (edited) Does this help? expandcollapse popup#include <GuiConstants.au3> Dim $ipParce = StringLeft(@IPAddress1, 6) Dim $homeIPparce = "10.70.";parced to 6 digits, including decimals Dim $url = "domain.com" Dim $vncPath = "C:\Program Files\RealVNC\VNC4\vncviewer.exe" ;set var to make compiler stop complaining.... Dim $port = "" Dim $server = "" ;Setup GUI GUICreate("VNC Connect", 152, 90, (@DesktopWidth - 152) / 2, (@DesktopHeight - 110) / 2, $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS) $Button_Tower = GUICtrlCreateButton("Tower", 10, 10, 130, 30) $Button_Linux = GUICtrlCreateButton("Server2", 10, 50, 130, 30) Func _srvConnect(ByRef $vncPath, ByRef $port, ByRef $server, ByRef $url, ByRef $homeIPparce, ByRef $ipParce) ;Determin home or outside network If $ipParce = $homeIPparce Then $run = $vncPath & " " & $server Run($run) Exit Else $run = $vncPath & " " & $url & ':' & $port Run($run) Exit EndIf Exit EndFunc ;==>_srvConnect ;Start GUI GUISetState() While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $Button_Tower ;set port and server infor for Button_1 $port = "4444" $server = "10.70.1.11" ;Connect to server _srvConnect($vncPath, $port, $server, $url, $homeIPparce, $ipParce) Case $msg = $Button_Linux ;set port and server infor for Button_2 $port = "5555" $server = "10.70.1.12" ;Connect to server _srvConnect($vncPath, $port, $server, $url, $homeIPparce, $ipParce) EndSelect WEnd Exit Edit: Forgot some stuff... Edited December 21, 2005 by SmOke_N 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...
seandisanti Posted December 21, 2005 Share Posted December 21, 2005 (edited) I'm not able to get this to run correctly. It will compile, and run the GUI, but errors out on the _srvConnect() function The error is attached and below is the code... PS, the personal stuff has all been changed, so don't bother! Also I attached my real source file so it can be read w/ the tabs.you haven't setup your _srvconnect() to accept any arguments. if you want to send it a value, you have to assign a name to the value being received, like Func _SrvConnect($argument)then use $argument within the function to refer to the referenced. Another option if you're using global variables and it's just working with those, take out the arguments being passed in the function call, and call it with just: _SrvConnect() ***edit** fixed typo. also, please use [ code ] and [ /code ] (without the spaces) to seperate your code and make it stand out... PS. welcome to the forum Edited December 21, 2005 by cameronsdad Link to comment Share on other sites More sharing options...
masonje Posted December 22, 2005 Author Share Posted December 22, 2005 Does this help?Yes! Thanks a tun. I also tried taking out the passing of vars and that works too b/c I guess they are global variables (I didn't think of that).Thanks again guys. 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