dextry Posted January 4, 2017 Share Posted January 4, 2017 (edited) Hello, I am a beginner when it comes to scripting but I am learning fast. I made a script to automate SAP login for work. I made this because we have 125 SAP instances and they all have a password that expires in 1 month if the agent doesn't log in. I need a script to export date details to .txt for when it was last runned so we can tell if that SAP instance password needs to be changed soon or it can wait. Can someone please help or give me a suggestion or a tip? This is the script. I know is very basic but I am beginner. PS: I ran the SAPLOGON application from cmd cuz it doesn't work if I just try to run it with "Run SAPLOGON.exe" Thanks in advance expandcollapse popup#include <GUIConstantsEx.au3> Run("cmd.exe") WinWait("C:\Windows\system32\cmd.exe") Send("start saplogon.exe") Send("{ENTER}") sleep(3000) WinClose("C:\Windows\system32\cmd.exe") WinActivate("SAP Logon 730", 5) ControlClick("SAP Logon 730", "", "[CLASS:Edit1]") Send("Everest MP EP1") Sleep(1000) Send("{ENTER}") WinActivate("SAP") Sleep(2000) $Ini = @ScriptDir& '\Username.txt' If FileExists($Ini) Then Local $TextIniRead1 = IniRead($Ini, "Paste", "1", "Not found") Else IniWrite($Ini, "Paste", "1", 'Username') EndIf HotKeySet('{-}', 'Username') Func Username() ConsoleWrite($TextIniRead1 & @CRLF) Send($TextIniRead1) EndFunc ;==>Mail1 Sleep(1000) Send("{-}") Sleep(2000) Send("{TAB}") $Ini = @ScriptDir& '\Password.txt' If FileExists($Ini) Then Local $TextIniRead1 = IniRead($Ini, "Paste", "1", "Not found") Else IniWrite($Ini, "Paste", "1", 'Password') EndIf HotKeySet('{+}', 'Password') Func Password() ConsoleWrite($TextIniRead1 & @CRLF) Send($TextIniRead1) EndFunc ;==>Mail1 Send("{+}") Sleep(1000) Send("{ENTER}") Sleep(1000) WinActivate("SAP Easy Access") Sleep(4000) WinClose("SAP Easy Access") Sleep(2000) WinActivate("SAP Logon 730") Sleep(4000) WinClose("SAP Logon 730") Edited January 4, 2017 by JLogan3o13 Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted January 4, 2017 Moderators Share Posted January 4, 2017 @dextry your question is unclear. Does this script work for you, and you're asking on how to improve it? Or is it not working? If it is not working, please explain in detail what is happening (errors, etc.) so we can assist. We need more detail in order to help you. "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
Subz Posted January 4, 2017 Share Posted January 4, 2017 @dextry - Recommend you look at http://saplsmw.com/Log_on _to_SAP_automatically_without_being_prompted_for_credentials I've used this method in the past for creating a special SAP Shortcut for Auto Logon which when you right click and edit the password without it being in clear text in a file. dextry 1 Link to comment Share on other sites More sharing options...
dextry Posted January 4, 2017 Author Share Posted January 4, 2017 Hello, thank you for the reply. The script works with no errors. It opens SAP logs me in and then logs me out. But I have like 125 SAP instances and SAP will lock my account in any of these instances if I do not log in at least 1 per month. I don't use them all but sometime I need to use like a SAP instance very rarely used and my account is locked cuz I didn't login at least once per month for that SAP instance. I wanted to know if I can add to my script something that will export the date details for when it was last runned. For Example: I run it today and it exports the date details (1/4/2017 ) in a .txt file. and next time I can see when I last runned the script and logged in for that SAP instance so I do have to log in to all SAP instances every 1-2 weeks. Because they are 125 even if I automated all the loggings it take 50+ minutes to run script for all instances. Thank you in advance. Link to comment Share on other sites More sharing options...
dextry Posted January 4, 2017 Author Share Posted January 4, 2017 2 minutes ago, Subz said: @dextry - Recommend you look at http://saplsmw.com/Log_on _to_SAP_automatically_without_being_prompted_for_credentials I've used this method in the past for creating a special SAP Shortcut for Auto Logon which when you right click and edit the password without it being in clear text in a file. Thanks very much Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted January 4, 2017 Moderators Share Posted January 4, 2017 If the script is working for you as-is, why not just set it using Task Scheduler to run every ~3 weeks. That way you're not having to parse a text file to see when you logged in last. "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
dextry Posted January 4, 2017 Author Share Posted January 4, 2017 4 minutes ago, JLogan3o13 said: If the script is working for you as-is, why not just set it using Task Scheduler to run every ~3 weeks. That way you're not having to parse a text file to see when you logged in last. Thank you for the reply. We have 40+ agent on the floor and 125 SAP instances. I will have to make a Task Scheduler for every instance on every agents machine. Let me know if you have any ideas. Thank you in advance:D Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted January 4, 2017 Moderators Share Posted January 4, 2017 Just to clarify, you have 40 different users, on 40 different machines, who could potentially login to one of 125 SAP instances. You want to capture the instances that are not logged into within 30 days, to avoid a lockout. Does that about sum it up? "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
dextry Posted January 4, 2017 Author Share Posted January 4, 2017 So yes, 40 users with 40 machines who can log in to 125 SAP Instances. and want to capture the instances that are not logged into within 30 days. I made the script for every SAP instance so they can run it and do nothing, it automatically logs them and logs out this insures that the account don't get locked. But there are to many instances and you cannot remember when was the last time you logged in to what instance in order to not get the account locked. If you have any suggestions I am listening. Thanks a lot for the support! Link to comment Share on other sites More sharing options...
Subz Posted January 5, 2017 Share Posted January 5, 2017 Did you create the a SAP Shortcut as per the instructions in Post#5? If so can you open the Shortcut.sap with Notepad and send through the results? Link to comment Share on other sites More sharing options...
caramen Posted January 5, 2017 Share Posted January 5, 2017 (edited) nvm. Edited January 5, 2017 by caramen My video tutorials : ( In construction ) || My Discord : https://discord.gg/S9AnwHw How to Ask Help || UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote Spoiler Water's UDFs:Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsPowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & SupportExcel - Example Scripts - WikiWord - Wiki Tutorials:ADO - Wiki 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