James Posted June 15, 2007 Share Posted June 15, 2007 Hey,I just need help to make this. Basically, you enter how many screenshots it takes, how long it sleeps for and where the pictures are saved to.Using PaulIA's lib screen cap function I managed to make this:Func _ScreenCap() $Captured = 1 If Not FileExists($Data) Then $Screens = InputBox("Screen Capture", "How many times do you wish to capture the screen for?", "10") $Sleep = InputBox("Screen Capture", "Thankyou, how often do you wish to wait before another screenshot is take? (Seconds)", "1") $Location = FileSelectFolder("Where do you wish to save the screenshots?", @ScriptDir, 1) IniWrite($Data, "ScreenCapture", "Amount", $Screens) IniWrite($Data, "ScreenCapture", "Sleep", $Sleep) IniWrite($Data, "ScreenCapture", "Location", $Location) Else $Capt = IniReadSection($Data, "ScreenCapture") For $a = 1 To $Capt[0][0] Do GUISetState(@SW_HIDE, $MainGUI) _ScreenCap_Capture(IniReadSection($Data, "Location" & $Capt[$a][$Screens] & ".jpg")) ConsoleWrite("Captured") $Captured += 1 Sleep(IniReadSection($Data, "Sleep")) Until $Captured = IniReadSection($Data, "Amount") Next GUISetState(@SW_SHOW, $MainGUI) EndIf EndFunc ;==>_ScreenCapWhat I need it to do is this:Get how many times it takes a screenshotHow long it sleeps for between each shotWhere the files are saved toThanks,James Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ Link to comment Share on other sites More sharing options...
PsaltyDS Posted June 15, 2007 Share Posted June 15, 2007 (edited) Prompt with InputBox() functions and a FileSelectFolder(). P.S. Errmm... all of which you already have in there. It doesn't work? P.P.S. Your test for done is doomed because IniReadSection() returns an array: ; Until $Captured = IniReadSection($Data, "Amount") Until $Captured = IniRead($Data, "ScreenCapture", "Amount") Edited June 15, 2007 by PsaltyDS Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
James Posted June 15, 2007 Author Share Posted June 15, 2007 Ahh right, that makes more sense. I will try it tomorrow. Thanks Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ Link to comment Share on other sites More sharing options...
James Posted June 16, 2007 Author Share Posted June 16, 2007 After trying it and having to add that extra number at the end I came up with: Func _ScreenCap() $Data = @ScriptDir & '\db\data.ini' $Captured = 1 If Not FileExists($Data) Then $Screens = InputBox("Screen Capture", "How many times do you wish to capture the screen for?", "10") $Sleep = InputBox("Screen Capture", "Thankyou, how often do you wish to wait before another screenshot is take? (Seconds)", "1") $Location = FileSelectFolder("Where do you wish to save the screenshots?", @ScriptDir, 1) IniWrite($Data, "ScreenCapture", "Amount", $Screens) IniWrite($Data, "ScreenCapture", "Sleep", $Sleep) IniWrite($Data, "ScreenCapture", "Location", $Location) Else $Capt = IniReadSection($Data, "ScreenCapture") For $a = 1 To $Capt[0][0] Do GUISetState(@SW_HIDE, $MainGUI) _ScreenCap_Capture(IniReadSection($Data, "Location" & $Capt[$a][$Screens] & ".jpg")) ConsoleWrite("Captured") $Captured += 1 Sleep(IniReadSection($Data, "Sleep")) Until $Captured = IniRead($Data, "ScreenCapture", "Amount", 10) Next GUISetState(@SW_SHOW, $MainGUI) EndIf EndFunc ;==>_ScreenCap But that doesnt work either Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ Link to comment Share on other sites More sharing options...
PsaltyDS Posted June 16, 2007 Share Posted June 16, 2007 (edited) After trying it and having to add that extra number at the end I came up with: But that doesnt work either This tweaks it so the function continues after the operator inputs values to create a new ini, and adds some error checking. The next part is commented out because it makes no sense without a sample of the ini file. You seem to be reading the wrong section, or using IniReadSection where IniRead is all you need. Can't figure it out without the ini file sample. Func _ScreenCap() $Data = @ScriptDir & '\db\data.ini' $Captured = 1 If Not FileExists($Data) Then ; Get settings from operator and save to .ini $Screens = InputBox("Screen Capture", "How many times do you wish to capture the screen for?", "10") If @error Then Return 0 $Sleep = InputBox("Screen Capture", "How often do you wish to wait between screenshots? (Seconds)", "1") If @error Then Return 0 $Location = FileSelectFolder("Where do you wish to save the screenshots?", @ScriptDir, 1) If @error Then Return 0 IniWrite($Data, "ScreenCapture", "Amount", $Screens) IniWrite($Data, "ScreenCapture", "Sleep", $Sleep) IniWrite($Data, "ScreenCapture", "Location", $Location) EndIf #cs $Capt = IniReadSection($Data, "ScreenCapture") If @error Or $Capt[0][0] = 0 Then Return 0 Else For $a = 1 To $Capt[0][0] Do GUISetState(@SW_HIDE, $MainGUI) _ScreenCap_Capture (IniReadSection($Data, "Location" & $Capt[$a][$Screens] & ".jpg")) ConsoleWrite("Captured") $Captured += 1 Sleep(IniReadSection($Data, "Sleep")) Until $Captured = IniRead($Data, "ScreenCapture", "Amount", 10) Next GUISetState(@SW_SHOW, $MainGUI) EndIf #ce EndFunc ;==>_ScreenCap Edited June 16, 2007 by PsaltyDS Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
James Posted June 16, 2007 Author Share Posted June 16, 2007 Well there is no .ini file until it has been created, your way seems better, but no screenshots are taken :S Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ Link to comment Share on other sites More sharing options...
Mast3rpyr0 Posted June 16, 2007 Share Posted June 16, 2007 im not sure but i think you have to uncomment the bottem half of PSalty's script My UDF's : _INetUpdateCheck() My Programs : GameLauncher vAlpha, InfoCrypt, WindowDesigner, ScreenCap, DailyRemindersPick3GeneratorBackupUtility! Other : Bored? Click Here! Link to comment Share on other sites More sharing options...
James Posted June 16, 2007 Author Share Posted June 16, 2007 That wouldn't do anything. Its comments, when the program is run, its like they are not there. Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted June 16, 2007 Moderators Share Posted June 16, 2007 That wouldn't do anything. Its comments, when the program is run, its like they are not there.lol... not to bright are ya ... the "Screen Capture" call is in the comments Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
James Posted June 16, 2007 Author Share Posted June 16, 2007 Yeah, I just noticed that.. :S Sorry, I have just been on a 20mile bike ride with my two mates Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ Link to comment Share on other sites More sharing options...
PsaltyDS Posted June 16, 2007 Share Posted June 16, 2007 (edited) Well there is no .ini file until it has been created, your way seems better, but no screenshots are taken :S In that case, the first time you run it, an ini will be created formatted like this: [ScreenCapture] Amount=10 Sleep=3 Location=C:\Temp\Test Now look at your following code. Why are you doing this? $Capt = IniReadSection($Data, "ScreenCapture") Again with the IniReadSection() instead of just IniRead(). You've been told this before. Read the help file on the commands you are trying to use. Study the difference between IniReadSection() and IniRead() until it sinks in... Edited June 16, 2007 by PsaltyDS Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
James Posted June 17, 2007 Author Share Posted June 17, 2007 Yeah.. I have done, but I couldn't understand. Sorry. Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted June 17, 2007 Moderators Share Posted June 17, 2007 Yeah.. I have done, but I couldn't understand. Sorry.You don't understand that IniReadSection() returns an Array there for you are probably going to need to display them in a "non" string manner... ie.. $aArray = IniReadSection(File,Section) MsgBox(0, 0, $aArray[1][1]);Red is either [0] or [1] and represents Key and Value ... [0] = Key, [1] = Value. Versus IniRead() returning a string, and could be used as MsgBox(0,0, IniRead(File,Section,Key,Alternate Value))? As long as you've been here and 1800+ posts, if you don't understand that MAJOR difference between the two functions after "admitting" you've read them, then you should really give AutoIt up and take up checkers or 20 mile bike rides in much much higher altitudes. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
James Posted June 18, 2007 Author Share Posted June 18, 2007 Sorry Smoke, bad day ¬_¬ Reading it again now makes sense. Sorry for my bad wording and attitude. James Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ 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