Jump to content

Adlib does not work in my script


jefhal
 Share

Recommended Posts

In order to insure that my font file is fully copied before running a dll on it, I have a message box pop up and then am trying to use an adlib function to close the message box. Seems plausible, but does not work as written. Any ideas?:

#Include <File.au3>
#Include <Array.au3>

AdlibEnable("_CloseFileCopyConfirmationMsgBox",250)
$SourcePath = "\\Parktaz\c\windows\fonts"
$FileList = _FileListToArray($SourcePath)
$TargetPath = @WindowsDir & "\JunkFolder\"
If (Not IsArray($FileList)) Then
     Exit
EndIf
For $i = 1 to $FileList[0]
    $sFileName = $FileList[$i]
    If FileCopy($SourcePath & "\" & $sFileName, $TargetPath ,1) Then
        $sFileName = $TargetPath & StringTrimLeft($sFileName, StringInStr($sFileName, '\', 0, -1))
        DllCall('gdi32', 'long', "AddFontResourceA", 'String', $sFileName)
    EndIf
Next
Exit

Func _CloseFileCopyConfirmationMsgBox()
    If WinActive("New file name is:") Then ControlClick("New file name is:","","Button1")
EndFunc

It was well buried in the forum threads, but I found this previous comment from Valik:

GuiMsg() blocks like MessageBox or InputBox so it's not possible to use hotkeys or AdLib while it's running.

Maybe this should go into the next manual rev? ;) Edited by jefhal
...by the way, it's pronounced: "JIF"... Bob Berry --- inventor of the GIF format
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...