PowerBASIC Peer Support Forums
 

Go Back   PowerBASIC Peer Support Forums > User to user Discussions > PowerBASIC Console Compiler

PowerBASIC Console Compiler User to user discussions about the PowerBASIC Console Compiler product line.

Reply
 
Thread Tools Display Modes
  #1  
Old Mar 2nd, 2012, 12:08 AM
Reise Jacobs Reise Jacobs is offline
Member
 
Join Date: Jul 2004
Posts: 20
open pdf file from pbcc

OPENNING A PDF FILE FROM PBCC WORKS IF THE FILENAME HAS NO SPACES
eg.
SHELL ENVIRON$("COMSPEC")+" /c TESTABC.PDF"
works fine

However if the .pdf file has spaces it does not work
eg.
SHELL ENVIRON$("COMSPEC")+" /c TEST ABC.PDF"
does not work
is ther a better way to open a PDF fie from PBCC??

Thanks, Reise
Reply With Quote
  #2  
Old Mar 2nd, 2012, 12:12 AM
Stuart McLachlan Stuart McLachlan is offline
Member
 
Join Date: Mar 2000
Location: Port Moresby, Papua New Guinea
Posts: 1,680
Quote the filename:
SHELL ENVIRON$("COMSPEC")+" /c ""TEST ABC.PDF"""
Reply With Quote
  #3  
Old Mar 2nd, 2012, 01:07 AM
Reise Jacobs Reise Jacobs is offline
Member
 
Join Date: Jul 2004
Posts: 20
how can i use a variable

Thanks. That worked ; how can i do it using a variable?
Variable aa$
aa$="test abc.pdf"

shell environ$("comspec")+ " /c aa$ ??

I tried several methods using chr$(34) for a quotation mark but i still was unable to do it

thanks, reise
Reply With Quote
  #4  
Old Mar 2nd, 2012, 01:23 AM
Stuart McLachlan Stuart McLachlan is offline
Member
 
Join Date: Mar 2000
Location: Port Moresby, Papua New Guinea
Posts: 1,680
Code:
aa$ = "test abc.pdf"
SHELL environ$("comspec") + " /c  "  + CHR$(34) + aa$ + CHR$(34)
or
Code:
aa$ = "test abc.pdf"
SHELL environ$("comspec") + " /c  "  + $DQ + aa$ + $DQ
Reply With Quote
  #5  
Old Mar 2nd, 2012, 02:44 AM
Reise Jacobs Reise Jacobs is offline
Member
 
Join Date: Jul 2004
Posts: 20
thank you

Thank you very much Stuart.

Reise
Reply With Quote
  #6  
Old Mar 2nd, 2012, 09:19 AM
Michael Mattias Michael Mattias is offline
Member
 
Join Date: Aug 1998
Location: Racine WI USA
Posts: 35,694
Code:
szFile= "filename with or without spaces it doesn't care.pdf"
ShellExecute GetDesktopWindow(), "open", szFile, BYVAL %NULL*, BYVAL %NULL*, ChoiceOfShowCmd
* or other choice. Refer to documentation.

MCM
Reply With Quote
  #7  
Old Mar 2nd, 2012, 05:09 PM
Stuart McLachlan Stuart McLachlan is offline
Member
 
Join Date: Mar 2000
Location: Port Moresby, Papua New Guinea
Posts: 1,680
Ahem!

Code:
#INCLUDE "Win32API.inc"
...
szFile= "filename with or without spaces it doesn't care.pdf" 
ShellExecute GetDesktopWindow(), "open", szFile, BYVAL %NULL*, BYVAL %NULL*, ChoiceOfShowCmd
Reply With Quote
  #8  
Old Mar 2nd, 2012, 06:11 PM
Michael Mattias Michael Mattias is offline
Member
 
Join Date: Aug 1998
Location: Racine WI USA
Posts: 35,694
"Ahem" my <posterior>!

Every program includes the Windows headers!
Reply With Quote
  #9  
Old Mar 2nd, 2012, 09:45 PM
Stuart McLachlan Stuart McLachlan is offline
Member
 
Join Date: Mar 2000
Location: Port Moresby, Papua New Guinea
Posts: 1,680
Yours may. Many don't. The default PBEdit - "Create new file as - Generic PB Program" doesn't.
Reply With Quote
  #10  
Old Mar 4th, 2012, 12:04 PM
Michael Mattias Michael Mattias is offline
Member
 
Join Date: Aug 1998
Location: Racine WI USA
Posts: 35,694
>The default PBEdit - "Create new file as - Generic PB Program" doesn't.

So what?

Doesn't everyone use "Create new file as - MY TEMPLATE FILE", ???

That template feature is really nice since you can create 'new' with all the COMMENTED options and library procedures and macros you know you are going to want anyway.

Oh, you didn't invest an hour or so setting up "YOUR" template file? Well, it's your ten minutes per program now and forever you're wasting.
Reply With Quote
  #11  
Old Mar 4th, 2012, 04:49 PM
Stuart McLachlan Stuart McLachlan is offline
Member
 
Join Date: Mar 2000
Location: Port Moresby, Papua New Guinea
Posts: 1,680
> Doesn't everyone use "Create new file as - MY TEMPLATE FILE", ???

I suspect that most users don't. But that's beside the point.

Not every program includes Win32API.inc.

I would not be surprised to find out that most programs don't include it.
Reply With Quote
  #12  
Old Mar 4th, 2012, 07:58 PM
Michael Mattias Michael Mattias is offline
Member
 
Join Date: Aug 1998
Location: Racine WI USA
Posts: 35,694
>I would not be surprised to find out that most programs don't include [WIndows' API header files].

Maybe demo and play programs, but it's hard for me to imagine ANY Real World application which does not use at least one Windows API call; and regardless, it costs nothing but a few milliseconds at compile time to "just #INCLUDE it"

However, this may have changed somewhat with the addition of all those WM_xxxx constants as "predefined equates" but I wouldn't know about that because I don't get "undefined equate" errors on WM_xxxx items, probably because they are all in WIN32API.INC.
Reply With Quote
  #13  
Old Mar 6th, 2012, 08:21 PM
Izzy Zeitz Izzy Zeitz is offline
Member
 
Join Date: Nov 2011
Location: Port Saint Lucie, FL
Posts: 260
Yo, people... Play nice... Lets not take our eyes off of the ball...

Izzy Z
Reply With Quote
Reply

Tags
file name, pdf, spaces

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 10:44 PM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Copyright 1999-2011 PowerBASIC, Inc. All Rights Reserved.
Error in my_thread_global_end(): 1 threads didn't exit