Sign in to follow this  
Followers 0
jeromeLam

[SOLVED] work only with MsgBox

10 posts in this topic

#1 ·  Posted (edited)

Hi,

I'm new in scripting with AutoIt, i have a problem with this script:

;Recherche du dossier de destination
        Send("!d")
        Sleep(100)
        Send("!d")
        Sleep(100)
        $currentDir = _GetCurrentDirWindowText($titleCurrent)
        ;MsgBox(4096,"current dir",$currentDir)
        $findDesktop = False
        $findDiskC = False
        $allUp = False
        while NOT $findDesktop
            If ( NOT (StringInStr($currentDir,"Bureau") ==0) OR NOT (StringInStr($currentDir,"Desktop") == 0)) Then
                $findDesktop = True
            EndIf
            If NOT $findDesktop Then
                If NOT $allUp Then
                    Send("{DOWN}")
                    Sleep(100)
                    Send("{UP}")
                    Sleep(100)
                    Send("{ENTER}")
                    Sleep(200)
                Else
                    Send("{DOWN}")
                    Sleep(100)
                    Send("{DOWN}")
                    Sleep(100)
                    Send("{ENTER}")
                    Sleep(200)
                EndIf
                $handleMain = _GetHwndFromPID($pidMain)
                $titleCurrent = WinGetTitle($handleMain)
                ;MsgBox(4096,"",$titleCurrent)
                If $titleCurrent=="Insérer un disque" OR $titleCurrent=="Insert a disk" Then
                    ;MsgBox(4096,"","on a quitté la boite enregistrer sous")
                    Send("{ENTER}")
                    Sleep(200)
                    Send("!d")
                    Sleep(100)
                    Send("!d")
                    Sleep(100)
                EndIf
                $oldDir = $currentDir
                If $titleCurrent<>"Enregistrer sous" AND $titleCurrent<>"Save to" Then
                    $currentDir = ""
                Else
                    $currentDir = _GetCurrentDirWindowText($titleCurrent)
                EndIf
                Sleep(100)
                ;MsgBox(4096,"","Current dir: " & $currentDir & " old dir: " & $oldDir)
                If StringCompare($oldDir,$currentDir) == 0 AND $currentDir<>""  Then
                    ;On est arrivé tout en haut on va passer en revue en descendant
                    If $allUp == True Then
                        ;On a une erreur, on a rien trouvé et on est à la fin
                        $errorDesktop = True
                    Else
                        MsgBox(4096,"tout en haut",$titleCurrent)
                        $allUp = True
                    EndIf
                EndIf
                ;MsgBox(4096,"","Current dir: " & $currentDir & " old dir: " & $oldDir)
            Else
                Send("{DOWN}")
                Sleep(100)
                Send("{ENTER}")
                Sleep(200)
            EndIf
        WEnd

I comment two MsgBox that i use for debug.

The script work when i decomment this MsgBox but not if i comment it.

:s I have no idea why???

Thanks for your help,

Jérôme.

Edited by jeromeLam

Share this post


Link to post
Share on other sites



jeromeLam,

I have no idea why???

Neither have I at first glance! :P

Have you tried replacing the MsgBox with a Sleep(100)? Perhaps the script needs to pause for a moment at that point and the MsgBox is letting it do so. :x

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Thanks for your fast reply.

So i have more information about th why

I put here my log file:

Start processing ... 28/12/2010 at 12:09:53
... Find 1 files in C:\Users\Jerome\Documents\Dossier IN
    Start processing 1 * 12:09:53
        12:09:53 Current file SCAN_20101222120039.pdf
        12:09:56 Wait for program finished reading
        12:10:03 Analysing file
        12:10:04 Wait for program finished analysing
        12:10:27 Saving file
        12:10:28 File's name: SCAN_ABBYY_2
        12:10:30 see to:  for window: ExplorerBrowserNavigation
        12:10:31 see to:  for window: ExplorerBrowserNavigation
        12:10:32 see to:  for window: ExplorerBrowserNavigation
        12:10:33 see to:  for window: ExplorerBrowserNavigation
        12:10:33 see to:  for window: ExplorerBrowserNavigation
        12:10:34 see to:  for window: ExplorerBrowserNavigation
        12:10:35 see to:  for window: ExplorerBrowserNavigation
        12:10:36 see to:  for window: ExplorerBrowserNavigation
        12:10:37 see to:  for window: ExplorerBrowserNavigation
        12:10:38 see to:  for window: ExplorerBrowserNavigation
        12:10:39 see to:  for window: ExplorerBrowserNavigation
        12:10:40 see to:  for window: ExplorerBrowserNavigation
        12:10:41 see to:  for window: ExplorerBrowserNavigation
        12:10:41 see to:  for window: ExplorerBrowserNavigation
        12:10:42 see to:  for window: ExplorerBrowserNavigation
        12:10:43 see to:  for window: ExplorerBrowserNavigation
        12:10:44 see to: 
