Jump to content
Sign in to follow this  

'Undefined Function' Error

Recommended Posts


I am getting an undefined function error that i dont seem to understnad, either i'm too tired, or have had too much coffee.

Dim $strUninstallFullPath, $strComputer, $strValueName
Dim $strKeyPath, $tst, $pos

    Global $User = "servall"
    Global $Domain = "AMB"
    Global $Pass = "$tartMeUp"
$strComputer = "."
$strValueName = "UninstallString"

; Uninstall Yahoo IM...
    $strKeyPath = "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Yahoo! Messenger";<--- change as needed
    $strUninstallFullPath = RegRead("HKEY_LOCAL_MACHINE\" & $strKeyPath, $strValueName)
    If $strUninstallFullPath <> "" Then 
         $tst = "unwise.exe"
         $pos = StringInStr(StringLower($strUninstallFullPath),$tst)
        if $pos>0 Then
        ;found unwise.exe
            $pos = $pos + StringLen($tst)
            $strUninstallFullPath = StringLeft($strUninstallFullPath,$pos) & "/s " & StringMid($strUninstallFullPath,$pos)

        RunAsWait($User, $Domain, $Pass, 0, $strUninstallFullPath)  ; *** <-- Line 23 ***

; Uninstall MSN 7.5
    $strKeyPath = "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{CEB3A11A-03EA-11DA-BFBD-00065BBDC0B5}"
    $strUninstallFullPath = RegRead("HKEY_LOCAL_MACHINE\" & $strKeyPath, $strValueName)
    If $strUninstallFullPath <> "" Then RunAsWait($User, $Domain, $Pass, 0, "MsiExec.exe /x{CEB3A11A-03EA-11DA-BFBD-00065BBDC0B5} /quiet /norestart")       
; Uninstall AIM 6
    $strKeyPath = "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\AIM_6"
    $strUninstallFullPath = RegRead("HKEY_LOCAL_MACHINE\" & $strKeyPath, $strValueName)
    If $strUninstallFullPath <> "" Then UninstAIM()     

; Uninstall Windows Live Messenger 2008 8.5 
    $strKeyPath = "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{508CE775-4BA4-4748-82DF-FE28DA9F03B0}"
    $strUninstallFullPath = RegRead("HKEY_LOCAL_MACHINE\" & $strKeyPath, $strValueName)
    If $strUninstallFullPath <> "" Then RunAsWait($User, $Domain, $Pass, 0, $strUninstallFullPath & " /quiet /norestart")       

; Uninstall Windows Live Messenger
    $strKeyPath = "SOFTWARE\Microsoft\Windows Live\Messenger"
    $strValueName = "MSIProductCode"
    $MSIProductCode = RegRead("HKEY_LOCAL_MACHINE\" & $strKeyPath, $strValueName)
    $strUninstallFullPath = "MsiExec.exe /x" & $MSIProductCode & " /quiet /norestart"
    If $MSIProductCode <> "" Then RunAsWait($User, $Domain, $Pass, 0, $strUninstallFullPath)        
    MsgBox(0,"","IM's Uninstalled")

Func UninstAIM()
    RunAs($User, $Domain, $Pass, 0, "C:\Program Files\AIM6\uninst.exe") ; *** <-- Line 54 ***
        WinWait("AIM 6 Uninstall", "Uninstall AIM")
            ControlClick("AIM 6 Uninstall","OK", "[CLASS:Button; INSTANCE:1]")
        WinWait("AIM 6 Uninstall", "Personal Data")
            ControlClick("AIM 6 Uninstall", "Personal Data","[CLASS:Button; INSTANCE:2]")
            ControlClick("AIM 6 Uninstall", "AIM Plugins","[CLASS:Button; INSTANCE:3]")
            ControlClick("AIM 6 Uninstall", "Continue","[CLASS:Button; INSTANCE:1]")
        Winwait("AIM 6 Uninstall: Completed", "Completed")
            ControlClick("AIM 6 Uninstall: Completed", "&Close","[CLASS:Button; INSTANCE:2]")
        Winwait("AIM 6 Uninstall", "OK")
            ControlClick("AIM 6 Uninstall", "OK", "[CLASS:Button; INSTANCE:1]")

Here is the error...

D:\Temp\Scripts\Uninstall_IM_Clients.au3(23,60) : ERROR: RunAsWait(): undefined function.
        RunAsWait($User, $Domain, $Pass, 0, $strUninstallFullPath)
D:\Temp\Scripts\Uninstall_IM_Clients.au3(54,68) : ERROR: RunAs(): undefined function.
    RunAs($User, $Domain, $Pass, 0, "C:\Program Files\AIM6\uninst.exe")
D:\Temp\Scripts\Uninstall_IM_Clients.au3 - 2 error(s), 0 warning(s)

I cant figure out why it is erroring on RunAs and RunAsWait. I had this script running a couple months ago, but i dont remember if i made changes since the last time i ran it.

Some fresh eyes could help.


Share this post

Link to post
Share on other sites

Strange. No errors here. Are you using the latest AutoIt (V3.3.0.0)?


Share this post

Link to post
Share on other sites

Thought i was, but might not be. How can i tell for sure which version it is?

I am using SciTE4AutoIt for coding.

I'll download AutoIt again, and re-install just to be sure. I'll update here after.

Edited by TSprouse

Share this post

Link to post
Share on other sites

Ok, sorry all, false alarm. I did have a bit of an older version. I just installed Win7 RC and i must've grabbed on older autoit setup from my software folder, instead of getting it straight from the site.

thanks again.

Share this post

Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.