AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Problem with FileSelectFile and storing Path

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
SkunKz
Guest





PostPosted: Fri Aug 22, 2008 9:43 am    Post subject: Problem with FileSelectFile and storing Path Reply with quote

Hi, i've got a new problem with my script ^^

this is my problem :
i've got a normal GUI with textfields etc.
if u click on 1 textfield a program should be startet. now the problem : everybody got another path where this program is located. Thats why i want to use FileSelectFile to locate the executable file of the program.
But i want to do this only ONCE and then the script should "save the path"

do you guys have any idea or know how to handle this not that complicated?

i also cant use Regread because this programs are not saved in the registry.

Could i store the path in a new variable?

It is also possible to store the path in a .txt file but i dont want to do this.

best regards, SkunKz
Back to top
rodfell



Joined: 05 Oct 2007
Posts: 57
Location: Bundaberg (Bundy), Qld, Australia

PostPosted: Fri Aug 22, 2008 11:58 am    Post subject: Reply with quote

Code:
fileselectfile,file
RegWrite,REG_SZ,HKEY_LOCAL_MACHINE,SOFTWARE\Program Name,File Selected,%file%
Regread,fileexecutable,HKEY_LOCAL_MACHINE,SOFTWARE\Program Name,File Selected
run %fileexecutable%


Last edited by rodfell on Fri Aug 22, 2008 12:05 pm; edited 1 time in total
Back to top
View user's profile Send private message
Serenity



Joined: 07 Nov 2004
Posts: 1276

PostPosted: Fri Aug 22, 2008 12:03 pm    Post subject: Reply with quote

If you don't want to store the value in the registry you can use an ini file instead with IniRead/IniWrite commands.
_________________
"Anything worth doing is worth doing slowly." - Mae West
Back to top
View user's profile Send private message Visit poster's website
SkunKz
Guest





PostPosted: Fri Aug 22, 2008 12:30 pm    Post subject: Reply with quote

ok. thx guys i will try it
Back to top
garry



Joined: 19 Apr 2005
Posts: 1186
Location: switzerland

PostPosted: Fri Aug 22, 2008 1:24 pm    Post subject: Reply with quote

I've tried idea from serenity with ini

Code:
MODIFIED=20080822
FILENAME=MENU_INI_TEST


RSSINI=%A_scriptdir%\RSSINI.txt

     ;------------ Select Predefined Folder ---------------------
     menu ,S1 ,Add,&Set a predefined Folder MUSIC [Search from here],MH1
     menu ,S1 ,Add,&Set a predefined Folder VIDEO [Search from here],MH1TV

     ;------------ Select Folder ---------------------
     menu ,S2 ,Add,&Select Music Folder     ,MS1MUS
     menu ,S2 ,Add,&Select Video Folder     ,MS1VID
     ;-------------- TOOLS ---------------------------
     Menu, S3 ,add,SCREEN            ,MH3

   menu, myMenuBar, Add, Predefine Folder ,:S1
   menu, myMenuBar, Add, Select Folder    ,:S2
   menu, myMenuBar, Add, TOOLS            ,:S3

Gui,2:Add, Button, x10  y10 w200  h20 gMFOLDER       ,LAST SELECTED MUSIC FOLDER
Gui,2:Add, Button, x10  y40 w200  h20 gVFOLDER       ,LAST SELECTED VIDEO FOLDER

gui,2:menu,MyMenuBar
gui,2:show, x0 y0 h70 w250,TEST_INI
return
;-------------------------------------------------------------------

;----------------------------
MFOLDER:
IniRead, MF      , %rssini%  ,LASTSELECTED MUSIC , KEY3
if MF=
   return
run,%MF%
return

;----------------------------
VFOLDER:
IniRead, MF      , %rssini%  ,LASTSELECTED VIDEO , KEY4
if MF=
   return
run,%MF%
return


MH3:
run,c:\windows\system32\Desk.cpl
return


;------------- PREDEFINE A FOLDER SEARCH FROM here MUSIC ------------
MH1:
PRESELECT=%a_desktop%
FileSelectFolder,MF,%PRESELECT%
if MF=
  return
IniWrite,%MF%      , %rssini%  ,PREDEFINED FOLDER MUSIC , KEY1
return
;--------------------------------------------------------------
;------------- PREDEFINE A FOLDER SEARCH FROM here TV ------------
MH1TV:
PRESELECTVID=%a_desktop%
FileSelectFolder,MFVID,%PRESELECTVID%
if MFVID=
  return
IniWrite,%MFVID%      , %rssini%  ,PREDEFINED FOLDER VIDEO , KEY4
return
;--------------------------------------------------------------


;--------------- SELECT MUSICFOLDER ---------------------------------
MS1MUS:
IniRead, PRESELECT      , %rssini%  ,PREDEFINED FOLDER MUSIC , KEY1
FileSelectFolder,MF,%PRESELECT%
if MF=
  return

IniWrite,%MF%      , %rssini%  ,LASTSELECTED MUSIC , KEY3
return
;-------------------------------------------------------------------

;--------------- SELECT VIDEOFOLDER ---------------------------------
MS1VID:
IniRead, PRESELECT      , %rssini%  ,PREDEFINED FOLDER VIDEO , KEY4
FileSelectFolder,MF,%PRESELECT%
if MF=
  return

IniWrite,%MF%      , %rssini%  ,LASTSELECTED VIDEO , KEY4
return
;-------------------------------------------------------------------

2Guiclose:
exitapp
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group