DonationCoder.com forum
 
Read-only archive. This is a static copy of the DonationCoder.com forum. Reading and searching work as before; logging in, posting and private messages do not.
Archive of 2026-10-21 · About this archive · Main site

Author Topic: Little modification to menuak.ahk  (Read 8,600 times)

Contro

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 3,947
Little modification to menuak.ahk
« on: June 05, 2012, 11:30 PM »
I am using the splendid program menuak.ahk

Is possible to modify ?

My problem is simple.

If I put a link in my CRM Goldmine 5.5 don't find the launcher.ini. curiosly don't happen when launched with PowerTray from lopesoft.com.

Example :
Y:\PORTABLES\Personaliza pc\menuak.ahk\menuak.ahk
When I execute don't read the launcher.ini. Reads the standard one because don't find the corresponding in the same folder.
Y:\PORTABLES\Personaliza pc\menuak.ahk\launcher.ini

I have tried to solve this problem with a bat file, but the result is not good because I don't know how to close the cmd window while I am executing the script.
So. I would like to obtain a menuak.ahk able to find the launcher.ini in the same folder where the .ahk file is.

The initial code is :

Code: (autohotkey)
#NoEnv
IniRead, numRows, launcher.ini, General, numRows, 0
IniRead, numCols, launcher.ini, General, numCols, 0
if !numRows
  InputBox, numRows, , Enter number of rows   , , 200, 120, , , , , 5
if !numCols
  InputBox, numCols, , Enter number of columns, , 200, 120, , , , , 2
IniWrite, %numRows%, launcher.ini, General, numRows
IniWrite, %numCols%, launcher.ini, General, numCols

Loop % numRows*numCols
{
  IniRead, Title%A_Index%, launcher.ini, Titles, Title%A_Index%, %A_Index%
  IniRead, Path%A_Index%, launcher.ini, Paths, Path%A_Index%,
}

Gui, Add, Button, w150 r1.5 gRun vButt1, %Title1%
Gui, Add, Button, w40 hp xp+150 gEdit vEdit1, Edit
Edit1:=1
Butt1:=1

Loop % numRows*numCols-1
{
  Index:=A_Index+1
  Title:=Title%Index%
  ys:=!Mod(Index-1, numRows) ? "ys" : "xp-150 yp+35"
  Gui, Add, Button, w150 hp %ys% gRun vButt%Index%, %Title%
  Gui, Add, Button, w40 hp xp+150 gEdit vEdit%Index%, Edit
  Edit%Index%:=Index
  Butt%Index%:=Index
}

Gui, Show, , Menu expedientes

Gui 2:+owner
Gui 2:Add, Text, right, Button title:
Gui 2:Add, Text, right, Program to run:
Gui 2:Add, Edit, w300 ys vSelTitle
Gui 2:Add, Edit, w300 vSelPath
Gui 2:Add, Button, w25 gFileSelect vFileSelect r0.9 xp+300 yp, ....
Gui 2:Add, Button, w100 gSelOk r1.5 xp-250 yp+35 default, OK

return

Run:
  tpp:= % "Path" %A_GuiControl%
  Run % %tpp%
return

Edit:
  Gui +Disabled
  cIndex:=%A_GuiControl%
  GuiControl, 2:, SelTitle, % Title%cIndex%
  GuiControl, 2:, SelPath, % Path%cIndex%
  FileSelect:=cIndex
  Gui 2:Show, , Select options for button ?%cIndex%
return

FileSelect:
  Gui +OwnDialogs
  FileSelectFile, Path%cIndex%, 3, %A_ProgramFiles%, Select program to run with button ?%cIndex%, Programs(*.exe;*.lnk;*.bat)
  GuiControl, 2:, SelPath, % Path%cIndex%
return

GuiClose:
ExitApp

2GuiClose:
  Gui 1:-Disabled
  Gui 2:Cancel
return

SelOk:
  Gui 1:-Disabled
  Gui 2:Submit
  Path%cIndex%:=SelPath
  Title%cIndex%:=SelTitle
  GuiControl, 1:, Butt%cIndex%, % Title%cIndex%
  IniWrite, % Title%cIndex%, launcher.ini, Titles, Title%cIndex%
  IniWrite, % Path%cIndex%, launcher.ini, Paths, Path%cIndex%
return

and the launcher.ini contains the configuration

[General]
numRows=5
numCols=2
[Titles]
Title1=Carpetas expediente
Title2=Traspaso Gestión MGD
Title3=Creación Goldmine
Title4=Procedimientos Proyecto
Title5=Procedimientos Informáticos
Title6=Procedimientos Comunes
Title7=Generar orden de trabajo
Title8=Lanzar una carpeta
Title9=Lanzar una web
Title10=Lanzar Goldmine
[Paths]
Path1=Y:\GABINETE\PROYECTOS\Listas.exe
Path2=ERROR
Path3=ERROR
Path4=ERROR
Path5=ERROR
Path6=ERROR
Path7=ERROR
Path8=Y:\PORTABLES\Educativos\BabelBox
Path9=http://www.autohotkey.com/forum/viewtopic.php?p=304050#304050
Path10=Y:\GoldminePrg\gmw5.exe /i:esm /u:JOSE /p:

(is a simple example, not real)

:-*
« Last Edit: June 05, 2012, 11:36 PM by Contro »

skwire

  • I eat Coding Snacks for breakfast...
  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 5,297
    • Participated in NANY Challenge Seventeen Times
    • Coding Snacks
    • Superboy Coder
    • Cody Award
    • Volunteers/Staff
    • Gathering Badge
Re: Little modification to menuak.ahk
« Reply #1 on: June 06, 2012, 12:00 AM »
Try adding the following line as the first line in your akmenu.ahk script file:
Code: (autohotkey)
SetWorkingDir, %A_ScriptDir%

highend01

  • Supporting Member
  • Joined in 2011
  • **
  • Posts: 188
Re: Little modification to menuak.ahk
« Reply #2 on: June 06, 2012, 12:02 AM »
Try to replace all launcher.ini occurrences with:
Code
%A_ScriptDir%\launcher.ini

kunkel321

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 626
    • Participated in NANY Challenge Once
Re: Little modification to menuak.ahk
« Reply #3 on: June 06, 2012, 03:34 AM »
What is this splendid menuak?

Contro

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 3,947
Re: Little modification to menuak.ahk
« Reply #4 on: June 06, 2012, 11:17 PM »
Try adding the following line as the first line in your akmenu.ahk script file:
Code: (autohotkey)
SetWorkingDir, %A_ScriptDir%

Nice idea indeed. Goingggg

:-*

Contro

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 3,947
Re: Little modification to menuak.ahk
« Reply #5 on: June 06, 2012, 11:17 PM »
Try to replace all launcher.ini occurrences with:
Code
%A_ScriptDir%\launcher.ini

Nice idea. I will apply.

Best Regards
:-*

Contro

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 3,947
Re: Little modification to menuak.ahk
« Reply #6 on: June 06, 2012, 11:19 PM »
What is this splendid menuak?

Is a menu maker. You can propose webs, exe, bat, and so on. I am using a menu with 225 options. Marvellous.
Above is the code.

:)

Original address: https://www.donationcoder.com/forum/index.php?topic=31234.0