Rex Posted May 6, 2005 Share Posted May 6, 2005 http://www.intel.com/technology/UPnP/tech.htmthis might get u started... Link to comment Share on other sites More sharing options...
computergeek Posted May 6, 2005 Author Share 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 Link to comment Share on other sites More sharing options...
Rex Posted May 6, 2005 Share Posted May 6, 2005 Hmm can't help there. But i'm possitive that some one in the forum can. Link to comment Share on other sites More sharing options...
computergeek Posted May 9, 2005 Author Share Posted May 9, 2005 Anyone? Link to comment Share on other sites More sharing options...
computergeek Posted May 12, 2005 Author Share Posted May 12, 2005 Can anyone show me how to do this script writen in C in Autoit 3 ( :"> )...Thanks. Link to comment Share on other sites More sharing options...
layer Posted May 12, 2005 Share 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 Link to comment Share on other sites More sharing options...
Insolence Posted May 13, 2005 Share 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. Link to comment Share on other sites More sharing options...
computergeek Posted May 14, 2005 Author Share 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 Link to comment Share on other sites More sharing options...
CyberSlug Posted May 14, 2005 Share 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! Link to comment Share on other sites More sharing options...
computergeek Posted June 1, 2005 Author Share Posted June 1, 2005 So i guess it's VB then but does anyone know how to do this in Autoit? :"> Link to comment Share on other sites More sharing options...
computergeek Posted June 2, 2005 Author Share Posted June 2, 2005 [booster] Link to comment Share on other sites More sharing options...
layer Posted June 2, 2005 Share 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 Link to comment Share on other sites More sharing options...
computergeek Posted June 17, 2005 Author Share 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 Link to comment Share on other sites More sharing options...
A. Bendet Posted August 23, 2006 Share Posted August 23, 2006 wow! that's working great! thx Mr. layer !!! Link to comment Share on other sites More sharing options...
Confuzzled Posted September 4, 2006 Share 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 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