Script Issues

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Ben the Coder

Script Issues

Post by Ben the Coder » 19 Aug 2022, 18:34

Hi guys,
I have a setup script, and for some reason it's not downloading the specified file (at the end of the script, using the URLDownloadToFile command).
Below is the code:

Code: Select all

#SingleInstance Force
#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%

full_command_line := DllCall("GetCommandLine", "str")

if not (A_IsAdmin or RegExMatch(full_command_line, " /restart(?!\S)"))
{
    try
    {
        if A_IsCompiled
            Run *RunAs "%A_ScriptFullPath%" /restart
        else
            Run *RunAs "%A_AhkPath%" /restart "%A_ScriptFullPath%"
    }
    ExitApp
}

loading := "C:\Users\benri\OneDrive\Desktop\My Files\Logos, Loaders, Icons, and Home Screens\Loaders\ajax-loader_002.gif"

Gui, WelcomeGUI:Add, Text,, Hi!
Gui, WelcomeGUI:Add, Text,, Welcome to the Formal Software Download Assistant.
Gui, WelcomeGUI:Add, Text,, To continue, click the NEXT button.  To cancel this process, click the ABORT button.
Gui, WelcomeGUI:Add, Picture, w200 h-1 gBack, %A_ScriptDir%\Back.png
Gui, WelcomeGUI:Add, Picture, w200 h-1 ym gNext, %A_ScriptDir%\Next.png
Gui, WelcomeGUI:Show

Gui, Load:-Caption +Toolwindow +Alwaysontop
Gui, Load:Add, ActiveX, w120 h150, % "mshtml:<img src='" loading "' />"
Sleep, 2000
	Gui, Load:Destroy

Gui, ChooseAppGUI:Add, Text,, Select the Formal Software products you want to install.
Gui, ChooseAppGUI:Add, Checkbox, Checked vInstTexType, TexType
Gui, ChooseAppGUI:Add, Checkbox, Checked vInstMathMadeEasy, Math Made Easy Package
Gui, ChooseAppGUI:Add, Button, Default vDownload, Done
Gui, ChooseAppGUI:Show  ; Show the window.
return


Back:
	ExitApp

Next:
	Gui, WelcomeGUI:Destroy
	Gui, Load:Show
	return

ChooseAppGUIButtonDone:
Switch vInstTexType
{
Case 1: MsgBox Done?
	FileCreateDir, %A_ProgramFiles%\Formal Software\TexType\Installer files
	URLDownloadToFile, https://1drv.ms/u/s!AssKrEUmq8NO1Ft2vra8EUxyVQ1y?e=MJJrRl, %A_ProgramFiles%\Formal Software\TexType\Installer files\TexType 1.1.exe  ; Install TexType.
	MsgBox, Downloaded!
Case 0: return  ; Do not install TexType.
}


ExitApp
I've used the script writing style suggested to me here :arrow: viewtopic.php?p=476241#p476241 so maybe something there's the issue?
Can someone help me with this issue? :?:

teadrinker
Posts: 4326
Joined: 29 Mar 2015, 09:41
Contact:

Re: Script Issues

Post by teadrinker » 19 Aug 2022, 18:47

Ben the Coder wrote:

Code: Select all

Switch vInstTexType
But there is no vInstTexType variable in your script.

Ben the Coder

Re: Script Issues

Post by Ben the Coder » 19 Aug 2022, 18:50

Sorry for the trouble! :facepalm:
I just realized that the variable InstTexType shouldn't have a v in front of it.
That's only when defining the variable.


Ben the Coder

Re: Script Issues

Post by Ben the Coder » 20 Aug 2022, 09:33

teadrinker wrote:
19 Aug 2022, 18:51
:thumbup:
Thanks, @teadrinker!
;)

Post Reply

Return to “Ask for Help (v1)”