Documents récents
 for window: Enregistrer sous
Start processing ... 28/12/2010 at 12:12:15
... Find 1 files in C:\Users\Jerome\Documents\Dossier IN
    Start processing 1 * 12:12:15
        12:12:15 Current file SCAN_20101222120039.pdf
        12:12:18 Wait for program finished reading
        12:12:25 Analysing file
        12:12:26 Wait for program finished analysing
        12:12:49 Saving file
        12:12:50 File's name: SCAN_1
        12:12:57 see to:  for window: Enregistrer sous
        12:12:57 see to: 
Ordinateur
 for window: Enregistrer sous
        12:12:58 see to: 
Groupe résidentiel
 for window: Enregistrer sous
        12:12:59 see to: 
Jérôme Lambert
 for window: Enregistrer sous
        12:12:59 see to: 
Bibliothèques
 for window: Enregistrer sous
        12:13:00 see to: 
Réseau
 for window: Enregistrer sous
        12:13:00 see to: 
Bureau
 for window: Enregistrer sous
        12:13:02 Recording file in C:\OUT
        12:13:03 Create XML File
        12:13:04 Kill processing
        12:13:04 Move original file from C:\Users\Jerome\Documents\Dossier IN to C:\Users\Jerome\Documents\Dossier ARCHIVE
    End processing 1 * 12:13:05 for file SCAN_20101222120039.pdf
End processing 12:13:06 Duration 1min for 1 files.
Start processing ... 28/12/2010 at 12:14:02
... Find 1 files in C:\Users\Jerome\Documents\Dossier IN
    Start processing 1 * 12:14:02
        12:14:02 Current file SCAN_20101222120039.pdf
        12:14:05 Wait for program finished reading
        12:14:11 Analysing file
        12:14:12 Wait for program finished analysing
        12:14:35 Saving file
        12:14:36 File's name: SCAN_2

So the problem is when i don't have the window title "Enregistrer sous" it doesn't work because my function "_GetCurrentDirWindowText" can't get the current dir in the windows title "ExplorerBrowserNavigation"

I will try with a loop "press tab until you obtain the right window title".

I put here my result

But i still don't understand why MsgBox fix the problem :s. Maybe a right sleep was working but still not a right way to fix my problem, i try it and post here if it solve my problem.

Jérôme

Edited by jeromeLam

Share this post


Link to post
Share on other sites

Just try "WinActivate" or TAB until you find the right window Title but not working... :x

I don't know why the program have a window "Explorer..." and not the true window title "Enregistrer sous"

I still working on this problem, i need to solve it.

Jérôme

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Ok i find a solution i add this test in my code:

If $titleCurrent=="ExplorerBrowserNavigation" Then
                    If WinExists("Enregistrer sous") Then
                        $titleCurrent = "Enregistrer sous"
                    ElseIf WinExists("Save to") Then
                        $titleCurrent = "Save to"
                    EndIf
                EndIf

How can I add a [sOLVED] to the title of this topic?

Edited by jeromeLam

Share this post


Link to post
Share on other sites

jeromeLam,

Edit the first post and select the "Use full editor" option - you can then edit the title as well. :x

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

Edit the OP and change the Title in "use full editor" mode.

Edited by guinness

_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 04/09/2015

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

I try to see where i can anymore edit my first post but I don't have the possibility.

I have to post a new reply to had the possibility to edit the first post.

Thanks for help guys.

Edited by jeromeLam

Share this post


Link to post
Share on other sites

jeromeLam,

As you found, you need 5 posts to be able to edit. Sorry, I forgot you were that new here! :x

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

I have to post a new reply to had the possibility to edit the first post.

Welcome to forum. Posted Image

(mmm, I get a good feeling with this user ... odd feeling. :x )

Edited by MvGulik

"Straight_and_Crooked_Thinking" : A "classic guide to ferreting out untruths, half-truths, and other distortions of facts in political and social discussions."
"The Secrets of Quantum Physics" : New and excellent 2 part documentary on Quantum Physics by Jim Al-Khalili. (Dec 2014)

"Believing what you know ain't so" ...

Knock Knock ...
 

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