Jump to content

Ferman

Members
  • Posts

    11
  • Joined

  • Last visited

Everything posted by Ferman

  1. IT WORKS!!! Thank you very much! I guess I have some more reading to do. Apparently I didn't think of making a case for $done.
  2. My question is "How do I make the FileWriteLine actually work?". With this code right now it will not create test.txt with "Line1 Line2 Line3" written in it...... Sorry I was a little flustered when I was writing this post which means I am not very coherent in my typing haha.. Its making me mad. I haven't used autoit in like 2-3 years which means I forgot a lot and I mean I didn't really know much when I used it last.
  3. Alright, So I am trying to make an autoit script to create a file and I just looked at the example on the function page for FileWriteLine everything seemed to make since so I added a GUISetOnEvent so that when the "done" button is pressed it will create a file with text in it and it will continue to write the text in it over and over again... I am just trying to get this to work before I do any other stuff. So I used Koda to make the gui real fast (that was the easy part) and I exported it etc and I added the GUISetOnEvent and the function from the FileWriteLine example and it doesn't work. I did get it to work once though but I had to generate the code from Koda with events on everybutton which then left minimize and close useless, so creating a file with text in it worked but closing the application itself didn't which was pretty useless. My question is "How do I make the FileWriteLine actually work?". With this code right now it will not create test.txt with "Line1 Line2 Line3" written in it. #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form=C:UsersjustinDesktopcreat-vhostvhost-gui.kxf $Form1 = GUICreate("Create a new vHost for localdev", 401, 201, 325, 193) GUISetBkColor(0xFFFFFF) $website = GUICtrlCreateInput("", 16, 40, 361, 21) GUICtrlSetCursor (-1, 2) $website_label = GUICtrlCreateLabel("Website Name ( Do not provide the extension ex. graphtek.com = graphtek )", 16, 16, 364, 17) $done = GUICtrlCreateButton("Done", 304, 160, 73, 33) GUICtrlSetOnEvent($done, "doneClick") $coldfusion = GUICtrlCreateCheckbox("Is this a coldfusion site?", 16, 72, 281, 20) $directory_edit = GUICtrlCreateButton("Edit Directories", 16, 160, 105, 33) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func doneClick() Local $file = FileOpen("test.txt", 1) ; Check if file opened for writing OK If $file = -1 Then MsgBox(0, "Error", "Unable to open file.") Exit EndIf FileWriteLine($file, "Line1") FileWriteLine($file, "Line2" & @CRLF) FileWriteLine($file, "Line3") FileClose($file) EndFunc
  4. Thats a better idea. Thanks Ill work on adding this.
  5. Thank you very much!! I am thinking about adding a success window so when connect is pressed you get a windows saying it is connected or it didnt work..
  6. I'm super thankful also!! My cousin just showed me this a few days back because I needed to make a quick that would prompt for user info to map a network drive for the other kids in my class to connect to a file server in my photo class. All my friends are amazed by what I did and it was sup simple! I hope to get much much better with auto it to help out in the forums as much as possible!
  7. Alright so i got everything working but id like to make it a bit prettier.. I used Koda GUI designer and it looks good but I am unsure what func to use when the connect button is pressed... I was either thinking "MouseClick" or "GUICtrlSetOnEvent"... Here is what I was thinking but im sure its wrong. Because ive looked at some source of some scripts people made and it doesnt look like mine on the SetOnEvent function... #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form=C:\Users\Justin\Desktop\AutoIt GUI\Forms\NetowrkDriveConnect.kxf $Form1 = GUICreate("Connect To Your Drive", 265, 135, 633, 213) $username = GUICtrlCreateInput("", 88, 16, 153, 21) $password = GUICtrlCreateInput("", 87, 44, 153, 21) $user = GUICtrlCreateLabel("Username", 24, 16, 52, 17) $pass = GUICtrlCreateLabel("Password", 26, 46, 50, 17) $connect = GUICtrlCreateButton("Connect", 24, 80, 217, 33) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### GUICtrlSetOnEvent ( Connect, "DriveMapAdd("X:", "\\filerserver\" & $username, 0, $username, $password)" ) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd
  8. SWEET!!! Thanks! My cousin just showed me autoit and its amazing so far! And it looks like the community is very helpful . Thanks
  9. Alright I just took the quotes out off of $user and $password.... but should i take the quotes off of "\\FILESERVER\$user"?
  10. Hey everyone I am currently trying to make an autoit script that asks for a username and password before it maps the drive.. $user = InputBox("I did this.", "Please enter in your username.") $password = InputBox("And this.", "Please enter in your password.") DriveMapAdd("Z:", "\\FILESERVER\$user", 0, "$user", "$password") It looks like it would work but for some reason it isnt. Anyone have an idea why?
×
×
  • Create New...