Joboy2k Posted September 3, 2009 Share Posted September 3, 2009 im having a problem, iv used autoit now for a feew months but for simple task. but my friend who is a camera technician asked me to make him a program that. 1) Realises he has put in a memory card(could be 4 different types so 4 different drives) 2) Looks in the x:\Dcim\ for the next subfolder("x" being whatever the drive is in use.) 3) finds which subfolder has the Jpg files in 4) opens the Jpg files a slideshow. can anyone help me? because iv not even came close to solving how to do it. much appreciated. Link to comment Share on other sites More sharing options...
jvanegmond Posted September 3, 2009 Share Posted September 3, 2009 Here is a list of native AutoIt functions you will need and what you will need them for. DriveGetDrive - To find a list of drives that are currently inserted. If a new drive is inserted you will find it with this function and you can scan it. FileFindFirstFile, FileFindNextFile - To find all subfolders, and then to look for jpg images in those subfolders. SplashImageOn - To display the slideshow. I hope this helps! Your question was very generic so I've tried to give a generic answer. github.com/jvanegmond Link to comment Share on other sites More sharing options...
Joboy2k Posted September 3, 2009 Author Share Posted September 3, 2009 thank you ill try that out. but 1 problem is with Splashimageon the photos that will be displayed are very high quality so splashimageon cant take it. is there any other way of previewing the images? Link to comment Share on other sites More sharing options...
jvanegmond Posted September 3, 2009 Share Posted September 3, 2009 Maybe you can use the IE library to make Internet Explorer display the images. Just make sure you create IE in full screen mode or in kiosk mode. github.com/jvanegmond Link to comment Share on other sites More sharing options...
Rishav Posted September 3, 2009 Share Posted September 3, 2009 (edited) better use a 3rd party app like faststoneviewer. or some image viewer which cam be run from the exe (no installation required). Then just open the image in the imageviewer. First create an inifinite loop in autoit (while do) search if the new drives have been plugged in anytime if a new drive is detected, open it and navigate to the start folder. create a for loop for as many new drives detected. using the file functions get a list of all the jpeg files in the folder. put in an array xxx. get a list of all the folders. put list in yyy array. create another for loop for the number of folders detected. browse to 1st folder. get all the jpg files in there and append the path to xxx array. keep looping till all the jpeg files in the drive have been detected. xxx should contain the paths to all the images. open each image 1 by 1 using the standalone app (or autoit). Even better is open drive>>windows search for *.jpg>>open files in standalone. ps. or just ignore the post. i guess your prob is bigger than my power level. Edited September 3, 2009 by Rishav Link to comment Share on other sites More sharing options...
jvanegmond Posted September 3, 2009 Share Posted September 3, 2009 Rishav, don't be crazy. Your power level is over 9000. github.com/jvanegmond Link to comment Share on other sites More sharing options...
Joboy2k Posted September 3, 2009 Author Share Posted September 3, 2009 (edited) ok ill try that. but im coming accross another problem. ill show you what i have so far $var = drivegetdrive("Removable") If NOT @error Then For $i = 1 to $var[0] $size = DirGetSize($var[$i]) if $size = -1 Then Else if fileexists ($var[$i]&"\Dcim\") then MsgBox(4096,"Drive + Folder" & $i, $var[$i] & " Dcim Exist") $folder = FileFindFirstFile ($var[$i]&"\Dcim\*") if $folder = -1 Then MsgBox(4096,"folder", $var[$i] & " No Folders") Else MsgBox(4096,"folder", $var[$i] & " " & $folder) EndIf EndIf endif Next EndIf this is able to notify all removable drivers. it identifies the drivers with a folder in called DCIM. BUT when i try to get the next folder name with $folder = FileFindFirstFile ($var[$i]&"\Dcim\*") it keeps coming back with "1" even though the next folders name is "142Canon" any ideas y that is? (the msgboxs wont be need in the future there just there so i know whats going on and whats working) Edited September 3, 2009 by joboy2k Link to comment Share on other sites More sharing options...
WolfWorld Posted September 3, 2009 Share Posted September 3, 2009 ok ill try that. but im coming accross another problem. ill show you what i have so far $var = drivegetdrive("Removable") If NOT @error Then For $i = 1 to $var[0] $size = DirGetSize($var[$i]) if $size = -1 Then Else if fileexists ($var[$i]&"\Dcim\") then MsgBox(4096,"Drive + Folder" & $i, $var[$i] & " Dcim Exist") $folder = FileFindFirstFile ($var[$i]&"\Dcim\*") if $folder = -1 Then MsgBox(4096,"folder", $var[$i] & " No Folders") Else MsgBox(4096,"folder", $var[$i] & " " & $folder) EndIf EndIf endif Next EndIf this is able to notify all removable drivers. it identifies the drivers with a folder in called DCIM. BUT when i try to get the next folder name with $folder = FileFindFirstFile ($var[$i]&"\Dcim\*") it keeps coming back with "1" even though the next folders name is "142Canon" any ideas y that is? (the msgboxs wont be need in the future there just there so i know whats going on and whats working) You suppose to use something like this $var = DriveGetDrive("Removable") If Not @error Then For $i = 1 To $var[0] $size = DirGetSize($var[$i]) If $size = -1 Then Else If FileExists($var[$i] & "\Dcim\") Then MsgBox(4096, "Drive + Folder" & $i, $var[$i] & " Dcim Exist") $folder = FileFindFirstFile($var[$i] & "\Dcim\*") If $folder = -1 Then MsgBox(4096, "folder", $var[$i] & " No Folders") Else While 1 $file = FileFindNextFile($folder) If @error Then ExitLoop MsgBox(4096, "folder", $var[$i] & " " & $file) WEnd EndIf EndIf EndIf Next EndIf Main project - Eat Spaghetti - Obfuscate and Optimize your script. The most advance add-on.Website more of GadGets! Link to comment Share on other sites More sharing options...
Joboy2k Posted September 3, 2009 Author Share Posted September 3, 2009 (edited) You suppose to use something like this $var = DriveGetDrive("Removable") If Not @error Then For $i = 1 To $var[0] $size = DirGetSize($var[$i]) If $size = -1 Then Else If FileExists($var[$i] & "\Dcim\") Then MsgBox(4096, "Drive + Folder" & $i, $var[$i] & " Dcim Exist") $folder = FileFindFirstFile($var[$i] & "\Dcim\*") If $folder = -1 Then MsgBox(4096, "folder", $var[$i] & " No Folders") Else While 1 $file = FileFindNextFile($folder) If @error Then ExitLoop MsgBox(4096, "folder", $var[$i] & " " & $file) WEnd EndIf EndIf EndIf Next EndIf this worked great thanks. But im still making mistakes, and it seems to be the same one. i now can get the folders name up thanks to wolfworld. but when i make my search for the file inside that folder it still comes up with a number instead of the files name. sorry to be a pain xD iv looked over it a few times and cant see anything different about me looking for the files and looking for folders but the folder search is coming out with names. if you could help me understand whats is acctually going wrong so i know for the future. $var = drivegetdrive("Removable") If NOT @error Then For $i = 1 to $var[0] $size = DirGetSize($var[$i]) if $size = -1 Then Else if fileexists ($var[$i]&"\Dcim\") then MsgBox(4096,"Drive + Folder" & $i, $var[$i] & " Dcim Exist") $folder = FileFindFirstFile ($var[$i]&"\Dcim\*") If $folder = -1 Then MsgBox(4096,"folder", $var[$i] & " No Folders") Else While 1 $folderdirect = FileFindNextFile($folder) If @error Then ExitLoop MsgBox(4096, "folder", $var[$i] & " " & $folderdirect) ExitLoop WEnd $file = filefindfirstfile($var[$i]&"\Dcim\"&$folderdirect&"\*.jpg") if $file = -1 then MsgBox(4096,"file", $var[$i] & " No Files") Else while 1 $filedirect = filefindnextfile($file) If @error Then ExitLoop MsgBox(4096, "file", $var[$i] & " " & $file) WEnd EndIf EndIf EndIf EndIf Next EndIf Edited September 3, 2009 by joboy2k Link to comment Share on other sites More sharing options...
Joboy2k Posted September 3, 2009 Author Share Posted September 3, 2009 right 1 update to last post all i need to find is 1 file name inside the folder. so lets say the directory line ($var[$i]&"\Dcim\"&$folderdirect&"\*.jpg") is (I:\Dcim\142canon\*.jpg") i only need to find 1 jpg name cause then ill execute this Run("C:\Windows\system32\cmd.exe","", @SW_MINIMIZE) WinWait("Administrator: C:\Windows\system32\cmd.exe", "") controlsend("Administrator: C:\Windows\system32\cmd.exe","","","I:\DCIM\142CANON\*****.JPG") ;****** being the jpg name Controlsend("Administrator: C:\Windows\system32\cmd.exe","","","{enter}") controlsend("Administrator: C:\Windows\system32\cmd.exe","","","exit") Controlsend("Administrator: C:\Windows\system32\cmd.exe","","","{enter}") winwait ("- Windows Photo Gallery") winactivate ("- Windows Photo Gallery") controlclick("- Windows Photo Gallery","","[iD:42000]","") ;this activates slideshow so will automatically go through all photos. Exit so can anyone help me by looking at the previous post at why i cant get that 1 file name. Link to comment Share on other sites More sharing options...
WolfWorld Posted September 3, 2009 Share Posted September 3, 2009 $var = DriveGetDrive("Removable") If Not @error Then For $i = 1 To $var[0] $size = DirGetSize($var[$i]) If $size = -1 Then Else If FileExists($var[$i] & "\Dcim\") Then MsgBox(4096, "Drive + Folder" & $i, $var[$i] & " Dcim Exist") $folder = FileFindFirstFile($var[$i] & "\Dcim\*") If $folder = -1 Then MsgBox(4096, "folder", $var[$i] & " No Folders") Else While 1 $folderdirect = FileFindNextFile($folder) If @error Then ExitLoop $file = FileFindFirstFile($var[$i] & "\Dcim\" & $folderdirect & "\*.jpg") If $file = -1 Then MsgBox(4096, "file", $var[$i] & " No Files") Else While 1 $filedirect1 = FileFindNextFile($file) If @error Then ExitLoop MsgBox(4096, "file", $var[$i] & " " & $filedirect1) ExitLoop WEnd EndIf WEnd EndIf EndIf EndIf Next EndIf Main project - Eat Spaghetti - Obfuscate and Optimize your script. The most advance add-on.Website more of GadGets! 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