Sign in to follow this  
Followers 0
mattw112

AdlibEnable

7 posts in this topic

Hi,

I'm having problems getting this to work. I'm pretty new to this as well.

I've seen the simple examples in the help and in a few other places as well, but what I want to do is a whole script full of stuff, but just have this running in case somethign pops up. It seems like when I try it though it doesn't do my script of stuff and just waits for this guy?

I don't have the specific code, but high level I was trying this:

Run a setup program

AdlibEnable("myadlib1")

Code for dialogs to watch for for the install program

myadlib1

watch for other stuff, close if they show up)

Exit

Any suggestions or places I should go look at examples?

Thanks,

Terry

Share this post


Link to post
Share on other sites



According to the documentation for Adlibenable, your main script is paused when this is running. Also, Adlibenable should be very short and not run too frequently, otherwise your main script will continue to be paused every time Adlibenable launches your function.

So, by your example above, every 250 milliseconds (default time for AdlibEnable), your main scripting is being paused while 'myadlib1' runs - when it completes, your main script resumes only to be paused another 250 milliseconds later.

Share this post


Link to post
Share on other sites

myadlib1

watch for other stuff, close if they show up)

Exit

It would help if you posted all of your code or at least all of the adlib code. Did you happen to use a WinWait in your adlib? You might want If WinExists... then do something

[size="1"][font="Arial"].[u].[/u][/font][/size]

Share this post


Link to post
Share on other sites

It would help if you posted all of your code or at least all of the adlib code. Did you happen to use a WinWait in your adlib? You might want If WinExists... then do something

Below is what I was trying...

AutoItSetOption ( "TrayIconDebug", 1)

Opt ( "WinTitleMatchMode", 2 )

Opt ( "WinTextMatchMode", 2 )

Run ("rundll32 C:\PROGRA~1\Novell\NOVELL~1\nippppi.dll,iPrintAdminRightsCheck", "", @SW_MAXIMIZE)

AdlibEnable("myadlib1")

Sleep (2000)

WinWait ("iPrint", "This will remove iPrint from your computer. Do you wish to proceed?", 600)

WinActivate ("iPrint", "This will remove iPrint from your computer. Do you wish to proceed?")

Sleep (500)

Send ("{TAB}")

Send ("{ENTER}")

WinWait ("iPrint", "iPrint has been successfully uninstalled from your machine.", 600)

WinActivate ("iPrint", "iPrint has been successfully uninstalled from your machine.")

Sleep (500)

Send ("{ENTER}")

Func myadlib1()

If WinWait("Novell iPrint Uninstall", "The system cannot find the file specified.", ) Then

WinActivate("Novell iPrint Uninstall", "The system cannot find the file specified.", )

WinWaitActive("Novell iPrint Uninstall", "The system cannot find the file specified.", )

Sleep (500)

Send("{ENTER}")

Exit

EndIf

EndFunc

Exit

AdlibEnable("myadlib2")

Func myadlib2()

If WinWait("RUNDLL", "Error loading C:\PROGRA~1\Novell\NOVELL~1\nippppi.dll", ) Then

WinActivate("RUNDLL", "Error loading C:\PROGRA~1\Novell\NOVELL~1\nippppi.dll", )

WinWaitActive("RUNDLL", "Error loading C:\PROGRA~1\Novell\NOVELL~1\nippppi.dll", )

Sleep (500)

Send("{ENTER}")

Exit

EndIf

EndFunc

Exit

Share this post


Link to post
Share on other sites

Below is what I was trying...

AutoItSetOption ( "TrayIconDebug", 1)

Opt ( "WinTitleMatchMode", 2 )

Opt ( "WinTextMatchMode", 2 )

Run ("rundll32 C:\PROGRA~1\Novell\NOVELL~1\nippppi.dll,iPrintAdminRightsCheck", "", @SW_MAXIMIZE)

AdlibEnable("myadlib1")

Sleep (2000)

WinWait ("iPrint", "This will remove iPrint from your computer. Do you wish to proceed?", 600)

WinActivate ("iPrint", "This will remove iPrint from your computer. Do you wish to proceed?")

Sleep (500)

Send ("{TAB}")

Send ("{ENTER}")

WinWait ("iPrint", "iPrint has been successfully uninstalled from your machine.", 600)

WinActivate ("iPrint", "iPrint has been successfully uninstalled from your machine.")

Sleep (500)

Send ("{ENTER}")

Func myadlib1()

If WinWait("Novell iPrint Uninstall", "The system cannot find the file specified.", ) Then

WinActivate("Novell iPrint Uninstall", "The system cannot find the file specified.", )

WinWaitActive("Novell iPrint Uninstall", "The system cannot find the file specified.", )

Sleep (500)

Send("{ENTER}")

Exit

EndIf

EndFunc

Exit

AdlibEnable("myadlib2")

Func myadlib2()

If WinWait("RUNDLL", "Error loading C:\PROGRA~1\Novell\NOVELL~1\nippppi.dll", ) Then

WinActivate("RUNDLL", "Error loading C:\PROGRA~1\Novell\NOVELL~1\nippppi.dll", )

WinWaitActive("RUNDLL", "Error loading C:\PROGRA~1\Novell\NOVELL~1\nippppi.dll", )

Sleep (500)

Send("{ENTER}")

Exit

EndIf

EndFunc

Exit

I see what you mean about if winexists... I'll add that instead...

Thanks,

Terry

Share this post


Link to post
Share on other sites

I see a layout issue with your code. As I can only guess of how the windows are showing and the errors appearing, then this is perhaps my best guess. Normally only 1 Adlib function is enough.

