BrewManNH Posted January 18, 2019 Posted January 18, 2019 (edited) 4 hours ago, MadhaN said: I checked in help file i cannot understand proper since i have no knowledge in scripting. Perhaps you should start getting some knowledge in scripting, or give up trying to script if you're unwilling or unable to learn how to. Otherwise, all you're going to do is get code you don't understand doing things you don't know, without doing anything to help yourself learn anything. We can teach you to fish, but if you're not going to pick up the pole and start fishing, you're going to find it extremely difficult to do any scripting on your own, or you could just keep begging people to barf up code for you. Edited January 18, 2019 by BrewManNH If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator
Nine Posted January 18, 2019 Posted January 18, 2019 Brew is in a bad mood. Happens when full moon. Skysnake 1 “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Debug Messages Monitor UDF Screen Scraping Round Corner GUI UDF Multi-Threading Made Easy Interface Object based on Tag
BrewManNH Posted January 18, 2019 Posted January 18, 2019 11 minutes ago, Nine said: Brew is in a bad mood. Happens when full moon. Not at all, just sick of the whining and lack of effort shown. Not knowing how to script is an excuse to learn how to, not an excuse to do nothing and expect everyone else to do it for him. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator
MadhaN Posted January 19, 2019 Author Posted January 19, 2019 Hi all, I made the below script which is working partially , its not searching exact match. I wanna Search Exact match . #include <File.au3> #include <Array.au3> #include <MsgBoxConstants.au3> $sFilePath="test.csv" $aRetArray=$sFilePath _FileReadToArray($sFilePath, $aRetArray, $FRTA_NOCOUNT, ",") ;_ArrayDisplay($aRetArray, "2D array - no count", Default, 8) Local $sSearch = InputBox("_ArraySearch() demo", "String to find?") If @error Then Exit Local $sColumn = 0 ;InputBox("_ArraySearch() demo", "Column to search?") If @error Then Exit $sColumn = Int($sColumn) Local $iIndex = _ArraySearch($aRetArray, $sSearch, 0, 0, 0, 1, 1, $sColumn) If @error Then MsgBox($MB_SYSTEMMODAL, "Not Found", '"' & $sSearch & '" was not found on column ' & $sColumn & '.') Else ;MsgBox($MB_SYSTEMMODAL, "Found", '"' & $sSearch & '" was found in the array at position ' & $iIndex & ' on column ' & $sColumn & '.') MsgBox($MB_SYSTEMMODAL, "Found", '"' & $sSearch & '" was found in the array at position ' & $aRetArray[$iIndex][0] & $aRetArray[$iIndex][1] & '.') EndIf
MadhaN Posted January 19, 2019 Author Posted January 19, 2019 Hai All, Finally i created as i required. But one thing is i wanna hide the CMD , It should execute command . Local $iIndex = _ArraySearch($aRetArray, $sSearch, 0, 0, 0, 2, 1,0) ; $sColumn) If @error Then MsgBox($MB_SYSTEMMODAL, "Not Found", '"' & $sSearch & '" was not found on column ' & $sColumn & '.') Else ;MsgBox($MB_SYSTEMMODAL, "Found", '"' & $sSearch & '" was found in the array at position ' & $iIndex & ' on column ' & $sColumn & '.') ; MsgBox($MB_SYSTEMMODAL, "Found", '"' & $sSearch & '" was found in the array at position ' & $aRetArray[$iIndex][0] & $aRetArray[$iIndex][1] & '.') Run("C:\WINDOWS\system32\cmd.exe") $win=WinWaitActive("C:\WINDOWS\system32\cmd.exe") send('rdp /v:' & $aRetArray[$iIndex][2] &' '&'/u:'&$aRetArray[$iIndex][3] &' ' &'/p:'&$aRetArray[$iIndex][4] & "{ENTER}") EndIf
MadhaN Posted January 19, 2019 Author Posted January 19, 2019 Hi all, Please guide me to hide the Run function ( I tried with @SW_HIDE but i cannot send variables cmd. Hepo you guys will help.
Subz Posted January 19, 2019 Posted January 19, 2019 Something like Run(@ComSpec & ' /c rdp /v:' & $aRetArray[$iIndex][2] &' '&'/u:'&$aRetArray[$iIndex][3] &' ' &'/p:'&$aRetArray[$iIndex][4], "", @SW_HIDE)
FrancescoDiMuro Posted January 19, 2019 Posted January 19, 2019 (edited) @MadhaN If you did put the effort through which you ask for code in reading the Help file, you'd already finished your script. In the Help file, about Run() function, there is specified: To run DOS (console) commands, try Run(@ComSpec & " /c " & 'commandName', "", @SW_HIDE) ; don't forget " " before "/c" Edited January 19, 2019 by FrancescoDiMuro Click here to see my signature: Spoiler ALWAYS GOOD TO READ: Forum Rules Forum Etiquette
MadhaN Posted January 19, 2019 Author Posted January 19, 2019 hI all, Now every thing working fine, But if i modify( increase the rows) my csv file its gives error. Please help to resolve. #include <File.au3> #include <Array.au3> #include <MsgBoxConstants.au3> #include <Process.au3> $sFilePath="ip.csv" $aRetArray=$sFilePath _FileReadToArray($sFilePath, $aRetArray, $FRTA_NOCOUNT, ",") _ArrayDisplay($aRetArray, "2D array - no count", Default, 8)
Nine Posted January 19, 2019 Posted January 19, 2019 Make sure ip.csv is in same folder as your script. Why do you assign to your array the name of the file ? Just declare it like Local $aRetArray. “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Debug Messages Monitor UDF Screen Scraping Round Corner GUI UDF Multi-Threading Made Easy Interface Object based on Tag
MadhaN Posted January 19, 2019 Author Posted January 19, 2019 @Nine I tried but same error , can you pls show me simple example , where i can understand clear.
MadhaN Posted January 19, 2019 Author Posted January 19, 2019 @Nine I tried but same error , can you pls show me simple example , where i can understand clear. Note : Am using 2d array
Nine Posted January 19, 2019 Posted January 19, 2019 (edited) put that debug message after _FileReadToArray. MsgBox (0,"",@error) so we know what kind of error you got ps. stop begging it's getting irritating !!! Edited January 19, 2019 by Nine “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Debug Messages Monitor UDF Screen Scraping Round Corner GUI UDF Multi-Threading Made Easy Interface Object based on Tag
MadhaN Posted January 19, 2019 Author Posted January 19, 2019 hi , Am getting same error again . What will be the reason
BrewManNH Posted January 19, 2019 Posted January 19, 2019 The error is pretty self-explanatory. You aren't giving the function an array, figure out why that is, and then go from there. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator
MadhaN Posted January 19, 2019 Author Posted January 19, 2019 @Nine , Hi, Am getting "1" before showing the error , after adding below line. What will be the issue. MsgBox (0,"",@error)
MadhaN Posted January 19, 2019 Author Posted January 19, 2019 @Nine , This is my final script working fine, when i use small file (30rows and 6 column ), But i i user file with 1000+ rows am getting error. expandcollapse popup; using a 2D array #include <File.au3> #include <Array.au3> #include <MsgBoxConstants.au3> #include <Process.au3> Example() Func Example() $aRetArray = 0 $sFilePath="123.csv" $aRetArray=$sFilePath _FileReadToArray($sFilePath, $aRetArray, $FRTA_NOCOUNT, ",") MsgBox (0,"",@error) _ArrayDisplay($aRetArray, "2D array - no count", Default, 8) Local $sSearch = InputBox(" RDP", "Enter ID:") If @error Then Exit Local $sColumn = 0 ;InputBox("_ArraySearch() demo", "Column to search?") If @error Then Exit $sColumn = Int($sColumn) Local $iIndex = _ArraySearch($aRetArray, $sSearch, 0, 0, 0, 2, 1,0) ; $sColumn) If @error Then MsgBox($MB_SYSTEMMODAL, "ID Not Found", '"' & $sSearch & '" was not found on ID ' & $sColumn & '.') Else _RunDos('rdp /v:' & $aRetArray[$iIndex][2] &' '&'/u:'&$aRetArray[$iIndex][3] &' ' &'/p:'&$aRetArray[$iIndex][4] & "{ENTER}") EndIf FileDelete($sFilePath) EndFunc ;==>Example
MadhaN Posted January 19, 2019 Author Posted January 19, 2019 @Nine , am getting "3" error , it mean $aArray has too many dimensions, But how to resolve this.
BrewManNH Posted January 19, 2019 Posted January 19, 2019 28 minutes ago, MadhaN said: am getting "3" error , it mean $aArray has too many dimensions, No, it doesn't mean that. It means you have an inconsistent CSV file, there's more fields in some of the lines than in the rest. For example some of the lines may have 4 fields separated by commas, and in others there may be 3 fields separated by commas. The error messagebox is coming after the FRTA function. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator
Nine Posted January 19, 2019 Posted January 19, 2019 (edited) As Drew said, some lines have not enough or too much commas. Take a careful look at your file, it's probably a mistake you have made when entering manually the lines. A comma is very close to a dot Edited January 19, 2019 by Nine “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Debug Messages Monitor UDF Screen Scraping Round Corner GUI UDF Multi-Threading Made Easy Interface Object based on Tag
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