Jump to content

open choice and automate folder dialog is possible?


Recommended Posts

hi guy  , i  have  a  questions 

i try  to do a  robot ,  for  automate some task ,  when  click over  button , in  page  of  site  , the  site  open  filefolder ,  i must choice  a   folder  and  after some foto  and  click ok , for upload

how  could  do this  ?? i dont have  idea , some one  can  give me some  example  or  tell  me  the  command  ?

thankz  at  all

 

Link to comment
Share on other sites

i try  to use  this  code  but not  go some one  can  help me??

 

ControlClick("Choose File to Upload","","ToolbarWindow323")
WinWaitActive("#32770", "Choose File to Upload",10)
    WinFlash("Choose File to Upload","", 4, 500) ; Just to Flash the window
    ControlSetText("Choose File to Upload", "", "[CLASS:Edit; INSTANCE:1]", "C:\_DSC0075_01_bw.jpg")
    ControlClick("Choose File to Upload","","[CLASS:Edit; INSTANCE:1]")

 

Edited by faustf
Link to comment
Share on other sites

Are you familiar with Au3Info.exe?

This tool (installed w/ full Autoit & SciTe) [AutoIt Window Info] will give you the information on the other controls.

I imagine there is a "submit" or "ok" button you should be clicking to start the upload

Link to comment
Share on other sites

Ok now use the "Finder Tool" to get the Control Info for the "OK" button and use ControlClick()
You should see something like : [CLASS:Button; INSTANCE:1]

ControlClick("Choose File to Upload","","[CLASS:Button; INSTANCE:1]")

If that does not work you can try :

ControlSend("Choose File to Upload","","[CLASS:Edit; INSTANCE:1]", @CRLF)
    
    ;OR
    
    ControlSend("Choose File to Upload","","[CLASS:Edit; INSTANCE:1]", "{ENTER}")

 

Link to comment
Share on other sites

If the attached image is the window you are automating then "Choose File to Upload" is not the window title and would not work correctly.

 

The window title is "File Upload" as show in the Autoit Window info tool.

 

Add some testing in your script to see what errors you are getting: (put this below each line)

If @error Then consolewrite(@ScriptLineNumber & " : Error" & @error & " Extended: " & @extended & @CRLF)

This will give you an error # you can look up in the help file

Link to comment
Share on other sites

i write  in this  mode  and  dont  go and  dont  have  log  in console

;WinWaitActive("#32770", "Choose File to Upload", 10)
    ;WinFlash("Choose File to Upload", "", 4, 500) ; Just to Flash the window
    ;ControlSetText("Choose File to Upload", "", "[CLASS:Edit; INSTANCE:1]", "C:\_DSC0075_01_bw.jpg")
    ;ControlClick("Choose File to Upload", "", "[CLASS:Edit; INSTANCE:1]")
    ControlSend("Choose File to Upload","","[CLASS:Edit; INSTANCE:1]", "{ENTER}")
ControlClick("Choose File to Upload","","[CLASS:Button; INSTANCE:1]")
If @error Then consolewrite(@ScriptLineNumber & " : Error" & @error & " Extended: " & @extended & @CRLF)

 

Link to comment
Share on other sites

One thing I can think is that you commented out your cose that sets a path in the edit box.

Perhaps pressing OK/Enter does nothing while this box is empty.

other than that, if there are no errors reported I dont know the answer.

ControlSend("Choose File to Upload","","[CLASS:Edit; INSTANCE:1]", "{ENTER}")
If @error Then consolewrite(@ScriptLineNumber & " : Error" & @error & " Extended: " & @extended & @CRLF)
ControlClick("Choose File to Upload","","[CLASS:Button; INSTANCE:1]")
If @error Then consolewrite(@ScriptLineNumber & " : Error" & @error & " Extended: " & @extended & @CRLF)

 

Link to comment
Share on other sites