Opt("TrayIconDebug", 1)
Opt("WinTitleMatchMode", 2)
Opt("WinTextMatchMode", 2)

Run("rundll32 C:\PROGRA~1\Novell\NOVELL~1\nippppi.dll,iPrintAdminRightsCheck", "", @SW_MAXIMIZE)

AdlibEnable("myadlib")

Sleep(2000)

If WinWait("iPrint", "This will remove iPrint from your computer. Do you wish to proceed?", 600) Then
    WinActivate("iPrint", "This will remove iPrint from your computer. Do you wish to proceed?")
    Sleep(500)
    Send("{TAB}")
    Send("{ENTER}")
    If WinWait("iPrint", "iPrint has been successfully uninstalled from your machine.", 600) Then
        WinActivate("iPrint", "iPrint has been successfully uninstalled from your machine.")
        Sleep(500)
        Send("{ENTER}")
    EndIf
EndIf

Exit

Func myadlib()
    If WinExists("Novell iPrint Uninstall", "The system cannot find the file specified.") Then
        WinActivate("Novell iPrint Uninstall", "The system cannot find the file specified.")
        WinWaitActive("Novell iPrint Uninstall", "The system cannot find the file specified.")
        Sleep(500)
        Send("{ENTER}")
        Exit
    ElseIf WinExists("RUNDLL", "Error loading C:\PROGRA~1\Novell\NOVELL~1\nippppi.dll") Then
        WinActivate("RUNDLL", "Error loading C:\PROGRA~1\Novell\NOVELL~1\nippppi.dll")
        WinWaitActive("RUNDLL", "Error loading C:\PROGRA~1\Novell\NOVELL~1\nippppi.dll")
        Sleep(500)
        Send("{ENTER}")
        Exit
    EndIf
EndFunc

I removed the extra comma's in the function call of the adlib function. AutoIt does not accept empty parameters and since they are optional parameters, then just omit them.

:)

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

I see a layout issue with your code. As I can only guess of how the windows are showing and the errors appearing, then this is perhaps my best guess. Normally only 1 Adlib function is enough.

Opt("TrayIconDebug", 1)
Opt("WinTitleMatchMode", 2)
Opt("WinTextMatchMode", 2)

Run("rundll32 C:\PROGRA~1\Novell\NOVELL~1\nippppi.dll,iPrintAdminRightsCheck", "", @SW_MAXIMIZE)

AdlibEnable("myadlib")

Sleep(2000)

If WinWait("iPrint", "This will remove iPrint from your computer. Do you wish to proceed?", 600) Then
    WinActivate("iPrint", "This will remove iPrint from your computer. Do you wish to proceed?")
    Sleep(500)
    Send("{TAB}")
    Send("{ENTER}")
    If WinWait("iPrint", "iPrint has been successfully uninstalled from your machine.", 600) Then
        WinActivate("iPrint", "iPrint has been successfully uninstalled from your machine.")
        Sleep(500)
        Send("{ENTER}")
    EndIf
EndIf

Exit

Func myadlib()
    If WinExists("Novell iPrint Uninstall", "The system cannot find the file specified.") Then
        WinActivate("Novell iPrint Uninstall", "The system cannot find the file specified.")
        WinWaitActive("Novell iPrint Uninstall", "The system cannot find the file specified.")
        Sleep(500)
        Send("{ENTER}")
        Exit
    ElseIf WinExists("RUNDLL", "Error loading C:\PROGRA~1\Novell\NOVELL~1\nippppi.dll") Then
        WinActivate("RUNDLL", "Error loading C:\PROGRA~1\Novell\NOVELL~1\nippppi.dll")
        WinWaitActive("RUNDLL", "Error loading C:\PROGRA~1\Novell\NOVELL~1\nippppi.dll")
        Sleep(500)
        Send("{ENTER}")
        Exit
    EndIf
EndFunc

I removed the extra comma's in the function call of the adlib function. AutoIt does not accept empty parameters and since they are optional parameters, then just omit them.

:D

Thanks I've used a lot of this, along with some suggestions from others to get what's shown below...

AutoItSetOption("TrayIconDebug", 1)
Opt("WinTitleMatchMode", 2 )
Opt("WinTextMatchMode", 2 )

Run ("rundll32 C:\PROGRA~1\Novell\NOVELL~1\nippppi.dll,iPrintAdminRightsCheck", "", @SW_MAXIMIZE)

Sleep(15000)

WinWait("iPrint", "This will remove iPrint from your computer. Do you wish to proceed?", 120)
If WinExists("iPrint", "This will remove iPrint from your computer. Do you wish to proceed?") Then
    WinActivate ("iPrint", "This will remove iPrint from your computer. Do you wish to proceed?")
    Sleep(100)
    ControlFocus("iPrint", "This will remove iPrint from your computer. Do you wish to proceed?", 6)
    ControlClick("iPrint", "This will remove iPrint from your computer. Do you wish to proceed?", 6)
    Sleep (200)
    
    WinWait("iPrint", "iPrint has been successfully uninstalled from your machine.", 240)
    If WinExists("iPrint", "iPrint has been successfully uninstalled from your machine.") Then
        WinActivate ("iPrint", "iPrint has been successfully uninstalled from your machine.")
        Sleep(100)
        ControlFocus("iPrint", "iPrint has been successfully uninstalled from your machine.", 2)
        ControlClick("iPrint", "iPrint has been successfully uninstalled from your machine.", 2)
        Sleep(200)
    EndIf

EndIf

Exit

You'll notice I took out the adlib stuff... instead in my other script I'm verifying those files exist first before launching this so that I don't get those errors.

Terry

Edited by mattw112

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  
Followers 0