' SPEED_UP.BAS ' ' This is a quick & dirty QBasic tool to parse project.xml to speed up (halve) all the pan, zoom and transition times ' (this will halve the number of 'key frames' generated by PhotoStory 3 ' = so ONLY use it to restore a 'slowed down' project.xml that you made changes that you wish wish to keep ' ' The project.xml MUST have been parsed to add windows cr/lf ... ' (if you get 'OUT OF STRING SPACE' error when you launch the script, go back and and add the cr/lf :-) ) ' ' We only need to do a single pass over the project.xml ' Check the FIRST VU [narrationTips=""] field, at the end of the [Image path=""] XML entry ' for a "SLOW_DWN" or "SLOW_X25" flag (if found, remove flag and set speedup value) ' Check each line for [ duration="]n" and apply speedup (default = double) to 'n'. ' (watch out for QBasiscs tendency to add leading spaces to numeric values) ' CLEAR ver$ = "This version SPEED_UP.BAS 1.1 23Apr2014" ' ' ' can't use the double-quote symbol (") in a line of qbasic code, so assign it to a variable q$ = CHR$(34) ' OPEN "C:\QBASIC\PSTORY3\Project.xml" FOR INPUT AS #1 OPEN "C:\QBASIC\PSTORY3\fast.xml" FOR OUTPUT AS #2 OPEN "C:\QBASIC\PSTORY3\SPEED_UP.LOG" FOR OUTPUT AS #4 PRINT ver$ PRINT #4, ver$ ' set the speed up value to default Nspeed = 2.0 PRINT #4, "Nspeed is set to: ";Nspeed PRINT "Nspeed is set to: ";Nspeed ' DO LINE INPUT #1, in$ ' does this line have narrationTips field ? Qpos = INSTR(in$, "narrationTips=") IF Qpos = 0 THEN GOTO skip0 ' OK, do we have a flag in the narration field ? Fpos = INSTR(Qpos, in$, "SLOW_") IF Fpos = 0 THEN GOTO skip1 ' Yes, extract the flag F$ = MID$(in$, Fpos, 8) ' reset the value IF F$="SLOW_X25" THEN Nspeed = 2.5 ELSE Nspeed = 2.0 ' log the line before flag extract PRINT #4, in$ ' log the change PRINT #4, "Nspeed has been set to: ";Nspeed PRINT "Nspeed has been set to: ";Nspeed ' rebuild the line without the flag in$ = LEFT$(in$, Fpos - 1) + MID$(in$, Fpos+8) ' log it PRINT #4, in$ ' Go output the narrationTips line GOTO skip1: ' here to process a non-Tips line skip0: ' find timing Qpos = INSTR(in$, " duration=") ' skip if none found IF Qpos = 0 THEN GOTO skip1 ' OK got a duration, numeric starts at Qpos + 11 Spos = Qpos + 11 ' find end Epos = INSTR(Spos + 1, in$, q$) ' get initial value v1 = VAL(MID$(in$, Spos, Epos - Spos)) ' apply speed setting v1 = v1 / Nspeed ' convert back to string v$ = "" IF v1 > 0 THEN v$ = LTRIM$(STR$(v1)) ' add leading zero IF v1 < 1.0 THEN v$ = "0"+v$ ' rebuild the line in$ = LEFT$(in$, Spos - 1) + v$ + MID$(in$, Epos) PRINT #4, in$ ' output the line skip1: PRINT #2, in$ LOOP UNTIL EOF(1) ' ' OK done - we can close all and kill the old xml, then rename the new CLOSE SHELL "DEL C:\QBASIC\PSTORY3\project.xml" SHELL "REN C:\QBASIC\PSTORY3\fast.xml project.xml" ' say done BEEP PRINT "done" BEEP ' exit to shell SYSTEM