pallavii Posted July 31, 2019 Share Posted July 31, 2019 if it is .ppt file means i want to present slide at end of slide same as other files(.img/.pdf) in my script i stuck in if condition and i'm trying i cant understand anyone pls help me out .... how to write the script based on requirement ☹️ script3.au3 Link to comment Share on other sites More sharing options...
pallavii Posted July 31, 2019 Author Share Posted July 31, 2019 pls help me for this script Link to comment Share on other sites More sharing options...
seadoggie01 Posted July 31, 2019 Share Posted July 31, 2019 (edited) 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 July 31, 2019 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 functionsAcro.au3 UDF - Automating Acrobat ProToDo Finder - Find #ToDo: lines in your scriptsUI-SimpleWrappers UDF - Use UI Automation more Simply-erKeePass UDF - Automate KeePass, a password managerInputBoxes - Simple Input boxes for various variable types Link to comment Share on other sites More sharing options...
Seminko Posted July 31, 2019 Share Posted July 31, 2019 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 More sharing options...
Moderators JLogan3o13 Posted July 31, 2019 Moderators Share Posted July 31, 2019 @pallavii please stop spamming the forum because you're impatient. seadoggie01 1 "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
pallavii Posted July 31, 2019 Author Share Posted July 31, 2019 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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now