Jump to content
Advert

Longvl85

Members
  • Posts

    8
  • Joined

  • Last visited

Longvl85's Achievements

Seeker

Seeker (1/7)

0

Reputation

  1. Hey All, Been trying to work on creating a GUI that will take the User input and injected it into a SQL Query. Been watching so many videos about it and I am just stuck. If I replace the If _SQL_Execute....." inside the Func SQLQUERY with a msgbox it works. My theory is it doesn't know how to execute the SQL connect. I think it has to do something with Server Connection information. Any thoughts? #cs ----------------------------------------------------------------------------     AutoIt Version: 3.3.8.1     Author:         myName     Script Function:     Template AutoIt script. #ce ---------------------------------------------------------------------------- ; Script Start - Add your code below here #include <_SQL.au3> #include <MsgBoxConstants.au3> #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= Global $Form1 = GUICreate("Form1", 615, 437, 192, 124) Global $Input1 = GUICtrlCreateInput("Input1", 96, 88, 153, 21) Global $Button1 = GUICtrlCreateButton("Button1", 280, 72, 73, 33) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1     $nMsg = GUIGetMsg()     Switch $nMsg         Case $GUI_EVENT_CLOSE             Exit         Case $Button1 SQLQUERY()     EndSwitch WEnd ;Server ID and credentials Local $ServerAddress = "SERVER IP" Local $ServerUserName = "DB USERNAME" Local $ServerPassword = "DB PASSWORD" Local $DatabaseName = "DB" ;Connect to DB _SQL_RegisterErrorHandler();register the error handler to prevent hard crash on COM error $OADODB = _SQL_Startup() If $OADODB = $SQL_ERROR Then MsgBox(0 + 16 + 262144, "Error", _SQL_GetErrMsg()) If _sql_Connect(-1, $ServerAddress, $DatabaseName, $ServerUserName, $ServerPassword) = $SQL_ERROR Then     MsgBox(0 + 16 + 262144, "Error 1", _SQL_GetErrMsg())     _SQL_Close()     Exit EndIf Func SQLQUERY()      If _SQL_Execute(-1,"Update Part set user_10 = '"&GuiCtrlRead($Input1)&"' where id = '"&GuiCtrlRead($Input1)&"'") = $SQL_ERROR then Msgbox(0 + 16 +262144,"Error",_SQL_GetErrMsg())     _SQL_Close()     EndFunc
  2. ah dang, that worked. haha. Thank you so much. I was litterly looking at the threads for so long trying to figure it out. I think i got pretty close haha. Could you also point me to resource on the GuiCtrlRead? I want to do a little more. Like for example a list that says "full screen, windowed, minized" so example of out put would be like "v:VM.exe -w 650 -s full" So what I tried to do is make another list and type up Global $gui2 = Run("v:vm.exe -w " & GuiCtrlRead($list1) & GuiCtrlRead($list2)) EDIT: I figured it out :-D so happy hehe. I also figured out I need to add a space in the for the -s part or else it would combine with the previous text. Global $gui2 = Run("v:vm.exe -w " & GuiCtrlRead($list1) & " -s" & GuiCtrlRead($list2))
  3. So i have spent the past hour or so looking at threads and can't really seem to understand. I want to be able to select a window size from left list and then from that selection. I tried using GuiCtrlRead($list1) but that doesnt seem to do it. If I were to choose 480, instead of running the program with @ comes back with "GuiCtrlRead($list1)". #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <GUIListBox.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <Process.au3> Opt("GUIOnEventMode", 1) Opt("TrayIconDebug", 1) $Form2 = GUICreate("Form2", 359, 187, 229, 546) Global $Button1 = GUICtrlCreateButton("South Windsor V: Map", 16, 32, 161, 57, $WS_GROUP) Global $Button2 = GUICtrlCreateButton("Cromwell V: Map", 184, 32, 161, 57) $List1 = GUICtrlCreateList("", 22, 120, 81, 58) GUICtrlSetData(-1, "|480|640|768") Global $Button3 = GUICtrlCreateButton("Launch", 112, 120, 225, 57) GUICtrlSetFont(-1, 20, 400, 0, "Times New Roman") $Label1 = GUICtrlCreateLabel("Select Window Size and click Launch to start Visual", 24, 96, 297, 19) GUICtrlSetFont(-1, 8, 400, 0, "Arial Black") $Label2 = GUICtrlCreateLabel("Click on Button to change Drive mapping of V:\", 40, 8, 284, 19) GUICtrlSetFont(-1, 8, 400, 0, "Arial Black") GUICtrlSetOnEvent($button1, "gui0") GUICtrlSetOnEvent($button2, "gui1") GUICtrlSetOnEvent($button3, "gui2") GUISetOnEvent($GUI_EVENT_CLOSE, "_Close") GUISetState(@SW_SHOW) While 1 Sleep(200) WEnd Func gui0() Global $gui0 = _RunDos("net use v: /delete /yes") _RunDos("net use v: \\sw-db\ve654") _RunDos("net use v: /delete /yes") _RunDos("net use v: \\sw-db\ve654") EndFunc Func gui1() Global $gui1 = _RunDos("net use v: /delete /yes") _RunDos("net use v: \\cw-db\visual654") _RunDos("net use v: /delete /yes") _RunDos("net use v: \\cw-db\visual654") EndFunc Func gui2() Global $gui2 = run("v:\vm.exe -w GuiCtrlRead($list1)",) EndFunc Func _Close() GUIDelete() Exit EndFunc
  4. I think I can append but not sure how to do that. i read that FileWrite can do it.
  5. ok so i thought of another way.... $file = FileOpen("c:\output\New Text document.ddt", 0) FileWrite("c:\output\New Text Document2.csv", FileReadLine($file,1)) FileWrite("c:\output\New Text Document2.csv", ",") FileWrite("c:\output\New Text Document2.csv", FileReadLine($file,2)) FileWrite("c:\output\New Text Document2.csv", ",") FileWrite("c:\output\New Text Document2.csv", FileReadLine($file,3)) FileWrite("c:\output\New Text Document2.csv", ",") Now I have to figure out how to read multiple files and put the output of those files on a new row lol. Ahhh the feeling of being noob.
  6. Thanks guy, Ill do some reading. I already created one Autoit program that saves me a ton of time. Even has a awesome GUI. Now I jsut gotta figure out this new challenge. :-D
  7. I meant to say 20 not 2. 2 I can live with haha
  8. I have this program the runs then output results in .ddt file I then have to open the file and extract the data Here is an example: 11 1 8 01-06-2010 1:11 p/m. 8.304358 1 24354 0 1 31 Is there a way for it to output the data into excel columns that I specify below? I currently have to open multiple files and copy and paste all this data into a spread sheet. sometime it coule be 2 files I have to do this for. Very time consuming. Any help would be much appreciated! :-D 11 = Column A 1 = Not used 8 = Not used 01-06-2010 = Not used 1:11 p/m. = Column B 8.304358 = Column C 1 = Not used 24354 = Column D 0 = Not used 1 = Not used 31 = Not used
×
×
  • Create New...