FrancescoDiMuro Posted March 8, 2019 Share Posted March 8, 2019 @Sankesh Check if WinGetHandle() returns a valid handle Click here to see my signature: Spoiler ALWAYS GOOD TO READ: Forum Rules Forum Etiquette Link to comment Share on other sites More sharing options...
Sankesh Posted March 9, 2019 Author Share Posted March 9, 2019 (edited) Hi , i getting some output for wingethandle which is attached. $hWnd = WinGetHandle("Reena Desktop Server") If @error Then MsgBox($MB_SYSTEMMODAL, "", "An error occurred when trying to retrieve the window handle of server.") Exit else MsgBox($MB_SYSTEMMODAL, "", $hWnd) EndIf $DBname="Oracle" If $DBname="Oracle" Then ControlClick ($hwnd, "", "[CLASS:Button; INSTANCE:4; TEXT:Oracle]","left", 1, 0, 0) MsgBox($MB_ICONINFORMATION, "", "The Database server is: " & $DBname) ElseIf $DBname="SQL Server" Then MsgBox($MB_ICONINFORMATION, "", "The Database server is: " & $DBname) ControlClick ($hwnd, "", "[CLASS:Button; INSTANCE:6; TEXT:SQL Server]","left", 1, 0, 0) ElseIf $DBname="Oracle Instant Client" Then ;MsgBox($MB_ICONINFORMATION, "", "The Database server is: " & $DBname) ControlClick ($hwnd, "", "[CLASS:Button; INSTANCE:5; TEXT:Oracle Instant Client]","left", 1, 0, 0) elseIf $DBname="DB2" Then ControlClick ($hwnd, "", "[CLASS:Button; INSTANCE:3; Text:DB2]","left", 1, 0, 0) MsgBox($MB_ICONINFORMATION, "", "The Database server is: " & $DBname) Else MsgBox($MB_ICONINFORMATION, "","Database Doesn't exist") Winclose("Reena Desktop server") endif why the value of winGethandle changes everytime i run whereas in autoit Info too i can see the value under window handle to be 0X000112058E. Msgbox printing the correct data whereas controlclick() not working My requirement is to switch between radio buttons based on the input through inifile. Is there a better way to write code for this since the above is not working. Edited March 9, 2019 by Sankesh Link to comment Share on other sites More sharing options...
FrancescoDiMuro Posted March 9, 2019 Share Posted March 9, 2019 @Sankesh Try to put WinActivate() before you try to click on your controls. TryControlCommand() too. Use code tags to insert the code in the post. Click here to see my signature: Spoiler ALWAYS GOOD TO READ: Forum Rules Forum Etiquette Link to comment Share on other sites More sharing options...
Sankesh Posted March 11, 2019 Author Share Posted March 11, 2019 Yeah radio buttons are clicked through Control command. Now i am getting Path of setup.exe input file from a shared location. When i get through shared path ,my script behaviour is different where its not clicking the radio button and skips to the nxt wizard where total script collapses . At some time the special characters get appended to the path file where its stopping the script to execute as attached in the image(Infront of C:\Users\dnataraj\).How to avoid this special character getting appended. Link to comment Share on other sites More sharing options...
FrancescoDiMuro Posted March 11, 2019 Share Posted March 11, 2019 @Sankesh Where is stored the installation path? In a file? If so, post it Click here to see my signature: Spoiler ALWAYS GOOD TO READ: Forum Rules Forum Etiquette Link to comment Share on other sites More sharing options...
Sankesh Posted March 11, 2019 Author Share Posted March 11, 2019 [xml] path=C:\JSqlAccessProperties.xml [ServerSetup] Filepath=\\socrates.global.ad\pune\dev\TCM\Cisco-Full\Production\BuildArchives\ReenaDesktop\TDT_4.x\Cisco_Reena_Desktop_4.0.0.0_GA\erver\s64\destop installer.msi [Database] Name=Oracle In the above ini file , sometimes the special characters get added either to path or Filepath. If i change the location back special characters get disappeared .Not sure what's the logic behind this.. Thanks a lot Francesco..without you definitely my automation was not possible Link to comment Share on other sites More sharing options...
Sankesh Posted March 11, 2019 Author Share Posted March 11, 2019 Got one hint ..that if file is placed in C:\ i can see that special characters maximum..but if it is placed in documents..probability is less. But msi files need to be placed in C:\ only so i want it to wrk in C:\ only Link to comment Share on other sites More sharing options...
FrancescoDiMuro Posted March 11, 2019 Share Posted March 11, 2019 @Sankesh Happy to helping, you're welcome How do you retrieve the information from the INI file? It could be an encoding issue. Click here to see my signature: Spoiler ALWAYS GOOD TO READ: Forum Rules Forum Etiquette Link to comment Share on other sites More sharing options...
Sankesh Posted March 11, 2019 Author Share Posted March 11, 2019 I am retrieving info through iniread() and storing the value in a variable. $Strfilepath=IniRead("C:\Users\dnataraj\Documents\TDTServer3958_installer\Server-64bit\server.ini","xml","path","") ;Fetching xml $Strserverfilepath=IniRead("C:\Users\dnataraj\Documents\TDTServer3958_installer\Server-64bit\server.ini","ServerSetup","Filepath","") ;Fetchig msi file $DBname=IniRead("C:\Users\dnataraj\Documents\TDTServer3958_installer\Server-64bit\server.ini","Database","Name","") ;Database selection from user Link to comment Share on other sites More sharing options...
FrancescoDiMuro Posted March 11, 2019 Share Posted March 11, 2019 (edited) @Sankesh Tried with this script: #include <Array.au3> #include <MsgBoxConstants.au3> Global $strFileName = @ScriptDir & "\SampleText.ini", _ $arrINISections $arrSections = IniReadSectionNames($strFileName) If @error Then ConsoleWrite("!IniReadSectionNames ERR: " & @error & @CRLF) Else For $i = 1 To $arrSections[0] Step 1 _ArrayDisplay(IniReadSection($strFileName, $arrSections[$i])) Next EndIf ;~ MsgBox(0, "", IniRead($strFileName, "xml", "path", "")) ;~ MsgBox(0, "", IniRead($strFileName, "ServerSetup", "Filepath", "")) ;~ MsgBox(0, "", IniRead($strFileName, "Database", "Name", "")) and with this file content (encoded in UTF-8): Spoiler path=C:\JSqlAccessProperties.xml [ServerSetup] Filepath=\\socrates.global.ad\pune\dev\TCM\Cisco-Full\Production\BuildArchives\ReenaDesktop\TDT_4.x\Cisco_Reena_Desktop_4.0.0.0_GA\erver\s64\destop installer.msi [Database] Name=Oracle and seems to work fine. Edited March 11, 2019 by FrancescoDiMuro Click here to see my signature: Spoiler ALWAYS GOOD TO READ: Forum Rules Forum Etiquette Link to comment Share on other sites More sharing options...
Sankesh Posted March 13, 2019 Author Share Posted March 13, 2019 #include <Array.au3> #include <MsgBoxConstants.au3> Global $arrINISections Global $strFileName = @ScriptDir & "\C:\TDT-Automation-Installers\TDT3957 installer\Server\Server-64 bit\server_3957.ini" Msgbox(0,"",$strFileName) $arrINISections = IniReadSectionNames($strFileName) Msgbox(0,"",$arrINISections) If @error Then ConsoleWrite("!IniReadSectionNames ERR: " & @error & @CRLF) Else For $i = 1 To $arrINISections[0] Step 1 _ArrayDisplay(IniReadSection($strFileName, $arrINISections[$i])) Next EndIf MsgBox(0, "", IniRead($strFileName, "xml", "path", "")) MsgBox(0, "", IniRead($strFileName, "ServerSetup", "Filepath", "")) MsgBox(0, "", IniRead($strFileName, "Database", "Name", "")) Hi Francesco, First of all thank you so much. i have executed the above code and i couldn't see the output i.e section path name and all..One more you hav edeclared arrINISections variable and haven't used inside the code. I am getting output as '1' for the 2 nd msgbox and the code stops over there. Can you help me on what's wrong with the above code.. Link to comment Share on other sites More sharing options...
FrancescoDiMuro Posted March 13, 2019 Share Posted March 13, 2019 58 minutes ago, Sankesh said: Msgbox(0,"",$arrINISections) $areINISections is an array, and checking the value of the @error code after calling a MsgBox is useless, since that function doesn't set any @error code. 1 hour ago, Sankesh said: One more you hav edeclared arrINISections variable and haven't used inside the code. $arrINISections is used everywhere in the code (lines 6, 10, and 12). 1 hour ago, Sankesh said: I am getting output as '1' for the 2 nd msgbox and the code stops over there As said above, $arrSections is an array, so you can't access to a whole array with a MsgBox. Remove that MsgBox and see if the code runs again Click here to see my signature: Spoiler ALWAYS GOOD TO READ: Forum Rules Forum Etiquette Link to comment Share on other sites More sharing options...
Sankesh Posted March 13, 2019 Author Share Posted March 13, 2019 #include <Array.au3> #include <MsgBoxConstants.au3> Global $arrINISections,$arrSections Global $strFileName = @ScriptDir & "C:\TDT-Automation-Installers\TDT3958_installer\Server\Server 64 bit\Server_3958_64bit.ini" $arrSections = IniReadSectionNames($strFilename) If @error Then ConsoleWrite("!IniReadSectionNames ERR: " & @error & @CRLF) Else For $i = 1 To $arrSections[0] Step 1 _ArrayDisplay(IniReadSection($strFileName, $arrSections[$i])) Next EndIf ;~ MsgBox(0, "", IniRead($strFileName, "xml", "path", "")) ;~ MsgBox(0, "", IniRead($strFileName, "ServerSetup", "Filepath", "")) ;~ MsgBox(0, "", IniRead($strFileName, "Database", "Name", "")) On executing the above i got error..not sure where is wrong. Basically what i understood in the above code is its reading the section name of the ini file. My code also reading the value in the key..but while reading the value special character gets added. Is there any way to amend that? Link to comment Share on other sites More sharing options...
Sankesh Posted March 13, 2019 Author Share Posted March 13, 2019 Tried this code $ini = IniReadSectionNames("C:\Users\dnataraj\Desktop\xml.ini") _ArrayDisplay($ini) $de=IniReadSection ( "C:\Users\dnataraj\Desktop\xml.ini", "Ls2app" ) _ArrayDisplay($de) i got the output as attached where special characters are coming here also.Don't know how to resolve this. From the below image i can confirm the ini file is getting read but the path specified inside ini file is where the issue is. ini file: [Ls2app] lpath=C:\ls2app.ini Is there any other way to specify "C:\ls2app.ini" in lpath to make special character disappear. Thanks France!!! Link to comment Share on other sites More sharing options...
FrancescoDiMuro Posted March 13, 2019 Share Posted March 13, 2019 @Sankesh Could you please attach the file in which those strange characters appear? Click here to see my signature: Spoiler ALWAYS GOOD TO READ: Forum Rules Forum Etiquette Link to comment Share on other sites More sharing options...
Sankesh Posted March 13, 2019 Author Share Posted March 13, 2019 For both the attached files , while reading the path i am getting that strange character. xml.ini tdt_3957.ini Link to comment Share on other sites More sharing options...
FrancescoDiMuro Posted March 13, 2019 Share Posted March 13, 2019 @Sankesh As said before, it was an encoding issue. This is the text displayed with ASCII encoding: Spoiler This is the text displayed with UTF-8 encoding: Spoiler Just open the file with Notepad++, display the text in ASCII, remove those characters, convert it to UTF-8, and save it Click here to see my signature: Spoiler ALWAYS GOOD TO READ: Forum Rules Forum Etiquette Link to comment Share on other sites More sharing options...
Sankesh Posted March 15, 2019 Author Share Posted March 15, 2019 Good Morning Francesco, File encoding issue resolved. Currently creating a folder inside a specified path using the below code .But "Logs" folder is not getting generated. Is there any good way to create it? My requirement is inside socrates i have to create a folder "Logs". Global $a Global $dir = "C:\Program Files\Socrates" If $dir = -1 Then MsgBox($MB_SYSTEMMODAL, "", "Specified Directory doesn't exist") Exit Else $a=Dircreate("C:\Program Files\Socrates\Logs") EndIf Link to comment Share on other sites More sharing options...
FrancescoDiMuro Posted March 15, 2019 Share Posted March 15, 2019 (edited) @Sankesh If you manually create the folder, do you have any error? Edited March 15, 2019 by FrancescoDiMuro Click here to see my signature: Spoiler ALWAYS GOOD TO READ: Forum Rules Forum Etiquette Link to comment Share on other sites More sharing options...
Sankesh Posted March 15, 2019 Author Share Posted March 15, 2019 No i am not facing any error while creating manually 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