So I just got a new computer, and instantly went and installed Autoit onto it. I selected run script as default action when clicking on an au3 file, however every time I do this it opens the script in the editor. I can from there run the script no problem.
I've tried reinstalling and checking the settings by hitting "Ctrl+1" and have confirmed it is set to run, but yet it just continues to open in the editor.
Any ideas why this is happening or how to solve?
New system is windows 10, old was windows 7
Im trying to launch a .exe file that is nested within the program files (x86) folder structure. i have already used the standard RunAs Syntax and found that it fails to launch the application. I have switched to Run and that seems to work. My issue is I have to use RunAs as the applicaton would need to run under a completely different account. The Current logged in user is a Local User on the machine, however, the application must be run as a domain user. The Machine is domain connected.
have tried the following:
RunAs("username","logonpassword", $RUN_LOGON_PROFILE, "D:\Program Files (x86)\Vendor\Application Name\Exe Location\Executable.exe") The above fails to launch, there are no errors or syntax issues, it just does nothing when the variables are replaced for the correct values.
I did the same using the Run command
Run("D:\Program Files (x86)\Vendor\Application Name\Exe Location\Executable.exe") That seems to work fine, but runs in local user context. Any thoughts? Could it be a local Machine rights issue? Or have i missed something glaring in my script
This script used to work on an older version of AutoIT. Currently I am running AutoIT v220.127.116.11 and it's failing.
Func PublicIP() ;Post public facing IP address Local $url = 'https://www.google.com/search?client=opera&q=what+is+my+ip&sourceid=opera&ie=UTF-8&oe=UTF-8' Local $getIPaddress = BinaryToString(InetRead($url)) Local $sStart = 'clamp:2">' Local $sEnd = '</div>' Local $ipaddress = _StringBetween($getIPaddress, $sStart, $sEnd For $i In $ipaddress MsgBox(0, 'External IP', "Your public IP address is " & $i) Next EndFunc ;==>PublicIP The console output shows:
"C:\Users\user\Documents\AutoIT\Scripts\WSI Tools.au3" (197) : ==> Variable must be of type "Object".: For $i In $ipaddress For $i In $ipaddress^ ERROR ->14:12:16 AutoIt3.exe ended.rc:1 +>14:12:16 AutoIt3Wrapper Finished. >Exit code: 1 Time: 9.811
I'm listing the error message strings, and roughly matching the error code
Is this how to do error reporting? Is there a more simple way I don't know about?
I realise I might not need to trap @error inside $error. I like it this way b/c I have no fear of overwriting @error now; I don't even use it.
Func Send_Connect($address, $port) $socket = TCPConnect($address, $port) $error = @error If $error <> 0 Then Local $aError = ["-2 not connected.", _ "1 IPAddr is incorrect.", _ "2 port is incorrect."] $aError = "10060 Connection timed out." If $error < 0 Then $error = 0 If $error > 2 Then $error = 3 MsgBox(0, "TCP Connect Error", $aError[$error], 0) $socket = 0 EndIf Return $socket EndFunc
i have searched a lot about how to run external programs with the administrator privileges without the script running with administrator privileges using autoit
But all my attempts failed
Finally, today I found the VBS function doing this task
I immediately transferred it to our beloved language (autoit) and i decided to share it with you
i hope you like it
This is a simple example about how to use the function
runAsAdmin("cmd.exe", "/c @echo off & cls & echo test & pause", "c:\", @sw_show)
this is the function
func runAsAdmin($program, $parameters = "", $workingDir = @workingDir, $show = "") local $oShell = OBJCreate("Shell.Application") if isOBJ($oShell) then local $result = $oShell.ShellExecute($program, $parameters, $workingDir, "runas", $show) else $result = false endIf return $result endFunc