Phlegm Posted January 6, 2010 Share Posted January 6, 2010 This is my first attempt at scripting; I have used Autoit in the past to automate settings and installing programs. But now I want to try to use Autoit to create a GUI to create a user interface for a user to map a drive. This should be an easy enough exercise and a good way to start learning. So I was able to create a GUI interface using KODA. I read thru some of the tutorials and have general idea of how things work but have no clue as to how to use or implement any of it. So if you all could be so kind as to comment on how to accomplish this. First off I do not understand how to take input from a user and use it to map a drive or access a share, I understand that you have to first declare a variable like $address to represent the user‘s input. But where do you put it in the script to start mapping the drive? Is there a proper format? Do you use something like “net use Y: \\$address\” ? or do you use DriveMapAdd (“Y:\\$address, 0, “domain\$username”, “password”? I know these are a lot of basic question but I would like to know how to correctly write using Autoit. Also, I see stuff indented in the scripts is there rules to follow on when to do this? Thanks for your patient on this.test Logon.au3 Link to comment Share on other sites More sharing options...
James Posted January 6, 2010 Share Posted January 6, 2010 (edited) First off I do not understand how to take input from a user and use it to map a drive or access a share, I understand that you have to first declare a variable like $address to represent the user‘s input. But where do you put it in the script to start mapping the drive? You have an input control, $Address? right? So to read the control we use GuiCtrlRead, which returns the data in the control. $strAddr = GuiCtrlRead($Address) Is there a proper format? Do you use something like “net use Y: \\$address\” ? or do you use DriveMapAdd (“Y:\\$address, 0, “domain\$username”, “password”? I know these are a lot of basic question but I would like to know how to correctly write using Autoit. Also, I see stuff indented in the scripts is there rules to follow on when to do this?Close. To concatenate (join) a string, we use the & operator: DriveMapAdd("Y:\\" & $strAddr, 0, "Domain\" & $Username, $Password)Hope that helps Edit: Forgot to add the closing autoit tag. Edited January 6, 2010 by JamesBrooks Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ Link to comment Share on other sites More sharing options...
Phlegm Posted January 6, 2010 Author Share Posted January 6, 2010 You have an input control, $Address? right? So to read the control we use GuiCtrlRead, which returns the data in the control. $strAddr = GuiCtrlRead($Address) Close. To concatenate (join) a string, we use the & operator: DriveMapAdd("Y:\\" & $strAddr, 0, "Domain\" & $Username, $Password)Hope that helps Edit: Forgot to add the closing autoit tag. Ahh so I need another command to "read" the $addres ($strAddr = GuiCtrlRead($Address)) What is "$straddr"? Is this made up or there some where I readup on it? Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted January 6, 2010 Moderators Share Posted January 6, 2010 Phlegm,You are obviously a complete beginner. Nothing wrong with that - we all started there! Reading the first few sections of the Help file (Using AutoIt, Tutorials and the first couple of References) will help you enormously. You should also look at the excellent tutorials that you will find here and here. There are even video tutorials on YouTube if you prefer watching to reading.Go and study these for a while - you will find that it is not a daunting as you fear. You know where we are when you have some specific questions. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Phlegm Posted January 6, 2010 Author Share Posted January 6, 2010 Phlegm, You are obviously a complete beginner. Nothing wrong with that - we all started there! Reading the first few sections of the Help file (Using AutoIt, Tutorials and the first couple of References) will help you enormously. You should also look at the excellent tutorials that you will find here and here. There are even video tutorials on YouTube if you prefer watching to reading. Go and study these for a while - you will find that it is not a daunting as you fear. You know where we are when you have some specific questions. M23 Why yes I am, hopefully not for long. Never even thought about checking YouTube for tutorials thanks! Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted January 6, 2010 Moderators Share Posted January 6, 2010 Phlegm,hopefully not for longWith that attitude, I am sure you are correct! By the way, when you reply please use the "Add Reply" button at the top and bottom of the page rather then the "Reply" button in the post itself. That way you do not get the contents of the previous post quoted in your reply and the whole thread becomes easier to read. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
James Posted January 6, 2010 Share Posted January 6, 2010 By the way, when you reply please use the "Add Reply" button at the top and bottom of the page rather then the "Reply" button in the post itself. That way you do not get the contents of the previous post quoted in your reply and the whole thread becomes easier to read. If you do want to quote someone, at least strip out the irrelevant bits, or quote bit by bit Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ Link to comment Share on other sites More sharing options...
Phlegm Posted January 8, 2010 Author Share Posted January 8, 2010 Thanks for pointing me to the Youtube Tutorials. I found them , for me at least, more helpful than some of the other documentations. I have a question: On my little excersise I want to create a GUI for a user to enter an IP address or a share name and use it to map a drive. I noticed I can use GUICtrlCreateLabel or GUICtrlCreateInput to create an input box for the information to be used later to map a drive. Please tell me which one I should use and what the diffrences are or perhaps there is a better way. thanks Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted January 8, 2010 Moderators Share Posted January 8, 2010 Phlegm,If you want user input, the 2 functions you should look at are GUICtrlCreateInput and InputBox.InputBox does most of the work for you as it produces its own GUI, input area, buttons and labels. However, it is limited to a single input, which means a succession of InputBoxes to get several pieces of user information.If you want the user to be able to input several pieces of information at the same time then you need to go down the route of creating your own GUI with multiple input controls created with GUICtrlCreateInput - and all the other controls you will need like labels, buttons, etc.The choice is yours! M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Phlegm Posted January 8, 2010 Author Share Posted January 8, 2010 Okay I understand. Is there a special "WinNet_UseConnection" for ID and Password when trying to map a drive? I think I need a #Include <WinNet.au3> to make it work too. Any helpful tips or insight on this for me? Thanks Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted January 8, 2010 Moderators Share Posted January 8, 2010 Phlegm, Out of my comfort zone now, I am afraid! M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area 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