April 18, 2024, 10:24:04 PM

News:

Own IWBasic 2.x ? -----> Get your free upgrade to 3.x now.........


Getstartpath

Started by TexasPete, May 14, 2012, 09:33:14 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

TexasPete

DDefaultDir$=Getstartpath
I don't know why but "getstartpath" is not returning a string. Does anyone know why? I have tried reinstalling cb. This has been working in the past.
Texas Pete


Bruce Peaslee

This works for me:


OpenConsole
string path$ = GetStartPath
print path$
DO: UNTIL INKEY$ <> ""
CLOSECONSOLE



Edit:  Oops. Just noticed you're using Creative Basic. Sorry.
Bruce Peaslee
"Born too loose."
iTired (There's a nap for that.)
Well, I headed for Las Vegas
Only made it out to Needles

LarryMc

This works fine for me.
OpenConsole
def path$:string
path$ = GetStartPath()
print path$
DO: UNTIL INKEY$ <> ""
CLOSECONSOLE


To try and help you any further I'll need a running example of it not working to test.

LarryMc
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

Bruce Peaslee

Quote from: Doc on May 14, 2012, 12:03:32 PM

...but it wouldn't actually display anything until I created and ran the executable.


My programs don't do anything until I run them, also; but I thought is was just me.   ::)
Bruce Peaslee
"Born too loose."
iTired (There's a nap for that.)
Well, I headed for Las Vegas
Only made it out to Needles

LarryMc

Quote from: peaslee on May 14, 2012, 12:40:55 PM
Quote from: Doc on May 14, 2012, 12:03:32 PM

...but it wouldn't actually display anything until I created and ran the executable.


My programs don't do anything until I run them, also; but I thought is was just me.   ::)
I read it that way also Bruce.
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

Bruce Peaslee

You got me, Doc. I guess the joke's on me.
Bruce Peaslee
"Born too loose."
iTired (There's a nap for that.)
Well, I headed for Las Vegas
Only made it out to Needles

LarryMc

I very seldom use CBasic but when I do I always save to a file before I run it.
I've had it crash too many times and lost my code not to save it first.

So, I saved the file but did NOT create an exe file and it worked fine.

But, to me, it sort of make sense the way it works.

So, the jokes on me also, but only because of the way I always use it.

I can live with that.  ;)

LarryMc
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

Doc

Ya know, I really don't quite understand why a person (much less two) would feel the need to make wise-cracks to someone taking a tiny few minutes out of a very busy and hectic day, when all they were doing was trying to help someone else because they actually could for once...

I guess it really doesn't matter too much, becuase I believe this is the very last of my association with any of these products.

You folks have fun. See ya.

Bruce Peaslee

I'm sorry you're taking it this way. I certainly didn't mean any malice - in fact I tried to help.

You have my sincerest apologies.
Bruce Peaslee
"Born too loose."
iTired (There's a nap for that.)
Well, I headed for Las Vegas
Only made it out to Needles

LarryMc

Sorry my joking hacked you off David.

You must have had a bad day. We all have them sometimes.

So, the lesson I've learned, to keep from running valued members off is:
1. Don't make jokes.
2. Stay out of the CB forums because that isn't my area of expertise.

Hate to see you go David, but if that is what you feel you have to do then good luck.

I would much prefer you reconsider and come back in a short period of time.

LarryMc
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

aurelCB

Well...
Let someone hit me in the head with a rubber hammer if
I understand what the problem is. ???
Larry ...from my point of view there is no need for apologise at all. ;)
About what products he talks.. ???
probably he think that on other place produtcs are far better... ;D
this is a joke?

AdrianFox

I am on entirely the same wavelength as AurelCB here.  I have read and re-read those comments and am completely lost as to why anybody should take offence.  I thought it was just very light humour well intentioned.
I hope our unhappy member doesn't take offence where none is intended and continues to support this friendly and helpful forum.
Adrian Fox

Doc

Hey guys,
I apologize if I've taken what was intended as good natured prodding in the wrong way.
Bad day? On edge? ...you just have no idea.

Good, bad or otherwise, it still comes to mind that I'm really not much of a contributor around here, I seldom use the products anymore and am mostly just wasting time and bandwidth. I'm gonna officially give it up anyway.

Have fun, good luck and adios.

-Doc-

TexasPete

Thanks Larry , Do you know why it woudl work without the parenthesis?
Thanks Philip

aurelCB

I'm not sure if this help but i use this code few times:
DECLARE "kernel32",GetCurrentDirectoryA(nBufferLength:int,lpBuffer:String),int
def buffer as string
GetCurrentDirectoryA(255,buffer)
MessageBox 0,"IS:"+buffer,"OK"

LarryMc

IWBasic uses
DECLARE "kernel32",GetModuleFileNameA(hmod as UINT,path as STRING,length as INT),INT
and I would think CBasic uses the same.
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

TexasPete

Thanks for everyone replay. I believe I figured out why it was not working. I Make files of suggested solution. So I appreciate everyone's help.
Texas Pete

GWS

Hi,


openconsole
cls

DDefaultDir$=Getstartpath
print DDefaultDir$

do:until inkey$<>""
closeconsole
end


... works fine for me.

The help file says:
'Returns the path to your program or executable. When your program is run from the Creative BASIC editor, this will return the path your source file is located in. When your program is in executable form, this will return the path to the executable. This provides a convenient way of specifying relative paths to data files. The path returned automatically has a "\" appended to it.'

So naturally, you need to have saved your source and/or executable to some folder for it to work.

best wishes, :)

Graham
Tomorrow may be too late ..