Jump to content

CHOVIE

Active Members
  • Posts

    34
  • Joined

  • Last visited

Everything posted by CHOVIE

  1. Thank you for this ........ will have a look at what you did ....
  2. That is correct Edano ....
  3. The set button reeds from a file and do all the commands at once "this is all server related" and the the ok button do the same just one by one ..... It reads from a txt file Example; 10.0.0.1 port "Line 1" 10.0.0.2 port "Line 2" 10.0.0.3 port "Line 3"
  4. Yes Please The $setbuttons do a function and the oK buttons to .... Thank you
  5. Please find attached file ..... Thank you for having a look at this ........I am greatfull ....... Will have a look at that ... Kind Regards, CHOVIE Test GUI 10.3.au3
  6. OK after a long and intense look at functions, video tutorials and help file reading I came up with the following function that works once ..... _Buttons($SVR_selection) Func _Buttons($SVR_selection) If $SVR_selection = "SVR" & $i Then $sfilespec = "FILENAME.txt" $file = FileOpen($sfilespec, 0) If $file = -1 Then MsgBox(0, "Error", "Unable to open data file: '" & $sfilespec & "'") Exit EndIf While 1 $sline = FileReadLine($file) If @error = -1 Then ExitLoop $swindowtitle = "Telnet " & $sline $result = Run(@ComSpec & " /c telnet " & $sline) If $result <> 0 Then Sleep(500) WinActivate($swindowtitle) Sleep(400) Send("Key") Sleep(300) Send("Key") Sleep(400) Send("Key") Sleep(300) Send("Key") Sleep(300) Else MsgBox(0, "Error", "Failed to run Telnet for server '" & $sline & "'!") EndIf WEnd EndIf EndFunc But the now I am stuck ....... How can I get the function to open the same file and read only the required line information Example; Meaning that if If $SVR_selection = "SVR" & $i Then $i = 1.... then read SVR 1 = "First line" $i = 2.... then read SVR 2 = "Second line" and so on Any help will be appreciated on this matter ..... Kind Regards, CHOVIE
  7. @ Edano I have gone through the help file and wiki on functions ... but this is still way above my pay grade .... ...... or maybe I am to dumb to understand it ...... Please help ..... Kind Regards, CHOVIE
  8. Is there a way to read from the combo box get the relevant information go to "one" file, take the required information from there and execute the function ....... the reason for this is it is the same function over and over but the Item in the combo box and the required information in the file(one liner) changes ...... Example: combo box ======> File ======> Function SVR 1 ======> Information ======> Same Function Thank you for have a look and any suggestions are welcome ...... Kind Regards, CHOVIE
  9. @ Edano Heeeeeee Haaaaaaaa ............. reading from the combo box now and waiting for the button to get pressed and going to to allocated file ................ If $nmsg=$OK1Button[$i] Then $SVR_selection = GUICtrlRead($UnitsCombo[$i],$j) If $SVR_selection = "ITEM In COMBOBOX" Then $sfilespec = "FILENAME" $file = FileOpen($sfilespec, 0) If $file = -1 Then MsgBox(0, "Error", "Unable to open data file: '" & $sfilespec & "'") Exit EndIf While 1 $sline = FileReadLine($file) If @error = -1 Then ExitLoop $swindowtitle = "Telnet " & $sline $result = Run(@ComSpec & " /c telnet " & $sline) If $result <> 0 Then Sleep(500) WinActivate($swindowtitle) Sleep(200) Send("") That is what I have got ........... is there an easier way of doing this? Kind Regards, CHOVIE
  10. Try This ... Run(@WindowsDir & "\Notepad.exe", "") WinWaitActive("[CLASS:Notepad]") send("some text here") sleep(3000) send("!N") WinClose("[CLASS:Notepad]")
  11. @ Edano Thanks the button is now working ...... Now to find out which selection was made and the to go to which file ......... will try this and see how far I get ......... And yes the Help file is brilliant but only if you know what you are looking for ....... Kind Regards, CHOVIE
  12. Thank you for the help will have a look at the above ......
  13. @ Edano I understand the logic on what you mean but do not have a clue where to start and where to look ...... I have tried a few things but to no avail ..... I am sorry for being such a pain in the ass ......... but hopefully one day I`ll get there ....... I know that the code is a bit chaotic but it was my first one I did ...... if there is an easier way to get this to work please show me .... Kind Regards, CHOVIE
  14. @ Edano I have got this working but it needs to wait for me to puch the button before exicuting the command ....."once I have made the selection it automaticaly goes to the file reads it and starts running" ....... If $nmsg=$UnitsCombo[$i] Then $SVR_selection = GUICtrlRead($UnitsCombo[$i]&$j) $j = "SVR 1" $sfilespec = "FILENAME" $file = FileOpen($sfilespec, 0) If $file = -1 Then MsgBox(0, "Error", "Unable to open data file: '" & $sfilespec & "'") Exit EndIf While 1 $sline = FileReadLine($file) If @error = -1 Then ExitLoop $swindowtitle = "Telnet " & $sline $result = Run(@ComSpec & " /c telnet " & $sline) If $result <> 0 Then Sleep(500) WinActivate($swindowtitle) Sleep(200) Send("")     Thank you once again for have a look .... Kind Regards, CHOVIE
  15. @ Edano the code is below for creating the combo box ......... $UnitsCombo[$i]=GUICtrlCreateCombo("UNITS", 14+70*$i, 85, 60, 25) GUICtrlSetFont(-1, 8, 400, 0, "Arial") For $j=1 To 15+10*($i<3)+25*($i<2) GUICtrlSetData(-1,"SVR "&$j) and I need the function to pick up which selection was made in the combo box, use that selection ...... got to the appropriate file, read from there and do the above function ........ Regards, CHOVIE
  16. @ Edano Ok so I have hit a wall again ......... Once the combo box have been created how do I distinguish which selection was made ...... I`ve tried this but to no avail ..... If $nmsg=$UnitsCombo[$i] Then $j = GUICtrlRead($UnitsCombo[$i]&$j) Switch $j $sfilespec = "FILENAME" $file = FileOpen($sfilespec, 0) If $file = -1 Then MsgBox(0, "Error", "Unable to open data file: '" & $sfilespec & "'") Exit EndIf Kind Regards, CHOVIE
  17. @ Sammy1983 You try read from here and see if you can come right http://www.autoitscript.com/autoit3/docs/functions.htm Regards, CHOVIE
  18. @ Edano ........ All three button functions working now ... Now to carry on with the other functions until I get stuck again ....... Once again thank you for your time and effort on this, I am starting to understand it a bit more now. This is how you get someone to understand the functions and all the other goodies of AutoIT ....... Regards, CHOVIE
  19. @ Edano After the creation of the below I know which button works where, but if you type in the ip "10.0.0.1" for example once you pres the button to go and read the ip you have typed in ....... For $i=0 To 2 $ipaddress[$i] = _GUICtrlIpAddress_Create($cctv, 14, 295-40*$i, 130, 25) _GUICtrlIpAddress_Set($ipaddress[$i], "0.0.0.0") _GUICtrlIpAddress_ShowHide($ipaddress[$i], @SW_HIDE) $PingButton[$i] = GUICtrlCreateButton("GO", 145, 295-40*$i, 40, 25) GUICtrlSetFont(-1, 8, 400, 0, "Arial") If $i<>1 Then GUICtrlSetBkColor(-1, 2842846) Next this is the function .... $s_ip = _GUICtrlIpAddress_Get(????????????) If Ping($s_ip) > 0 Then Run(@ComSpec & " /c telnet ") If $s_ip <> 0 Then What do i type in place of the ?????????? Kind Regards, CHOVIE
  20. Ok ...... Ok ..... I am the stupid idiot ..... can`t read properly ...... found the mistake instead of If $OK2Button[$i] Then MsgBox(0,"","My control_ID is "&$nmsg-$htab&@CRLF&"and i am on Tab# "&Int($nmsg/4)) it should be If $nmsg=$OK2Button[$i] Then MsgBox(0,"","My control_ID is "&$nmsg-$htab&@CRLF&"and i am on Tab# "&Int($nmsg/4)) CHOVIE
  21. @ Edano I can get the first two tab`s button numbers but when I try the third tab it shows "My control ID is -4 and I am on Tab# 0 " ........... Do $nmsg = GUIGetMsg() For $i=0 To 7 If $OK2Button[$i] Then MsgBox(0,"","My control_ID is "&$nmsg-$htab&@CRLF&"and i am on Tab# "&Int($nmsg/4)) Next Regards, CHOVIE
  22. @ Edano HeeeHaaaaa ............. the first button is working now to get the rest to work .......... Will let you know if I run into a brick wall ........... yet again thank you for your time and effort on this ....... Regards, CHOVIE
  23. @ Edano Thank you one again for all your efforts on this matter .......... So I using your script to try and see how it would work when a button is pressed to do the following ...... Do $nmsg = GUIGetMsg() For $i=0 To 7 ; ..... If $nmsg=$SetButton[$i] Then $sfilespec = "FILENAME" $file = FileOpen($sfilespec, 0) EndIf If $file = -1 Then MsgBox(0, "Error", "Unable to open data file: '" & $sfilespec & "'") Exit EndIf While 2 $sline = FileReadLine($file) If @error = -1 Then ExitLoop $swindowtitle = "Telnet " & $sline $result = Run(@ComSpec & " /c telnet " & $sline) If $result <> 0 Then Sleep(500) WinActivate($swindowtitle) Sleep(200) Send("KEY") Sleep(300) Send("KEY") Sleep(300) Send("KEY") Sleep(300) Send("KEY") Sleep(300) Else MsgBox(0, "Error", "Failed to run Telnet for server '" & $sline & "'!") EndIf WEnd but then it opens a telnet session as soon as I run the program even before I clicked the button and it does not read from the file to get the information from there ......... Otherwise the code is brilliant and is a lot shorter then what I know at this stage what to do ....... Regards, CHOVIE
  24. Thanx, Will give a it a try tomorrow ......... EDIT: Is there any answer on the above post of mine ......... Please ....
  25. @ Edano How would I find out which button it which in the scrip of mine because of me removing the below Case $JNB $sfileSpec = "Filename" $file = FileOpen($sfileSpec, 0) If $file = -1 Then MsgBox(0, "Error", "Unable to open data file: '" & $sFileSpec & "'") Exit EndIf form the button ...... GUICtrlCreateButton("SET 1", 14, 45, 60, 25) GUICtrlSetFont(-1, 8, 400, 0, "Arial") GUICtrlSetBkColor(-1, 6075391) I am correct in saying that I should use "SET 1" now in case of "$JNB" or is this totally wrong .... Regards, CHOVIE
×
×
  • Create New...