ClosetDweller Posted January 31, 2012 Share Posted January 31, 2012 (edited) I am deploying about 250 workgroup workstations to POS locations and what I would like to achieve is to present an input box: Local $value = InputBox("Store Number", "Enter the 4 digit store number", "", " M4") to which they would enter their store number (ex. 0099) for the store number. I would like to capture that information and add it to the known constant of the remainder of the nomenclature ex (Store_$value_A) that I can then use to map a share based on %computername%sharename is this possible? Edited January 31, 2012 by ClosetDweller Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted January 31, 2012 Moderators Share Posted January 31, 2012 Hi, ClosetDweller, welcome to the forum. With AutoIT, all things are possible So, if I understand you correctly, you already have your input box to prompt the user to input a store number: Local $value = InputBox("Store Number", "Enter the 4 digit store number", "", " M4") Based on the 4 digit number returned, you would like to assign a variable: $store = "Store_" & $value & "_A" Then you want to map a network drive based on that new variable: Run("net use z: " & $store & "MyShare", "", @SW_SHOW) Is that about what you're looking to do? "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
Xenobiologist Posted January 31, 2012 Share Posted January 31, 2012 Maybe you need to work with StringFormat('%4i', $variable) to format it. Should be a 4 digits. Or use something like this #Region ;************ Includes ************ #Include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <WinAPI.au3> #EndRegion ;************ Includes ************ $GUI = GUICreate(" My GUI", 350, 180) $hInput = GUICtrlCreateInput("0000", 10, 5, 100, 20, $ES_NUMBER) $hstart_B = GUICtrlCreateButton('Start', 10, 30, 100, 20, $BS_DEFPUSHBUTTON) GUICtrlSetLimit(-1, 5) GUISetState() GUIRegisterMsg($WM_COMMAND, "MY_WM_COMMAND") While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop If $msg = $hstart_B Then ConsoleWrite(GUICtrlRead($hInput) & @LF) WEnd Func MY_WM_COMMAND($hWnd, $msg, $wParam, $lParam) Local $controlID = _WinAPI_LoWord($wParam) If $controlID = $hInput Then GUICtrlSetData($hInput, StringFormat('%05i', GUICtrlRead($hInput))) GUICtrlSetData($hInput, StringTrimLeft(GUICtrlRead($hInput), 1)) ; your logic EndIf EndFunc ;==>MY_WM_COMMAND Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted January 31, 2012 Moderators Share Posted January 31, 2012 I wrote this on my way to bed last night, and am unsure this morning why I suggested you use Net Use. The last example in my suggestion can be done easily enough with DriveMapAdd: DriveMapAdd("Z:", "" & $store & "MyShare") "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
ClosetDweller Posted February 10, 2012 Author Share Posted February 10, 2012 Hi, ClosetDweller, welcome to the forum. With AutoIT, all things are possible So, if I understand you correctly, you already have your input box to prompt the user to input a store number: Local $value = InputBox("Store Number", "Enter the 4 digit store number", "", " M4") Based on the 4 digit number returned, you would like to assign a variable: $store = "Store_" & $value & "_A" Then you want to map a network drive based on that new variable: Run("net use z: " & $store & "MyShare", "", @SW_SHOW) Is that about what you're looking to do? Exactly... is there more to it than that? seems surprisingly simple. Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted February 10, 2012 Moderators Share Posted February 10, 2012 Hi, ClosetDweller. Do you WANT AutoIT to make things more difficult for you? I'm personally thrilled when I can do something quickly and easily. "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
DicatoroftheUSA Posted February 10, 2012 Share Posted February 10, 2012 (edited) You can use regular expressions, to make sure the input is valid.For the environment variables you will can use setx (google will invariably "correct" setx to sex, so be careful if you are at work. duckduckgo from now on) or the registryUser Variables: HKEY_CURRENT_USEREnvironmentSystem Variables: HKEY_LOCAL_MACHINESYSTEMCurrentControlSetControlSession ManagerEnvironmenthttp://vlaurie.com/computers2/Articles/environment.htm Edited February 10, 2012 by DicatoroftheUSA Statism is violence, Taxation is theft. Autoit Wiki 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