Go to Post Besides, if you look back on anything you've already made and can't find any flaws that can be improved, you're doing it wrong. - artdutra04 [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 16-02-2012, 10:17
Folders's Avatar
Folders Folders is offline
Registered User
AKA: Emmanuel
FRC #1671 (Birdbrains)
Team Role: Programmer
 
Join Date: Jan 2011
Rookie Year: 2009
Location: Clovis
Posts: 8
Folders is an unknown quantity at this point
Auto IP Batchfile

It's kinda late in the build season, but I wanted to share this anyway

To switch to regular internet.
Code:
ECHO This fanciness is brought to you by Folders!
ECHO You may have to change the text in "Wireless Network Connection"

ECHO Resetting IP Address and Subnet Mask For DHCP
netsh int ip set address name = "Wireless Network Connection" source = dhcp

netsh int ip show config

pause
To switch to Robot.

Code:
ECHO This fanciness is brought to you by Folders!
ECHO You may have to change the text in "Wireless Network Connection"

set varip=10.16.71.30
set varsm=255.255.255.0

REM For the most up-to-date-info, visit http://samanathon.com/set-your-ip-address-via-batch-file/

ECHO Setting IP Address and Subnet Mask
netsh int ip set address name = "Wireless Network Connection" source = static addr = %varip% mask = %varsm%

netsh int ip show config

pause
__________________
Emmanuel A.K.A. Folders
Email: Iameman9669@gmail.com
  #2   Spotlight this post!  
Unread 16-02-2012, 11:27
DjScribbles DjScribbles is offline
Programming Mentor
AKA: Joe S
FRC #2474 (Team Excel)
Team Role: Mentor
 
Join Date: Oct 2011
Rookie Year: 2012
Location: Niles MI
Posts: 284
DjScribbles is a splendid one to beholdDjScribbles is a splendid one to beholdDjScribbles is a splendid one to beholdDjScribbles is a splendid one to beholdDjScribbles is a splendid one to beholdDjScribbles is a splendid one to beholdDjScribbles is a splendid one to beholdDjScribbles is a splendid one to behold
Re: Auto IP Batchfile

Oddly enough, I set up these same scripts last night for our DS and my programming lappy.

Only annoying bit is that it seems windows 7 won't allow you to force running as administrator on them. Did you find any way around this (because right clicking and clicking run as admin is so terribly difficult )

Edit: Also, I thought the FRC subnet was typically 255.0.0.0 rather than 255.255.255.0 , was this intentional. Also as a note, I added set for "Local Area Connection" as well to a second IP, that way you can hop back and forth on wired at the same time

Last edited by DjScribbles : 16-02-2012 at 11:30. Reason: To edit it ;)
  #3   Spotlight this post!  
Unread 16-02-2012, 12:13
andreboos andreboos is offline
Registered User
FRC #3021 (The Agency)
Team Role: Programmer
 
Join Date: Dec 2009
Rookie Year: 2010
Location: San Diego
Posts: 132
andreboos is a jewel in the roughandreboos is a jewel in the roughandreboos is a jewel in the roughandreboos is a jewel in the rough
Re: Auto IP Batchfile

Quote:
Originally Posted by DjScribbles View Post
Only annoying bit is that it seems windows 7 won't allow you to force running as administrator on them. Did you find any way around this (because right clicking and clicking run as admin is so terribly difficult )
http://technet.microsoft.com/en-us/m.../ff431742.aspx

Not sure whether this works on batch files, though.
  #4   Spotlight this post!  
Unread 28-03-2012, 11:29
carrillo694's Avatar
carrillo694 carrillo694 is offline
Alex Carrillo
FRC #0694 (Stuypulse)
Team Role: Programmer
 
Join Date: Jan 2011
Rookie Year: 2009
Location: New York, NY
Posts: 66
carrillo694 is a jewel in the roughcarrillo694 is a jewel in the roughcarrillo694 is a jewel in the roughcarrillo694 is a jewel in the rough
Re: Auto IP Batchfile

Thank you for sharing!

Our team has used this and loves it. We modified the toRobot script so that it prompts you for what you want your computer's IP address to end in, since we often have multiple computers connected to the robot network and we want to prevent IP conflicts.
  #5   Spotlight this post!  
Unread 28-03-2012, 21:38
alberth alberth is offline
Programmer and Engineer
FRC #4067 (The Incredible Hawk)
Team Role: Programmer
 
Join Date: Jan 2012
Rookie Year: 2011
Location: Maryland
Posts: 9
alberth is an unknown quantity at this point
Re: Auto IP Batchfile

Quote:
Originally Posted by andreboos View Post
http://technet.microsoft.com/en-us/m.../ff431742.aspx

Not sure whether this works on batch files, though.
There are two ways to accomplish elevation via BATCH scripts.
1) Manifest file
You would need to convert the BAT script to an EXE. There are hundreds of programs and utilities to do that for you. One credible (but weird) method can be found here.

Finally, you need to embed a special elevation manifest file into that EXE. This article discusses the manifest's contents for getting an elevated privileges prompt. Again, there's some research involved, so beware.

2) External launcher
The ShellExecute API, with the "runas verb", will launch whatever program is in the arguments as an admin. I think there was a little EXE for exposing that API to BATCH scripters, but I seem to have lost it. Alternatively, if you know a little Python or a language that supports this API, you could create a program that exposes that API as well. (I'm a Python coder - if you need help for doing that, feel free to ask me and I'll provide you with my code!)

However, I found this program online called "Elevate": http://www.winability.com/elevate/

I don't know how trustworthy this is, but it looks like it does the job.
__________________
Team #4067 - The Incredible Hawk
Role: Lead Programmer
Team Website

2012 Rookie Inspiration Award (Chesapeake Regional)

"You can't warm up by standing still in the frigid cold. Get moving!"
  #6   Spotlight this post!  
Unread 29-03-2012, 01:26
daniel_dsouza daniel_dsouza is offline
does what needs to be done.
FRC #2449 (Out of Orbit Robotics)
Team Role: Alumni
 
Join Date: May 2011
Rookie Year: 2011
Location: Chandler, AZ
Posts: 231
daniel_dsouza has a spectacular aura aboutdaniel_dsouza has a spectacular aura about
Re: Auto IP Batchfile

If your team uses your Dlink in bridge mode, here is alternate solution to using the batch file:

configure your router (ours is the original blue, FRC provided linkysis) to automatically give out IP addresses like such 10.21.34.22 via DHCP. Then you can program the robot and surf CD at the same time!

Using the router + wired internet connection also helps get around school wireless issues.

I don't know enough about Robot to Dlink communications to say if the same thing will work if you have your Dlink configured as access point.
  #7   Spotlight this post!  
Unread 29-03-2012, 20:37
WizenedEE's Avatar
WizenedEE WizenedEE is offline
Registered User
AKA: Adam
FRC #3238 (Cyborg Ferrets)
Team Role: Leadership
 
Join Date: Jan 2011
Rookie Year: 2010
Location: Anacortes, WA
Posts: 395
WizenedEE is a name known to allWizenedEE is a name known to allWizenedEE is a name known to allWizenedEE is a name known to allWizenedEE is a name known to allWizenedEE is a name known to all
Re: Auto IP Batchfile

A shortcut can be made to run as administrator, so when we made these files we just made shortcuts to them and set that. Of course, that leaves 8 files on the desktop ({wireless,ethernet} {DHCP,static} {batch file,shortcut}), but 4 of them could be moved somewhere else.

It's kind of amazing the hoops windows makes you jump through to do what you want for "security" purposes.
Closed Thread


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 21:03.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi