AutoIT [AIUTO]Script che apre immagini

Stato
Discussione chiusa ad ulteriori risposte.

Alex™

Utente Electrum
11 Luglio 2011
434
39
91
186
Aiuto e urgente o bisogno di uno script che apre immagini e video se potete farlo in fretta vi ringrazio credo che rispondere subito SpeedJack :D
Grazie :D
 
Ultima modifica:
Per farlo devi creare una gui e mettere l'oggetto "picture" o "avi" ecco il codice.

Codice:
#include <AVIConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
$Form2 = GUICreate("Form1", 405, 294, 302, 218)
$Pic1 = GUICtrlCreatePic("", 8, 0, 225, 145)
$Avi1 = GUICtrlCreateAvi("No File", -1, 88, 152, 273, 129)
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

    EndSwitch
WEnd

Questo è l'esempio funzionante dell' help (per i video)

Codice:
#include <GUIConstantsEx.au3>

Opt('MustDeclareVars', 1)

Example()

Func  Example()
    Local $ani1, $buttonstart, $buttonstop, $msg

    GUICreate("My GUI Animation",  300,  200)
     $ani1 = GUICtrlCreateAvi(@SystemDir & "\shell32.dll",  165,  50,  10)

     $buttonstart = GUICtrlCreateButton("start", 50, 150, 70, 22)
    $buttonstop = GUICtrlCreateButton("stop", 150,  150,  70,  22)

     GUISetState()

    ; Run the GUI until the dialog is  closed
    While 1
        $msg = GUIGetMsg()

        Select
            Case $msg = $GUI_EVENT_CLOSE
                ExitLoop

            Case $msg = $buttonstart
                GUICtrlSetState($ani1, 1)

             Case $msg = $buttonstop
                 GUICtrlSetState($ani1, 0)

         EndSelect
    WEnd
EndFunc    ;==>Example
 
Per farlo devi creare una gui e mettere l'oggetto "picture" o "avi" ecco il codice.

Codice:
#include <AVIConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
$Form2 = GUICreate("Form1", 405, 294, 302, 218)
$Pic1 = GUICtrlCreatePic("", 8, 0, 225, 145)
$Avi1 = GUICtrlCreateAvi("No File", -1, 88, 152, 273, 129)
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

    EndSwitch
WEnd

Questo è l'esempio funzionante dell' help (per i video)

Codice:
#include <GUIConstantsEx.au3>

Opt('MustDeclareVars', 1)

Example()

Func  Example()
    Local $ani1, $buttonstart, $buttonstop, $msg

    GUICreate("My GUI Animation",  300,  200)
     $ani1 = GUICtrlCreateAvi(@SystemDir & "\shell32.dll",  165,  50,  10)

     $buttonstart = GUICtrlCreateButton("start", 50, 150, 70, 22)
    $buttonstop = GUICtrlCreateButton("stop", 150,  150,  70,  22)

     GUISetState()

    ; Run the GUI until the dialog is  closed
    While 1
        $msg = GUIGetMsg()

        Select
            Case $msg = $GUI_EVENT_CLOSE
                ExitLoop

            Case $msg = $buttonstart
                GUICtrlSetState($ani1, 1)

             Case $msg = $buttonstop
                 GUICtrlSetState($ani1, 0)

         EndSelect
    WEnd
EndFunc    ;==>Example
Non volevo dire cosi io voglio uno script che quando clicco un bottone tipo apri image la apre
 
Ultima modifica:
Tipo che ti apre paint?
Codice:
RUNDOS("Start [COLOR=#ff0000]percorsoimmagine[/COLOR].[COLOR=#ff0000]estensione[/COLOR]")

Sennò potresti fare
Codice:
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
Global $dir
$Form2 = GUICreate("Form1", 405, 294, 302, 218)
$Button1 = GUICtrlCreateButton("Apri immagine", 8, 80, 385, 65)
$Input1 = GUICtrlCreateInput("Inserisci percorso immagine", 16, 48, 377, 21)
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
Case $Button1
$dir = GuiCtrlRead($input1)
open($dir)
    EndSwitch
WEnd

Func open($directory)
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
$Form2 = GUICreate("Form1", 405, 294, 363, 179)
$Pic1 = GUICtrlCreatePic($directory, 0, 0, 401, 289)
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

    EndSwitch
WEnd

Scusa se ci sono errori ma l'ho scritto qui sull'editor di inforge ^^
 
