PC SOFT

FOROS PROFESIONALES
WINDEVWEBDEV y WINDEV Mobile

Inicio → WINDEV 2024 → shell execute
shell execute
Iniciado por guest, 28,sep. 2015 16:49 - 6 respuestas
Publicado el 28,septiembre 2015 - 16:49
Hi.

I have a pdf thatis saved in hyperfile cs. I would like to open that pdf.

So I Added it to a table and dit a shell execute on the table . This didnot work. Then I tried This:

IF HReadSeekFirst(Verzonden_Email_bijlagen,Verzonden_Email_bijlagenID,TABLE_bijlagen.COL_ID) THEN
ShellExecute(Verzonden_Email_bijlagen.Bijlage)
END

I looksup the pdf and then does a shell excute on the found item. This doesnot work as well

Anybody an I dea how to get this? Do I have to save the item first as a file ?


regards

Allard
Publicado el 28,septiembre 2015 - 16:56
as far i know yes.
Publicado el 28,septiembre 2015 - 17:26
Ok

Anyone an Idea how to do this. Have been lookingin the help but cannot find it

regards

Allard
Miembro registrado
102 mensajes
Publicado el 28,septiembre 2015 - 17:53
I do save the pdf file to the temp directory first:

Procedure showPDF( id )
sDateiname is string
nFNum is int

// Dateiinhalt und Dateiname anhand id raussuchen
IF NOT HReadSeek(dateien,dateienID,id) THEN
Error("Interner Fehler, Datei-ID nicht gefunden","ID " + id )
RETURN
END

sDateiname = fTempPath() + ["\"] + dateien.dateiname + [".pdf"]
nFNum = fCreate(sDateiname,foReadWrite)

IF nFNum = -1 THEN
Error("Fehler beim schreiben der PDF-Datei im Verzeichnis",fTempPath(),ErrorInfo())
RETURN
END

fWrite(nFNum,dateien.datei)
fClose(nFNum)

// jetzt anzeigen
ShellExecute(sDateiname)


--
http://arnoldconsult.de
Publicado el 28,septiembre 2015 - 18:11
Hello Allard,

yes and no...

if you really want to display it in an external application, then yes, with hextractmemo
buf if you are ready to display your pdf internally, there is an example in windev (pdf viewer or something like that), then you should be able to just display it by doing Img_Field=File.BinaryMemoField

Best regards
Publicado el 28,septiembre 2015 - 20:13
Hello Allard
//We will send the file to the temp folder sTempFolder is string = fTempPath() //Get the record from the DB IF HReadSeekFirst(DOCUMENT_STORAGE,Document_ID,nDocID) THEN sFileName is string = DOCUMENT_STORAGE.File_Name else ReturnToCapture() end sFileToOpen is string = sTempFolder+sFileName IF NOT HExtractMemo(DOCUMENT_STORAGE,Document,sFileToOpen) THEN Info("The Document could not be extracted from the file try again!") ReturnToCapture() END //Test the temp location to make sure it is there IF NOT fFileExist(sFileToOpen) THEN //give it a few seconds to check Multitask(200) END //The memo was extracted now open it. IF ShellExecute(sFileToOpen) THEN //Do other things here End
I do 2 a couple of other things.(Code removed to make it easier to read)
1) I create a copy and then compare the 2 documents for changes, If they are different then I ask the user to save the changed documnet.
2) Delete the pdf's from the temp file.

Good luck

DW
Publicado el 28,septiembre 2015 - 22:21
Thanks DW for the coding!!

I came up with something similar:

The code:


IF HReadSeekFirst(Verzonden_Email_bijlagen,Verzonden_Email_bijlagenID,TABLE_bijlagen.COL_ID) = True THEN
sMemoinfo is string
sMemoinfo = HInfoMemo(Verzonden_Email_bijlagen,Bijlage)
IF sMemoinfo = "" THEN
RESULT = False
ELSE

sFilename, sBestand is string = fExtractPath(ExtractString(sMemoinfo,2,TAB), fFileName + fExtension)
sFilename = fTempPath() + sBestand

IF fFileExist(sFilename) THEN
sFilename = fTempPath() + GetGUID(guidRough ) + Verzonden_Email_bijlagen.Omschrijving
END



IF NOT HExtractMemo( Verzonden_Email_bijlagen,Bijlage,sFilename)THEN
//IF NOT HExtractMemo(Documenten,Document,sFilename) THEN
Info( "Er gaat iets fout.")
ELSE
RESULT = False

END

// error ( "Tijdelijk bestand kanniet worden gemaakt omdat deze op een andere plaats wordt gebruikt")
//return
//end

ShellExecute(sFilename,"open")
// IF NOT fTrackFile(sFilename, ProcessModification , ftModifyFile ) THEN
// Info("The " + sFilename + " file will not be tracked.")
// END
//fDelete(sFilename,frReadOnly)
END
ELSE

END