Func _kijiji_popola()
    #cs
        $PREZZO = $PREZZO_letto
        $descrizione = $descrizione_letto
        ;$location_foto= "C:\Users\Stefano\Pictures\Nikon Transfer\001\"
        $location_foto = "C:\Users\e-Office\Desktop\ridotte"
        ;   $FILE_FOTO = '"_DSC0001_01.NEF" "_DSC0001_01.JPG"'
        $FILE_FOTO = '"_DSC0011.JPG"'
        _entra_kijiji_it()

        ;_IENavigate($oIE, "https://www.kijiji.it/pubblica-annuncio")
        ;_IELoadWait($oIE)
    #ce

    $oIE = _IECreate("https://www.kijiji.it/pubblica-annuncio", 0, 1, 1, 1)
    Local $oForm = _IEFormGetObjByName($oIE, "syi_create")

    ; INSERIMENTO CATEGORIA
    $oForm = _IEFormGetObjByName($oIE, "syi_create") ;<<<<<<<<<<<
    $oSelect = _IEFormElementGetObjByName($oForm, "categoria")
    _IEAction($oSelect, "focus")
    _IEAction($oSelect, "Click")

    Send("" & $categoria & ""); lancio il nome della categoria che mi serve
    Sleep(1000)

    ; INSERIMENTO IN SOTTOCATEGORIA
    $oForm = _IEFormGetObjByName($oIE, "syi_create") ;<<<<<<<<<<<
    $oSelect = _IEFormElementGetObjByName($oForm, "Sottocategoria")
    _IEFormElementOptionSelect($oSelect, $sottocategoria, 1, "byText")

    ;COMUNE
    Local $Form_comune = _IEFormElementGetObjByName($oForm, "26c94607a042f60ae63ffe67170682524a22bd4adf97b0d3a3ea98362fbc180e")
    _IEFormElementSetValue($Form_comune, $comune)
    ;INDIRIZZO
    Local $Form_indirizzo = _IEFormElementGetObjByName($oForm, "4a56322312e85ae059450f33a1e4d85af8839689f8ab5e26fdb55ddff8b99f30")
    _IEFormElementSetValue($Form_indirizzo, "via dei mille");$aItem[7])
    ;TITOLO OGGETTO
    Local $Form_titolo = _IEFormElementGetObjByName($oForm, "2dd9d2670294523b13864726beba16b04fbbb39c0e48b0d480e2ffe357393f75")
    _IEFormElementSetValue($Form_titolo, $Titolo)
    ;PREZZO
    Local $Form_titolo = _IEFormElementGetObjByName($oForm, "935f7bceac69d8eff44d9e6a2b5335e8fa1c44c9d1a2555386807e694b6d7442")
    _IEFormElementSetValue($Form_titolo, $PREZZO_letto)
    ;DESCRIZIONE
    Local $Form_titolo = _IEFormElementGetObjByName($oForm, "3e1fa0d752a4ed6c4ab395eda30ba184dad89d6258f24fe1a9e4ea45509bdc81")
    _IEFormElementSetValue($Form_titolo, $descrizione_letto)
    ;EMAIL OBBLIGO
    Local $Form_titolo = _IEFormElementGetObjByName($oForm, "1d743d7d69c04b952978431c6aff8385f9f5f1d8e1b68691a7728351ef5a6515")
    _IEFormElementSetValue($Form_titolo, $mail)

    ;NOME FACOLTATIVO
    Local $Form_titolo = _IEFormElementGetObjByName($oForm, "c27cfe08513d577b9349cc013cec597e7bbc33d3d71ceea03c52e7b2dc19c520")
    _IEFormElementSetValue($Form_titolo, "demetrio volcic");$aItem[2])

    If $hide_numebr = '1' Then
        ;TELEFONO FACOLTATIVO
        Local $Form_titolo = _IEFormElementGetObjByName($oForm, "6092aa107408126873cd765d762fac2f525b46cf2a67fe048665d8e0f8632f2c")
        _IEFormElementSetValue($Form_titolo, $numero_hide)
    EndIf

    ; OFFRO CERCO
    Local $Form_titolo = _IEFormElementGetObjByName($oForm, "d9b024bd35b68d610baa726a1cb4a9de11d93cce580777b7fd7282a2f0ad43aa")
    _IEAction($Form_titolo, "focus")
    ;_IEFormElementSetValue($Form_titolo,
    _IEFormElementRadioSelect($Form_titolo, "2", "d9b024bd35b68d610baa726a1cb4a9de11d93cce580777b7fd7282a2f0ad43aa", 1, "byValue")

    #cs
        Local $sHTML = _IEBodyReadHTML($oIE)
        Local $oBtns = _IELinkGetCollection($oIE)
        local   $par_control = 1
        For $oBtn In $oBtns
        $classname = String($oBtn.classname())
        If $classname = "qq-upload-button btn" Then
        If $par_control = 2 Then
        _IEAction($oBtn, "Focus")
        $B = _IEAction($oBtn, "Click")
        _IELoadWait($oIE)
        Sleep(5000)
        EndIf
        $par_control += 1
        EndIf
        Next
        Local $oChk = _IEGetObjById($oIE, "file")
        _IEAction($oChk, "click")
    #ce
    ; APERTURA IMMAGINI UPLOAD
    Local $oForm = _IEFormGetObjByName($oIE, "syi_create")
    Local $oQuery = _IEFormElementGetObjByName($oForm, "file")
    _IEAction($oQuery, "focus")
    _IEAction($oQuery, "Click")

    ;WinWaitActive("#32770", "Choose File to Upload", 10)
    ;WinFlash("Choose File to Upload", "", 4, 500) ; Just to Flash the window
    ;ControlSetText("Choose File to Upload", "", "[CLASS:Edit; INSTANCE:1]", "C:\_DSC0075_01_bw.jpg")
    ;ControlClick("Choose File to Upload", "", "[CLASS:Edit; INSTANCE:1]")
    ControlSend("Choose File to Upload","","[CLASS:Edit; INSTANCE:1]", "{ENTER}")
If @error Then consolewrite(@ScriptLineNumber & " : Error" & @error & " Extended: " & @extended & @CRLF)
ControlClick("Choose File to Upload","","[CLASS:Button; INSTANCE:1]")
If @error Then consolewrite(@ScriptLineNumber & " : Error" & @error & " Extended: " & @extended & @CRLF)
EndFunc   ;==>_kijiji_popola

 

Link to comment
Share on other sites

"C:\Users\Public\Auto\delete.au3"(24,23) : warning: $categoria: possibly used before declaration.
    Send("" & $categoria &
    ~~~~~~~~~~~~~~~~~~~~~^
"C:\Users\Public\Auto\delete.au3"(30,54) : warning: $sottocategoria: possibly used before declaration.
    _IEFormElementOptionSelect($oSelect, $sottocategoria,
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"C:\Users\Public\Auto\delete.au3"(34,46) : warning: $comune: possibly used before declaration.
    _IEFormElementSetValue($Form_comune, $comune)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"C:\Users\Public\Auto\delete.au3"(40,46) : warning: $Titolo: possibly used before declaration.
    _IEFormElementSetValue($Form_titolo, $Titolo)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"C:\Users\Public\Auto\delete.au3"(43,52) : warning: $PREZZO_letto: possibly used before declaration.
    _IEFormElementSetValue($Form_titolo, $PREZZO_letto)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"C:\Users\Public\Auto\delete.au3"(46,57) : warning: $descrizione_letto: possibly used before declaration.
    _IEFormElementSetValue($Form_titolo, $descrizione_letto)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"C:\Users\Public\Auto\delete.au3"(49,44) : warning: $mail: possibly used before declaration.
    _IEFormElementSetValue($Form_titolo, $mail)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"C:\Users\Public\Auto\delete.au3"(55,18) : warning: $hide_numebr: possibly used before declaration.
    If $hide_numebr =
    ~~~~~~~~~~~~~~~~^
"C:\Users\Public\Auto\delete.au3"(58,52) : warning: $numero_hide: possibly used before declaration.
        _IEFormElementSetValue($Form_titolo, $numero_hide)
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"C:\Users\Public\Auto\delete.au3"(24,23) : error: $categoria: undeclared global variable.
    Send("" & $categoria &
    ~~~~~~~~~~~~~~~~~~~~~^
"C:\Users\Public\Auto\delete.au3"(30,54) : error: $sottocategoria: undeclared global variable.
    _IEFormElementOptionSelect($oSelect, $sottocategoria,
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"C:\Users\Public\Auto\delete.au3"(34,46) : error: $comune: undeclared global variable.
    _IEFormElementSetValue($Form_comune, $comune)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"C:\Users\Public\Auto\delete.au3"(40,46) : error: $Titolo: undeclared global variable.
    _IEFormElementSetValue($Form_titolo, $Titolo)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"C:\Users\Public\Auto\delete.au3"(43,52) : error: $PREZZO_letto: undeclared global variable.
    _IEFormElementSetValue($Form_titolo, $PREZZO_letto)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"C:\Users\Public\Auto\delete.au3"(46,57) : error: $descrizione_letto: undeclared global variable.
    _IEFormElementSetValue($Form_titolo, $descrizione_letto)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"C:\Users\Public\Auto\delete.au3"(49,44) : error: $mail: undeclared global variable.
    _IEFormElementSetValue($Form_titolo, $mail)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"C:\Users\Public\Auto\delete.au3"(55,18) : error: $hide_numebr: undeclared global variable.
    If $hide_numebr =
    ~~~~~~~~~~~~~~~~^
"C:\Users\Public\Auto\delete.au3"(58,52) : error: $numero_hide: undeclared global variable.
        _IEFormElementSetValue($Form_titolo, $numero_hide)
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"C:\Users\Public\Auto\delete.au3"(15,72) : error: _IECreate(): undefined function.
    $oIE = _IECreate("https://www.kijiji.it/pubblica-annuncio", 0, 1, 1, 1)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"C:\Users\Public\Auto\delete.au3"(16,55) : error: _IEFormGetObjByName(): undefined function.
    Local $oForm = _IEFormGetObjByName($oIE, "syi_create")
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"C:\Users\Public\Auto\delete.au3"(20,59) : error: _IEFormElementGetObjByName(): undefined function.
    $oSelect = _IEFormElementGetObjByName($oForm, "categoria")
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"C:\Users\Public\Auto\delete.au3"(21,29) : error: _IEAction(): undefined function.
    _IEAction($oSelect, "focus")
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"C:\Users\Public\Auto\delete.au3"(30,67) : error: _IEFormElementOptionSelect(): undefined function.
    _IEFormElementOptionSelect($oSelect, $sottocategoria, 1, "byText")
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"C:\Users\Public\Auto\delete.au3"(34,46) : error: _IEFormElementSetValue(): undefined function.
    _IEFormElementSetValue($Form_comune, $comune)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"C:\Users\Public\Auto\delete.au3"(65,127) : error: _IEFormElementRadioSelect(): undefined function.
    _IEFormElementRadioSelect($Form_titolo, "2", "d9b024bd35b68d610baa726a1cb4a9de11d93cce580777b7fd7282a2f0ad43aa", 1, "byValue")
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^

 

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...