Jump to content

i want to open all files(.ppt/.jpg/.png..)in a folder..


Recommended Posts

Spoiler

Code You Posted

#include <File.au3>
#Include <Array.au3>
#include <Timers.au3>
$path = "D:\CTS ppt"
$FileArray = _FileListToArrayRec ( $path, '*.jpeg;*.pptx;*.xls;*.xlsx',1)

For $i = 1 To $FileArray[0
    If $FileArray[i]==".jpg"
    ShellExecute($path & "\" & $FileArray[$i])
    Sleep(2000)
    ;HotKeySet("#{F4}", "_exit")
    Send("!+{F4}",0)

Next
;_ArrayDisplay($FileArray, "Sorted tree")

;WinWaitActive("[CLASS:screenClass]" ) ;full screen mode of ppt
;FileClose($FileArray[$i])

Func _forceshutdown()
    Shutdown(5)  ;Force a shutdown
    MsgBox(0, "Automatic program", "!! Shutting down !!",18)
EndFunc

 

First, welcome to the forums! :)

Second, I would suggest installing SciTE from the AutoIt page, it makes writing code and catching errors way easier

Third, here's what I found that doesn't work...

Spoiler
#include <File.au3>
#Include <Array.au3>
#include <Timers.au3>

HotKeySet("!{F9}", "_forceshutdown") ; <-- If you press Alt F9, your function is called now

$path = "D:\CTS ppt"
$FileArray = _FileListToArrayRec ( $path, '*.jpeg;*.pptx;*.xls;*.xlsx',1)

For $i = 1 To $FileArray[0]     ; <-- You were missing a ]
    ; Also, you used "i" instead of $i below :) I hate when I do that!
    If $FileArray[$i]==".jpg" Then  ; <-- You were missing a Then statement (and the following lines would be indented more)
        ShellExecute($path & "\" & $FileArray[$i])
        Sleep(2000)
        ;HotKeySet("#{F4}", "_exit")
        Send("!{F4}",0)     ; <-- You probably want just "!{F4}" aka "Alt + F4" to close the program
    EndIf ; <-- You need an EndIf
Next
;_ArrayDisplay($FileArray, "Sorted tree")

;WinWaitActive("[CLASS:screenClass]" ) ;full screen mode of ppt
;FileClose($FileArray[$i])

Func _forceshutdown()
    Shutdown(5)  ;Force a shutdown
    MsgBox(0, "Automatic program", "!! Shutting down !!",18)
EndFunc

 

 

Edited by seadoggie01
Update code

All my code provided is Public Domain... but it may not work. ;) Use it, change it, break it, whatever you want.

Spoiler

My Humble Contributions:
Personal Function Documentation - A personal HelpFile for your functions
Acro.au3 UDF - Automating Acrobat Pro
ToDo Finder - Find #ToDo: lines in your scripts
UI-SimpleWrappers UDF - Use UI Automation more Simply-er
KeePass UDF - Automate KeePass, a password manager
InputBoxes - Simple Input boxes for various variable types

Link to comment
Share on other sites

Here you go. Alt + F4 is a bit potato, but hey, it works...

#include <File.au3>
#Include <Array.au3>
#include <Timers.au3>
#include <Debug.au3>

$path = "D:\CTS ppt"
$FileArray = _FileListToArrayRec($path, '*.jpeg|*.pptx|*.xls|*.xlsx', 1)
;_DebugArrayDisplay($FileArray)

For $i = 1 To $FileArray[0]
    If StringInStr($FileArray[$i], ".jpg") > 0 Then
        $iPID = ShellExecuteWait($path & "\" & $FileArray[$i])
        Sleep(2000)
        Send("!{F4}",0)
    EndIf
Next

 

Link to comment
Share on other sites

13 minutes ago, Seminko said:

Here you go. Alt + F4 is a bit potato, but hey, it works...

#include <File.au3>
#Include <Array.au3>
#include <Timers.au3>
#include <Debug.au3>

$path = "D:\CTS ppt"
$FileArray = _FileListToArrayRec($path, '*.jpeg|*.pptx|*.xls|*.xlsx', 1)
;_DebugArrayDisplay($FileArray)

For $i = 1 To $FileArray[0]
    If StringInStr($FileArray[$i], ".jpg") > 0 Then
        $iPID = ShellExecuteWait($path & "\" & $FileArray[$i])
        Sleep(2000)
        Send("!{F4}",0)
    EndIf
Next

 

thans a lot its working....☺️

 

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