How to find out that Shell command has finished

petrbury

Member
Licensed User
Hi,
I'm using Shell command to start conversion of pictures using IrfanView :

tmp = selectedfolder & "*.jpg /resize(800,600) /aspectratio /convert=*.jpg"
Shell("i_view32.exe",tmp)

It should resize all pictures in selected folder to 800x600 pixels and it works.
The problem is, that I need to know when the resizing of all pictures is finished, so I could continue
working with resized pictures.
Can anybody advise me how to find out it?
Thanks in advance
Petr
 

Rioven

Active Member
Licensed User
Hi petrbury,

Have you already tried 'fileExist', 'fileSearch', 'FileName', etc. on runtime to verify files created?

Regards,
 

petrbury

Member
Licensed User
Thank you Rioven,
it could be the way, but it seems a bit complicate for me. Because my code is resizing and overwriting every file, I should have tested if size of every file has changed. Or I could resize files and move them to another folder and then test them ... (Btw. I don't know if it is possible conflict when i_view is resizing some file and I'm trying to test it with FileExist or FileSize at the same moment).
So I wonder if there is some possibility how to find out the end of that (some returned parameter or so). I don't know much about it, so I'm asking here.
If somebody tells me that it is not possible, OK - I'll try another way.
Thanks
Petr
 

Rioven

Active Member
Licensed User
Hi petrbury,


Is it possibble to do this so that files will not overwritten?

tmp = selectedfolder & "*.jpg /resize(800,600) /aspectratio /convert=*"&"-resized"&".jpg"
Shell("i_view32.exe",tmp)

or

tmp = selectedfolder & "*.jpg /resize(800,600) /aspectratio /convert=*.png"
Shell("i_view32.exe",tmp)

then use...

FileSearch (Arraylistjpg,selectedfolder & "*"&"-resized"&".jpg") 'to gather all jpg on the folder and assigned value to array list 'arraylistjpg'
Obviously you have already return file names and count.


Maybe try 'filesearch' to gather all files and assign to arraylist.
and use arraylist to resize your pictures one by one.

FileSearch (Arraylistjpg,selectedfolder & "*.jpg")

for i=0 to arraylistjpg.count-1
tmp = selectedfolder & arraylistjpg.item(i)&".jpg /resize(800,600) /aspectratio /convert=& arraylistjpg.item(i)
Shell("i_view32.exe",tmp)
next i

but shell could be exhausted..


Regards,
 
Last edited:

Rioven

Active Member
Licensed User
Hi petrbury,


I have similar problem before and I've applied the kind of solution...

http://www.basic4ppc.com/forum/showthread.php?t=855

Once you manage resizing and renaming files then gather files for process. Inorder to wait the application to finish and no overlaps, you might apply the solution of the control focus. you could try it...

goodluck!
 
Last edited:

petrbury

Member
Licensed User
I'm still finding out that a lot of informations is already on the forum, but unfortunately I'm really not able to watch it all as good as I'd like. You know it - free time is never enough.
Thank you once more Rioven, your solution seems to be fine, I'll try it.
Petr
 
Top