Page 1 of 1
Get the app directory
Posted: Mon Nov 02, 2009 7:39 am
by alemrantareq
Hi everybody,
I need a little help. I want the btn code to open the current directory where my app exists. Before some months, I found that code somewhere but I lost it. "The DefaultFolder" property helps in this way but it puts "/" instead of "\". Pls, help me to get that code. Replies are most appreciated.
Posted: Mon Nov 02, 2009 9:32 am
by Mark
Hi alemrantareq,
What is your current code to open the folder?
Yo don't want to use the defaultFolder. Instead, you want to use:
set the itemdel to slash
put item 1 to -2 of the effective filename of this stack into myFolder
You might want to replace <this stack> with <stack "Your Stack">.
Best,
Mark
Posted: Mon Nov 02, 2009 1:18 pm
by alemrantareq
Hi Mark,
very luckily I've found that code in this forum. This code is -
Code: Select all
on mouseUp
set the hideconsolewindows to true
get shell("start" && quote & quote && quote & the defaultfolder & quote)
end mouseUp
Mark, this code was posted by you into "Opening a folder in Windows" topic in this Windows forum
http://forums.runrev.com/phpBB2/viewtopic.php?t=1597
I thought it was in "Talking Revolution" section and I gave it a deep search, but nothing found. After your reply, I made a search in Windows forum and at last, I discovered it.
Thanks a lot for your reply and your code.
Â
Posted: Mon Nov 02, 2009 1:55 pm
by Mark
alemrantareq,
Edgore seemed to have a reason to use the defaultFolder. You will probably want to use the effeective filename instead.
Best,
Mark
Re: Get the app directory
Posted: Sat Nov 21, 2009 10:02 am
by alemrantareq
I don't need the file name, rather I need to open the directory where my app exists. Is there any way to do it without using shell function?
Re: Get the app directory
Posted: Sat Nov 21, 2009 10:15 am
by Mark
alemrantareq,
I already understood that you want to get the folder name, but you still will want to use the effective filename.
Code: Select all
set the itemDel to slash
put item 1 to -2 of the effective filename of this stack into myFolderPath
replace slash with backslash in myFolderPath
set the hideconsolewindows to true
get shell("start" && quote & quote && quote & myFolderPath & quote)
I think you could have figured this out by yourself. Why don't you want to use the shell function?
Best,
Mark
Re: Get the app directory
Posted: Thu Nov 26, 2009 5:37 pm
by alemrantareq
Thanks Mark,
I can open the app folder simply with my previous posted code. But I wanted to know if there's another way without using "Shell" function.
Anyway, Thanks you most

Re: Get the app directory
Posted: Thu Nov 26, 2009 6:53 pm
by FourthWorld
The default folder for an application is user-settable, so while it defaults to the folder the app is in it may be changed at anytime to anything else.
To get the path to the executable I use the filename property, which has the added benefit of working in the IDE or a standalone.
The function listed in this use-rev post accounts for the differences between Win and OS X and returns the path to the executable:
http://lists.runrev.com/pipermail/metac ... 02553.html
Re: Get the app directory
Posted: Thu Nov 26, 2009 6:56 pm
by Mark
Hi Richard,
I think you mean effective filename, rather than filename.
Best,
Mark
Re: Get the app directory
Posted: Sat Dec 26, 2009 5:59 pm
by alemrantareq
Hi, I just need another help. If i use the Defaultfolder property to put it into a variable, it gets the full address of that directory (i.e. C:/Program Files/Revolution Enterprise). But I just need to put only the folder name (i.e. Revolution Enterprise) into a variable instead of the full name. what should i do?
Re: Get the app directory
Posted: Sat Dec 26, 2009 6:32 pm
by FourthWorld
Path elements are separated by slashes, and Rev allows you to work with individual items delimited by any character as items. See the itemdelimiter property in the Dictionary.
Re: Get the app directory
Posted: Sun Dec 27, 2009 11:21 am
by alemrantareq
Dear FourthWorld, Thanks for your information. The following works with me nicely -
Code: Select all
put the defaultfolder into tfolder
set the itemdel to "/"
put item -1 of tfolder into tvar
Now, the "tvar" variable holds my app's folder name