-
Posts
916 -
Joined
-
Last visited
-
Days Won
2
Content Type
Forums
Downloads
Forum Articles
Events
Everything posted by ViciousXUSMC
-
Sort of a Necro Post but on topic, seemed better to pick up here with half the answer instead of starting a new thread. I just built a new computer and it keeps constantly having text size issues, and it seems to be a Windows bug related to scaling. The fix is to change one and/or both of the settings the Scaling as mentioned in this thread, but definitly for sure I have to often search for "text size" and change this value to something other than 100%, and then change it back and it fixes all my issues. Since this is one of those random MS bugs that probably nobody will ever fix, trying to just create a script that can reset these settings for me and set it to a hotkey or something. So my question is, as I have searched and had no luck. What is the SystemParameter for the Font Size? I used to use something like a registry change compare program and find what keys get changed and do my scripts that way, but you guys seem to find much better ways to make these changes, especially the ones that need a specific "trigger" to refresh without a reboot. Though I would not be supprised if I needed to close and reopen explorer.exe or something as even when making the change in the GUI it appears like it does that briefly.
-
Because when you run a command like MSIEXEC the next part of the script wont run until it returns. I just use .bat files for this stuff and only AutoIT for really advanced things, so from Autoit you could use ShellExecuteWait() or RunWait() so it waits for a return before proceeding. Even if something requires configuration, chances are those configs are saved to a file that you can copy post install, or parameters you can set during the install. Like I said 99% of the time a silent install is possible. For enterprise I use MSI files as much as possible, so I always extract the Adobe .exe's to a MSI file and then you can use the Adobe Customization Wizard to create a MST that has any features set you need and create a MST file. Here is the .bat I use for Adobe Reader, it allows techs to install it in one click easy and also how I call the install from SCCM. Then I can just also call the .BAT from Autoit or another .BAT file if some kind of sequence of events is needed. Also leaves me a nice paper trail to verify things down the road. pushd %~dp0 MKDIR C:\Automate\Logs Set Logfile="C:\Automate\Logs\AdobeReaderDC_Install.log Echo %time% %date% Batch Install Started by %username% >> %logfile% Echo %time% %date% Starting Install of Adobe Reader DC v21.7.20091.59174 >> %logfile% msiexec.exe /qn /i "AcroRead.msi" TRANSFORMS="Enterprise_Modifications.mst" /L*V C:\Automate\Logs\AdobeReaderDC_Install_MSI.log Echo %time% %date% Starting Install of Adobe Reader DC v21.7.20091.59174 Update Patch >> %logfile% msiexec.exe /p AcroRdrDCUpd2100720091.msp /qn /L*V C:\Automate\Logs\AdobeReaderDCPatch_Install_MSI.log Echo %time% %date% Completed Install of Adobe Reader DC v21.7.20091.59174 >> %logfile% popd
-
BTW Adobe Reader always has a silent install. I just built one the other day for the newest version. If this is a learning journey I support you for trying to find solutions and learn, if its strictly for getting a task done and you want it as professional and seamless as possible, you will want to set this up as a zero touch silent install.
-
Help me please for StringRegExpReplace
ViciousXUSMC replied to mixim's topic in AutoIt General Help and Support
Same as I posted except no need for RegEx just StringReplace will suffice. The main rule of RegEx is only use RegEx when its needed -
That almost definitely sounds like your script is getting ahead of itself and its catching it the 2nd time thru. You should be able to use control functions and not rely on coordinates to click, or at minimum purely keyboard commands. Using coordinates can lead to a point of failure when people have different scaling options set on the computer. Check your WinWait() and ensure that the text used can not match the pre-existing window.
-
Help me please for StringRegExpReplace
ViciousXUSMC replied to mixim's topic in AutoIt General Help and Support
I am sure there is a way to do this with pure regex using StringRegExpReplace() however since the matches are simple enough my thought process is to use a function that contains all your corresponding matches and replacements in an array or map or something and just use StringReplace() Also you can try nesting functions. $sString = "+h!s is @ test" $sNewString = StringReplace(StringReplace(StringReplace($sString, "+", "t"), "!", "i"), "@", "a") MsgBox(0, "", $sNewString) -
A few things, always for automating an install have #RequireAdmin in the script, that should elevate everything and hopefully prevent any security popups after you kick it off. Second 99% of everything can be silently installed without automating the GUI, in 15 years of doing this I have had only 1 or 2 things that did not have some method to silent install, even if it was a method I had to create myself. Third for automating GUI's if you have to go that route I always place a WinActivate() before each step to ensure the windows is up and active. And the last time I had a GUI automation fail like this it was because my text was not specific enough to wait for the correct window, and it was matching the previous window thus proceeding ahead in the script. So, based on the above I think you should be able to install that file with MSIEXEC with the /qn flags to silently install, if you need to tweak specific parameters, you can probably edit the MSI file or create a MST file.
-
This is also my thinking, could just update the array element and then use the _FileWriteFromArray() also currently stringinstr() is not the function to use if he needs RegEx. However I thought if the file is large and its only like 3ish that needs to be read it could be pretty inefficient. The other bonus is he could write the new array to a totally different file and preserve the original as a backup of sorts.
-
If its always line 3 you can just use the function to write to the line without any read first. You can also if you only need to check like 3 and not the whole file use FileReadLine() to read that specific line, and then write based on the results. Just a more streamlined way to do it if the conditions you need to check have more specific parameters.
-
Too many IF Statements
ViciousXUSMC replied to SkysLastChance's topic in AutoIt General Help and Support
Use a function to do that with a return value so you can exit your loop as soon as the match is found and have it return the value you want as part of the function. Else put an ExitLoop as part of your If/then statement to at least save some loops when the first value is matched. #include <Array.au3> Global $aStateArray[4][2] = [["Alabama","AL"],["Arkansas","AR"],["Arizona","AZ"],["Alaska","AK"]] $vAbbreviations = "Alaska" Local $iIndex = _ArraySearch($aStateArray, $vAbbreviations) For $i = 0 to UBound($aStateArray, 2)-1 If $aStateArray[$iIndex][$i] = $vAbbreviations Then $iSubIndex = $i Next MsgBox(0, "Found",$aStateArray[$iIndex][1]) ;New Code MsgBox(0, "Found", AbrevLookup($vAbbreviations)) ;Functions Func AbrevLookup($sState) For $i = 0 to UBound($aStateArray) -1 If StringInStr($aStateArray[$i][0], $sState) Then Return $aStateArray[$i][1] Next EndFunc -
Most of the time if you look, the application will store this "license" somewhere and you can brute force it by editing a file, a registry key, something. Unless it has to reach out to the cloud, but even then usually there is a way to embed it during install so that at first launch it will reach out to do that. As far as your method, as mentioned Send is very crude and a last resort. Atleast look into ControlSend() or something. If you absolutely MUST activate it at first launch, well then perhaps dont give the users a shortcut to the application, but a shortcut to your application. Which then launched the native application and does the activation stuff, upon completion deletes the shortcut to the autoit script and then replaces it with a shortcut to the original application.
-
Video Conferencing unmute using space bar
ViciousXUSMC replied to echan101's topic in AutoIt General Help and Support
Assuming you normally keep the Zoom window up when you use the feature you built the code for. You could just say "only do this if Zoom window is active" that way the spacebar would work normally in all other circumstances. If you keep the window hidden, you can then downgrade this to "does the process/window exist" Lastly you could just use a different key that is not normally very used like one of the F Keys. -
I had some kind of crazy Oracle installer that gave me a random box that would break automation. I handled it in a different way. Because I had no idea when it would pop up rather than being in sequence I simply had a AdlibRegister() function checking for that pop up window and if it came up, it would close it. Worked well for me.
-
I have nothing I can use for testing right now, but I can say in the past I used PLINK for my Putty automation. If you use the AutoIT window info tool and you do not see any text listed, then you will not get anything from WinGetText() I want to say you can have Putty pretty much log everything to a log file as its running, and then you can read that file as a workaround.
-
Printer autoprint a file
ViciousXUSMC replied to ndeepdesigns's topic in AutoIt General Help and Support
I made a inventory kiosk once for Fire Rescue that they would use a GUI to enter information for why they are turning in a computer for repair (and update a database so I knew the current status of all our inventory) That data was used to fill a word template and then printed automatically using Waters Word UDF. https://www.autoitscript.com/autoit3/docs/libfunctions/_Word_DocPrint.htm -
So I got a crazy request this morning. Company wants to buy new laptops because they (HP 840 G6) have these Call Answer/Decline buttons built in. It works for Cisco Jabber and Skype and uses the HP Collaboration Keyboard Software as a wrapper to intercept these programs, then light up the keys on the keyboard. In order to save a lot of time and money buying, building and deploying new computers for such a simple feature I wanted to come up with a creative solution. Assuming they just want hardware keys they can press, I could do something as simple as this. HotKeySet("=", _AnswerCall) HotKeySet("-", _DeclineCall) While 1 Sleep(1) WEnd Func _AnswerCall() Send("^l") EndFunc Func _DeclineCall() Send("^d") EndFunc I do not know how the HP software detects and interfaces with the software, but I was able to find the hotkey shortcuts to preform these features. But what I think they actually want (demand) is seeing a key light up and being able to press it. So still cheaper than a new laptop I was thinking something like the Elgato StreamDeck. What I need to find is an external device with keys that I can have it light up or change graphics when a call comes in with jabber, and press the button to answer/decline the call. I don't know of any device that does this out of the box, so I was thinking of using AutoIT as a way to "make it smart" I am posting this because a few things. 1.) Does anybody know a good device to do something like this with? 2.) When I find the device I need to start getting into the code on how to make it work. So the stream deck it looks like there is some kind of developer feature where you can update graphics. https://developer.elgato.com/documentation/stream-deck/sdk/events-sent/#setimage I assume I can find a way to detect a call coming in (hoping something as simple as If WindowExisits() will work, then need to find a way to interface with this SDK to change the icons to show the call is ringing. I have no idea how to actually interface with this SDK, or if everything could be done without AutoIT at all. Kind of opening up the floor here for discussion, code ideas, and alternative products that may work easier for what I am trying to do. Edit: Might be onto an easier solution using the Stream Deck. Smart Profiles. https://www.youtube.com/watch?v=gUI3IAabaXs&ab_channel=SlurpTech Detect when a call is coming in, and have AutoIT run a breadcrumb program, that should change the profile and that profile will have the answer/decline buttons. Would need testing to see how good it actually works. Still looking forward to discussion about other ideas/products and possibly the best way to detect these things. I cant test until I get into the office next week.
-
I dont see a point where you ever exit that function, so I dont see a reason to make it a function at all. Your best friends in this situation are ContinueLoop, ExitLoop, and you can call a function from inside a function so some of your commands or if statements can be part of another function to help break down the logic.
-
Invoke AutoIt script over local network
ViciousXUSMC replied to riceking's topic in AutoIt General Help and Support
taskkill /s remoteServer /u userName /FI "IMAGENAME eq filename" Something to that extent can remotely kill the process if you have admin rights You can use Autoit to create a nice GUI so they can supply the credentials, but it can easily be done just in .bat file as well. Then on the remote machine, use Autoit to create some kind of Daemon that checks if the process is running and if not restarts it. Better yet, find a way to completely resolve the issue on the local machine rather than needing any remote interaction at all. Look at things like what changes when its in the "crashed" state, what kind of breadcrumb can you follow, like CPU usage, RAM usage, A service not responding, etc. ....and of course if you can get to the root cause and prevent it from crashing at all, that would be most ideal. Here is something I wrote for the helpdesk to restart the print spooler for a users computer that lets them use an AD search to find the computer and remotely restart the service. #Include <AD.au3> #Include <File.au3> #include <Constants.au3> #include <StaticConstants.au3> #include <ExtMsgBox.au3> #include <Array.au3> #include <Services.au3> HotKeySet("{ESC}", "_Terminate") ;Set ESC Key to Force Exit Program If Remote Computer Hangs Global $sINI = @ScriptDir & "\Config_StartServiceRemote.ini" If NOT FileExists($sINI) Then ;See if our configuration file exist, if not create it IniWrite($sINI, "CONFIG", "RemoteService", "spooler") IniWrite($sINI, "CONFIG", "ShowSplash", "1") IniWrite($sINI, "CONFIG", "Debug", "0") EndIf Global $iDebug = INIRead($sINI, "CONFIG", "Debug", "0") ; Set 0 for Normal Operation, Set 1 to See Debug Information Global $sService = INIRead($sINI, "CONFIG", "RemoteService", "spooler") ;Global Varible for Service we want to work with Global $iSplash = INIRead($sINI, "CONFIG", "ShowSplash", "1") ;Global Varible to Show or Hide Status Messages 0 Off 1 On $sPCN = InputBox("IIO Automation - Find Computer By PCN", "Input PCN To Search For", "") ;Ask user to input a PCN Value If @Error = 1 Then Exit $sResult = "" _AD_Open() ;Open Connection To AD GLOBAL $sOU = "OU=*snip*" ;Define a Specific OU To Search In GLOBAL $aObjects[0][0] ;Define The Array To Store Results $aObjects = _AD_GetObjectsInOU("", "(&(objectclass=computer)(sAMAccountName=*" & $sPCN & "*))", 2, "sAMAccountName") ;AD Query Searching for Computers and A Description Starting With X If @error > 0 Then ;If We Have No Results MsgBox(64, "Active Directory", "No Results Found or Bad Query") ;Show Error Message Exit Else For $i = 1 To $aObjects[0] $aObjects[$i] = StringTrimRight($aObjects[$i], 1) Next EndIf _AD_Close() ;Close Connection to AD If $aObjects[0] > 3 Then $aObjects[0] = 4 ;If element count is more than 4 than it will be reduced to only 4 If $iDebug = 1 then _ArrayDisplay($aObjects) $sObjects = _ArrayToString($aObjects, "|", 1, $aObjects[0]) ;This moves the array into a string for use as buttons; uses the element count to determin how many buttons If $iDebug =1 Then MsgBox("Show Array", "", $sObjects) _ExtMsgBoxSet(1, 2, 0x004080, 0xFFFF00, 10, "Comic Sans MS", 1000, 1200) ;Set our message box global style $sMsg = "Click The Computer You Want To Connect To" $iRetValue = _ExtMsgBox($EMB_ICONEXCLAM, $sObjects, "Found Computers by PCN", $sMsg, 0) If @Error Then MsgBox(0, "There Was An Error Code Returned", @Error) ConsoleWrite("Test 3 returned: " & $iRetValue & @CRLF) If $iRetValue = 0 Then Exit ; Reset to default _ExtMsgBoxSet(Default) If $iDebug = 1 Then MsgBox(0, "Computer Chosen", $aObjects[$iRetValue]) TCPStartup() $sComputerName = $aObjects[$iRetValue] $sComputerIP = TCPNameToIP($aObjects[$iRetValue]) TCPShutdown() If $iDebug = 1 Then MsgBox(0, "Computer IP", $sComputerIP) ;Returns Are $aObjects[$iRetValue] for Computer Name and $sComputerIP for IP Address $aStatus = _Service_QueryStatus($sService, $sComputerName) If $iDebug = 1 Then _ArrayDisplay($aStatus) If $aStatus[1] = $SERVICE_RUNNING Then $iResponce = MsgBox($MB_YESNO, "IIO Automation", "Service " & $sService & " Is Already Running" & @CRLF & "Try To Restart?") If $iResponce = $IDYES Then _RestartServiceX() Else Exit EndIf EndIf _StartServiceX() Func _RestartServiceX() _Service_Stop($sService, $sComputerName) If $iSplash =1 Then SplashTextOn("IIO Automation", "Stopping " & $sService & " Service" & @CRLF & "Press Escape To Cancel", 500, 100) Do Sleep(100) $aStatus = _Service_QueryStatus($sService, $sComputerName) Until $aStatus[1] = $SERVICE_STOPPED SplashOff() ;_StartServiceX() EndFunc Func _StartServiceX() _Service_Start($sService, $sComputerName) If $iSplash = 1 Then SplashTextOn("IIO Automation", "Starting " & $sService & " Service" & @CRLF & "Press Escape To Cancel", 500, 100) Do Sleep(100) $aStatus = _Service_QueryStatus($sService, $sComputerName) Until $aStatus[1] = $SERVICE_RUNNING SplashOff() MsgBox($MB_OK, "IIO Automation", $sService & " Service Has Been Started on " & $sComputerName) Exit EndFunc Func _Terminate() Exit EndFunc -
RunAs Powershell Set Default Printer
ViciousXUSMC replied to ViciousXUSMC's topic in AutoIt General Help and Support
No luck in that, added it to the elevation script thought it might work. Its essentially the same code I was using in my powershell script but I liked that I could run it natively. -
RunAs Powershell Set Default Printer
ViciousXUSMC replied to ViciousXUSMC's topic in AutoIt General Help and Support
Not yet, but sure will -
RunAs Powershell Set Default Printer
ViciousXUSMC replied to ViciousXUSMC's topic in AutoIt General Help and Support
Yes I had it working, we did more testing and it's still not working. WHEN it is working the powershell will exit 0, running as RunAs 0. When it is not working it will exit 2. what it appeared was happening is RunAs 1, which always exits 0, if run first would then have the next run of RunAs 0 work. I repeated it a couple of times I thought, but at the end of the day had a user I could not get it working. I wonder if maybe one of my test users was a local admin and the other was not, and I am still stuck with this one. It still works 100% of the time every time when done manually, but of course that requires me to type in the credentials for UAC and thus gives me administrative elevation when just RunAs() does not. So I need to find a way to get this working in my elevation script I suppose.