Ultima modifica:
Spero che ho capito la tua riciesta...e ti posto il mio script:

PHP:
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <Process.au3>

$Form1 = GUICreate("Apri", 217, 118, 192, 124)
$Button1 = GUICtrlCreateButton("Clicca Qui per aprire", 8, 48, 187, 49, 0)
$Label1 = GUICtrlCreateLabel("Script per aprire un immagine o video", 8, 16, 178, 17)
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        case $Button1
            _apri()

    EndSwitch
WEnd

Func _Apri()
    $file0 = FileOpenDialog("Scegli il file da aprire", @DesktopDir, "Imagini (*.png; *.bmp; *.gif; *.jpg; *.jpeg)|Video (*.avi; *.mpeg; *.wmv; *.mp4; *.3gp; *.flv; *.mkv)", 1 + 4 )
    $file = StringReplace( $file0, " ", '" "')
    _RunDos("start " & $file)
    EndFunc
Spero che vada bene, se coppi solo parte del codice per un tuo programma non dimenticare di incrutere il file Process.au3, (#include <Process.au3>)

Spero di esserti stato utile
 
Spero che ho capito la tua riciesta...e ti posto il mio script:

PHP:
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <Process.au3>

$Form1 = GUICreate("Apri", 217, 118, 192, 124)
$Button1 = GUICtrlCreateButton("Clicca Qui per aprire", 8, 48, 187, 49, 0)
$Label1 = GUICtrlCreateLabel("Script per aprire un immagine o video", 8, 16, 178, 17)
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        case $Button1
            _apri()

    EndSwitch
WEnd

Func _Apri()
    $file0 = FileOpenDialog("Scegli il file da aprire", @DesktopDir, "Imagini (*.png; *.bmp; *.gif; *.jpg; *.jpeg)|Video (*.avi; *.mpeg; *.wmv; *.mp4; *.3gp; *.flv; *.mkv)", 1 + 4 )
    $file = StringReplace( $file0, " ", '" "')
    _RunDos("start " & $file)
    EndFunc
Spero che vada bene, se coppi solo parte del codice per un tuo programma non dimenticare di incrutere il file Process.au3, (#include <Process.au3>)

Spero di esserti stato utile
Non intendevo questo perchè io voglio che premono un bottone e si apre file avi img ecc ma non con il processo
 
Io voglio dire che non foglio che inserici il percorso cioe C://WIndows ecc ma voglio cha quando clicchi un bottone lo apre senza chiedere processo
 
Ultima modifica:
Devi metterci tu il percorso?

Codice:
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
$Form2 = GUICreate("Form1", 405, 294, 302, 218)
$Button1 = GUICtrlCreateButton("Apri immagine", 8, 80, 385, 65)
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
Case $Button1
open()
    EndSwitch
WEnd

Func open()
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
$Form2 = GUICreate("Form1", 405, 294, 363, 179)
$Pic1 = GUICtrlCreatePic([FONT=arial black]percorso[/FONT], 0, 0, 401, 289)
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

    EndSwitch
WEnd
While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

    EndSwitch
WEnd

Così non ti chiede niente...
 
Devi metterci tu il percorso?

Codice:
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
$Form2 = GUICreate("Form1", 405, 294, 302, 218)
$Button1 = GUICtrlCreateButton("Apri immagine", 8, 80, 385, 65)
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
Case $Button1
open()
    EndSwitch
WEnd

Func open()
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
$Form2 = GUICreate("Form1", 405, 294, 363, 179)
$Pic1 = GUICtrlCreatePic([FONT=arial black]percorso[/FONT], 0, 0, 401, 289)
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

    EndSwitch
WEnd
While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

    EndSwitch
WEnd

Così non ti chiede niente...
Questo e quello che intendevo ma non va D:
 
Ultima modifica:
Codice:
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
$Form2 = GUICreate("Form1", 405, 294, 302, 218)
$Button1 = GUICtrlCreateButton("Apri immagine", 8, 80, 385, 65)
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
Case $Button1
open()
    EndSwitch
WEnd

Func open()
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
$Form2 = GUICreate("Form1", 405, 294, 363, 179)
$Pic1 = GUICtrlCreatePic("[FONT=arial black]percorso[/FONT]", 0, 0, 401, 289)
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

    EndSwitch
WEnd
While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

    EndSwitch
WEnd
EndFunc

Non c'era l'end func... ora va
 
Stato
Discussione chiusa ad ulteriori risposte.