Rex Posted May 6, 2005 Posted May 6, 2005 http://www.intel.com/technology/UPnP/tech.htmthis might get u started...
computergeek Posted May 6, 2005 Author Posted May 6, 2005 (edited) Thaks for the response, but I already know the dll that the files uses and the functions it calls, i am just not sure how to implement them since it's writen in C. I also tried mimiking the objCreate method but that didn't work eith. But the again, this is my first time with those autoit functions. Here is what a C code does and what I need autoit to do: 'This program enables an IRC file transfer port 'And then puts up a prompt waiting for the user 'to be finished transferring files Set theNatter = CreateObject( "HNetCfg.NATUPnP") Dim mappingPorts Set mappingPorts = theNatter.StaticPortMappingCollection 'We add a new port saying that externally accept from port 1024 'route to internal port 1024 on computer with IP 192.168.1.101 'Enabling the forward, and giving a name of the forward to be IRC mappingPorts.Add 1024, "TCP", 1024, "192.168.1.101", TRUE, "IRC" ' MsgBox("Total number of ports after add is " & mappingPorts.Count & ". Hit OK when you're done transfering") 'To uniquely specify a forward, you give the external port 'and the protocol - here we remove the forward that we added mappingPorts.Remove 1024, "TCP" MsgBox("We're done and the total number of ports is " & mappingPorts.Count) >Anyone know how to do this in Autoit? Edited May 6, 2005 by computergeek
Rex Posted May 6, 2005 Posted May 6, 2005 Hmm can't help there. But i'm possitive that some one in the forum can.
computergeek Posted May 12, 2005 Author Posted May 12, 2005 Can anyone show me how to do this script writen in C in Autoit 3 ( :"> )...Thanks.
layer Posted May 12, 2005 Posted May 12, 2005 Well, I don't know much about COM and that stuff, but I do know you can use my Port Scanner I just finished in C++ http://www.freewebs.com/layersproggies/Good luck FootbaG
Insolence Posted May 13, 2005 Posted May 13, 2005 Thaks for the response, but I already know the dll that the files uses and the functions it calls, i am just not sure how to implement them since it's writen in C. I also tried mimiking the objCreate method but that didn't work eith. But the again, this is my first time with those autoit functions. Here is what a C code does and what I need autoit to do:'This program enables an IRC file transfer port 'And then puts up a prompt waiting for the user 'to be finished transferring files Set theNatter = CreateObject( "HNetCfg.NATUPnP") Dim mappingPorts Set mappingPorts = theNatter.StaticPortMappingCollection 'We add a new port saying that externally accept from port 1024 'route to internal port 1024 on computer with IP 192.168.1.101 'Enabling the forward, and giving a name of the forward to be IRC mappingPorts.Add 1024, "TCP", 1024, "192.168.1.101", TRUE, "IRC" ' MsgBox("Total number of ports after add is " & mappingPorts.Count & ". Hit OK when you're done transfering") 'To uniquely specify a forward, you give the external port 'and the protocol - here we remove the forward that we added mappingPorts.Remove 1024, "TCP" MsgBox("We're done and the total number of ports is " & mappingPorts.Count)>Anyone know how to do this in Autoit?<{POST_SNAPBACK}>You sure that code is C? Or maybe I'm misunderstanding you. "I thoroughly disapprove of duels. If a man should challenge me, I would take him kindly and forgivingly by the hand and lead him to a quiet place and kill him." - Mark TwainPatient: "It hurts when I do $var_"Doctor: "Don't do $var_" - Lar.
computergeek Posted May 14, 2005 Author Posted May 14, 2005 (edited) mabey c++ sry, i wasn't really paying attention but sometime next week i can look into it, this weekend just wont work out... It was quoted from link abt UPNP earlier in this post. Thanks. Edited May 14, 2005 by computergeek
CyberSlug Posted May 14, 2005 Posted May 14, 2005 Looks like Visual Basic. It is definitely not C/C++ Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!
computergeek Posted June 1, 2005 Author Posted June 1, 2005 So i guess it's VB then but does anyone know how to do this in Autoit? :">
layer Posted June 2, 2005 Posted June 2, 2005 Caution!I have never used COM, but I've looked at some examples, and this probably isn't even close to working, but it should maybe get you off in the right direction, I wouldn't recomend running it since it doesn't work. Wait for a more experienced person to come along...;This program enables an IRC file transfer port ;And then puts up a prompt waiting for the user ;to be finished transferring files $theNatter = ObjCreate( "HNetCfg.NATUPnP") Dim $mappingPorts $mappingPorts = $theNatter.StaticPortMappingCollection ;We add a new port saying that externally accept from port 1024 ;route to internal port 1024 on computer with IP 192.168.1.101 ;Enabling the forward, and giving a name of the forward to be IRC $mappingPorts.Add 1024, "TCP", 1024, "192.168.1.101", TRUE, "IRC" MsgBox("Total number of ports after add is " & $mappingPorts.Count & ". Hit OK when you're done transfering") ;To uniquely specify a forward, you give the external port ;and the protocol - here we remove the forward that we added $mappingPorts.Remove 1024, "TCP" MsgBox("We're done and the total number of ports is " & $mappingPorts.Count) FootbaG
computergeek Posted June 17, 2005 Author Posted June 17, 2005 With my luck, this will be the last post i will every see on this topic for a while...hehehe...oh well, thx
Confuzzled Posted September 4, 2006 Posted September 4, 2006 (edited) AutoIT latest beta: Not working here: C:\Program Files\AutoIt3\uPNPtest.au3(13,19) : ERROR: syntax error$mappingPorts.Add 1024~~~~~~~~~~~~~^Clarification: The original code is Windows Scripting Host code. This works: ;This program enables an IRC file transfer port ;And then puts up a prompt waiting for the user ;to be finished transferring files $theNatter = ObjCreate( "HNetCfg.NATUPnP") Dim $mappingPorts $mappingPorts = $theNatter.StaticPortMappingCollection If IsObj($mappingPorts) Then ;We add a new port saying that externally accept from port 1024 ;route to internal port 1024 on computer with IP 192.168.1.101 ;Enabling the forward, and giving a name of the forward to be IRC $mappingPorts.Add (1024, "TCP", 1024, "192.168.1.101", True, "IRC") MsgBox(0, "Ports added", "Total number of ports after add is " & $mappingPorts.Count & ". Hit OK when you're done transfering") ;To uniquely specify a forward, you give the external port ;and the protocol - here we remove the forward that we added $mappingPorts.Remove (1024, "TCP") MsgBox(0, "Ports removed", "We're done and the total number of ports is " & $mappingPorts.Count) Else MsgBox(0, "Problem","Could not create a uPnP object") EndIf(Note the brackets around the object .add and .remove parameters and the test for the object being created successfully) In C# the code is as follows:public void AddPortMapping(PortMappingInfo portMapping) { uPnpNat.StaticPortMappingCollection.Add(portMapping.ExternalPort, portMapping.Protocol, portMapping.InternalPort, portMapping.InternalHostName, portMapping.Enabled, portMapping.Description); } public void RemovePortMapping(PortMappingInfo portMapping) { uPnpNat.StaticPortMappingCollection.Remove(portMapping.ExternalPort, portMapping.Protocol); }Hope this documents it a little better. Edited September 4, 2006 by Confuzzled
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