vrocco Posted May 21, 2007 Posted May 21, 2007 I want to make a digital picture frame out of an old laptop. I would like to write an autoit script to show the pictures full screen while hiding the mouse cursor and taskbar. I also would like it to look for a usb device to be attached and when it is, find the pictures files, copy them to a hard drive and include them in the slideshow. Can someone point me in the right direction for getting started on this? Can it be done in autoit? Thanks! Vito
Uriziel01 Posted May 21, 2007 Posted May 21, 2007 I think it will be semi hard to do in Autoit itself, i reccomend you to search for some .dll or including .au3 for this operations, this make all faster and "cleaner"...
Uriziel01 Posted May 21, 2007 Posted May 21, 2007 (edited) To looking for new usb drive i think DriveGetDrive will be good. Just use DriveGetDrive and next keep searching for changes in it in loop. Next simple copy all files *.jpg, *.bmp, *.png to selected folder on yours hdd. To show this pictures you may use simple GUI without frame but i dont now how to hide taskbar. to list the files use _FileListToArray and when you want to show pic use GUICtrlSetImage and loop it. Edited May 21, 2007 by Uriziel01
Zedna Posted May 21, 2007 Posted May 21, 2007 (edited) Example of "fullscreen" GUI: expandcollapse popup#include <Color.au3> #include <GUIConstants.au3> $gui = GUICreate("Rainbow",@DesktopWidth, @DesktopHeight, 0, 0, $WS_POPUP) $size = WinGetClientSize($gui) $step = $size[0] / 6 _GUICtrlCreateGradient(0xFF0000, 0xFFFF00, 0*$step, 0, $step, $size[1]) _GUICtrlCreateGradient(0xFFFF00, 0x00FF00, 1*$step, 0, $step, $size[1]) _GUICtrlCreateGradient(0x00FF00, 0x00FFFF, 2*$step, 0, $step, $size[1]) _GUICtrlCreateGradient(0x00FFFF, 0x0000FF, 3*$step, 0, $step, $size[1]) _GUICtrlCreateGradient(0x0000FF, 0xFF00FF, 4*$step, 0, $step, $size[1]) _GUICtrlCreateGradient(0xFF00FF, 0xFF0000, 5*$step, 0, $step, $size[1]) GUISetCursor(16,1) GUISetState() While 1 $msg = GUIGetMsg() If $msg = -3 Then Exit Wend Func _GUICtrlCreateGradient($nStartColor, $nEndColor, $nX, $nY, $nWidth, $nHeight) Local $color1R = _ColorGetRed($nStartColor) Local $color1G = _ColorGetGreen($nStartColor) Local $color1B = _ColorGetBlue($nStartColor) Local $nStepR = (_ColorGetRed($nEndColor) - $color1R) / $step Local $nStepG = (_ColorGetGreen($nEndColor) - $color1G) / $step Local $nStepB = (_ColorGetBlue($nEndColor) - $color1B) / $step GuiCtrlCreateGraphic($nX, $nY, $nWidth, $nHeight) For $i = 0 To $nWidth $sColor = "0x" & StringFormat("%02X%02X%02X", $color1R+$nStepR*$i, $color1G+$nStepG*$i, $color1B+$nStepB*$i) GUICtrlSetGraphic(-1, $GUI_GR_COLOR, $sColor, 0xffffff) GUICtrlSetGraphic(-1, $GUI_GR_MOVE, $i, 0) GUICtrlSetGraphic(-1, $GUI_GR_LINE, $i, $nHeight) Next EndFunc Edited May 21, 2007 by Zedna Resources UDF ResourcesEx UDF AutoIt Forum Search
Uriziel01 Posted May 21, 2007 Posted May 21, 2007 Wow! How simple it is, thanks for this very much Zedna ! I dont now this metod in past =)
Zedna Posted May 21, 2007 Posted May 21, 2007 Wow! How simple it is, thanks for this very much Zedna ! I dont now this metod in past =)Welcome to Autoit users Happy scripting ... Resources UDF ResourcesEx UDF AutoIt Forum Search
Vindicator209 Posted May 21, 2007 Posted May 21, 2007 (edited) Hehehehe, heres a lazy solution: Run(@HomeDrive&"\WINDOWS\system32\ssmypics.scr") It runs the My Pictures ScreenSaver, so just put all your pictures into you My Pictures folder, an whala! although I don't think it was what you wanted =P Edited May 21, 2007 by MethodZero [center]"When you look at old, classic games like Snake, you often put it off because it's such a simple game, but it's only when you actually try and create your own unique game from scratch, do you finally appreciate those games."[/center][center]Don't ask for answers if you haven't TRIED yet![/center][center]Most answers can be answered in the help file! Use it![/center]
vrocco Posted May 21, 2007 Author Posted May 21, 2007 Hehehehe, heres a lazy solution:Run(@HomeDrive&"\WINDOWS\system32")It runs the My Pictures ScreenSaver, so just put all your pictures into you My Pictures folder, an whala! although I don't think it was what you wanted =PThat's actually an interesting idea. I hadn't thought of it. Can I run and autoit script in the background to detect when a usb drive is plugged in adn copy pics from it to the My Pictures folder? Or will the screen saver stop when something else executes?Anyone know?
vrocco Posted May 21, 2007 Author Posted May 21, 2007 OK tried this a few ways and i am stuck again. Hopefully someone can help me. Used a script ptrex wrote to detect usb drive plugged in and then copied pictures automatically to the hard drive. Also was able to ListToArray the files in the folder and display them one after another. The problem is, when I run the picture changing on a continous loop, then it can't look for the usb drive. I am sure it is just a matter of code placement, but I am an extreme noob. Can someone give me some help? Here is the script thus far: expandcollapse popup#include <Color.au3> #include <GUIConstants.au3> #include <File.au3> #include <Array.au3> $picarray = _FileListToArray("C:\Photos") $gui = GUICreate("Slideshow",@DesktopWidth, @DesktopHeight, 0, 0, $WS_POPUP) $pic = GUICtrlCreatePic("C:\Photos\"& $picarray[1], 0, 0, @DesktopWidth, @DesktopHeight) GUISetCursor(16,1) GUISetState() $strComputer = "." $objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\cimv2") $colEvents = $objWMIService.ExecNotificationQuery _ ("Select * From __InstanceOperationEvent Within 5 Where " _ & "TargetInstance isa 'Win32_LogicalDisk'") While 1 $objEvent = $colEvents.NextEvent If $objEvent.TargetInstance.DriveType = 2 Then If $objEvent.Path_.Class()="__InstanceCreationEvent" Then DirCopy($objEvent.TargetInstance.DeviceId & "\Photos", "C:\Photos", 1) EndIf EndIf WEnd Slideshow() Func Slideshow () Do $picarray = _FileListToArray("C:\Photos") Sleep(5000) For $n = 1 To $picarray[0] GUICtrlSetImage($pic, "C:\Photos\" & $picarray[$n]) Sleep (5000) Next Until @error EndFunc
herewasplato Posted May 21, 2007 Posted May 21, 2007 You could make the USB detection a function and use adlibenable or maybe put it all in one loop - I've not studied the USB detection code to see if one loop would be a good idea. [size="1"][font="Arial"].[u].[/u][/font][/size]
vrocco Posted May 21, 2007 Author Posted May 21, 2007 I did try putting in the Do...Until Loop and then my pictures wouldn't change. Anyone else can help with this?
Vindicator209 Posted May 21, 2007 Posted May 21, 2007 Whoops my bad, the actual command for the mypics screensaver is: Run(@HomeDrive&"\WINDOWS\system32\ssmypics.scr") ( I forgot the end of it ) and as for new drives,, I found this in one of my scripts but I can't remember who was the one who wrote it... $DBT_DEVICEARRIVAL = "0x00008000" $WM_DEVICECHANGE = 0x0219 GUIRegisterMsg($WM_DEVICECHANGE , "MyFunc") Func MyFunc($hWndGUI, $MsgID, $WParam, $LParam) If $WParam == $DBT_DEVICEARRIVAL Then ;Script Here EndIf EndFunc [center]"When you look at old, classic games like Snake, you often put it off because it's such a simple game, but it's only when you actually try and create your own unique game from scratch, do you finally appreciate those games."[/center][center]Don't ask for answers if you haven't TRIED yet![/center][center]Most answers can be answered in the help file! Use it![/center]
vrocco Posted May 22, 2007 Author Posted May 22, 2007 I tired this route too, but couldn't get autoit to run the Mypics SS because it has an .scr extension (not .exe, .com, etc.) Also, while the screensaver is running, my script to detect usb doesn't work. (Script works fine otherwise.) Like I said, I am sure it is all there, but the placement of it is wrong. Thanks!
vrocco Posted May 22, 2007 Author Posted May 22, 2007 Success!!! Two scripts was my answer!! I put the USB detection in one script and compiled it. Then had the slideshow script run that .exe when it started. Seems to do what I want it to. However, is there a way to terminate the usb.exe program when the slideshow program exits? Thanks to those who helped out! Vito
Zedna Posted May 22, 2007 Posted May 22, 2007 Success!!!Two scripts was my answer!! I put the USB detection in one script and compiled it. Then had the slideshow script run that .exe when it started. Seems to do what I want it to. However, is there a way to terminate the usb.exe program when the slideshow program exits?Thanks to those who helped out!VitoProcessClose() Resources UDF ResourcesEx UDF AutoIt Forum Search
Paulie Posted May 22, 2007 Posted May 22, 2007 Success!!! Two scripts was my answer!! I put the USB detection in one script and compiled it. Then had the slideshow script run that .exe when it started. Seems to do what I want it to. However, is there a way to terminate the usb.exe program when the slideshow program exits? Thanks to those who helped out! VitoProcessClose("MyScript.exe")
herewasplato Posted May 22, 2007 Posted May 22, 2007 Opt("OnExitFunc", "_Terminate") ;your main script here Func _Terminate() Do ProcessClose("USB.EXE") Sleep(3000) Until ProcessExists("USB.EXE") = 0 EndFunc ;==>_Terminate [size="1"][font="Arial"].[u].[/u][/font][/size]
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