' ------------------------------------------------------------------------------------ ' PhotoPC ' Demo of the PhotoPC MAX extension ' Downloads all the pictures of the camera and add them to the current album ' ------------------------------------------------------------------------------------ Option Explicit ' Define the variables dim alb, nb, i, pic app.ClearTrace set alb = app.GetCurrentAlbum dim maxx, s, sFile, nbP set maxx = app.GetMax("Max_PhotoPC") exec "count" nbP = val(maxx.getresult()) app.trace nbP & " pictures to download" for i=1 to nbP app.trace "Downloading picture #'" & i sFile = "c:\Pic-" & i & ".jpg" exec "image " & i & " " & sFile 'exec "erase " & i alb.addPicture( sFile ) alb.redraw next app.Trace "Done !" ' Execute a PhotoPC command and wait for termination Function Exec( s ) dim bOK app.trace " Executing command '" & s & "'" bOK = maxx.execute( s ) do app.wait 250 'app.trace "Waiting... (" & s & ")" loop until maxx.nState=0 Exec = bOK End Function Function val( s ) dim num, i, n num = 0 n = len(s) for i=1 to n if mid(s,i,1) >= "0" and mid(s,i,1) <= "9" then num = 10*num + asc(mid(s,i,1)) - 48 next val = num End Function