If statement tree w/ variables
Posted: 19 Jul 2021, 19:05
Help! I'm having a moment of ineptitude and I can't figure out what I'm doing wrong! (lol)
The circumstance:
I've got three subroutines to do some webform stuff for me. When it finishes I need to name a PDF file with a tag from the subroutine type I ran. For sake of ease, the subs will be called sub 1, sub 2, and sub 3. When I run 1, I want my subroutine to name the PDF file to name the PDF with sub 1's name, same for sub 2 and sub 3.
I'm using an .ini called "settings" to get the boolean value for all 3 subs into my parent script where the if statements and logical analysis happens. I had it working previously, however, I only made it work purely through trial/error. I want to know WHY it works just as much as why I'm not doing it right.
TL;DR:
I've got three subroutines to fire from one parent script. I want the parent script to hold on to a variable, (1,2,3...), from the child subs. Help!
See code below
(Someone please tell me I'm just being silly!)
THANK YOU!
The circumstance:
I've got three subroutines to do some webform stuff for me. When it finishes I need to name a PDF file with a tag from the subroutine type I ran. For sake of ease, the subs will be called sub 1, sub 2, and sub 3. When I run 1, I want my subroutine to name the PDF file to name the PDF with sub 1's name, same for sub 2 and sub 3.
I'm using an .ini called "settings" to get the boolean value for all 3 subs into my parent script where the if statements and logical analysis happens. I had it working previously, however, I only made it work purely through trial/error. I want to know WHY it works just as much as why I'm not doing it right.
TL;DR:
I've got three subroutines to fire from one parent script. I want the parent script to hold on to a variable, (1,2,3...), from the child subs. Help!
See code below
Code: Select all
;CHILD SCRIPT CODE
; There's a bunch of clicks and copies, then a webform is submitted. The contents of the form are besides the point.
; This variable becomes the decision maker for what style name to type out in the PDF name line.
NCMVar := 1
IniWrite,%NCMVar%,settings.ini,ncmtype,ncmvar
Code: Select all
; PARENT SCRIPT CODE
; Get boolean values from settings.ini.
; If 1, or variable name, then send the style name, "NCM", "ISW", "POC"...
;Get Style
IniRead,NCMvar,settings.ini,ncmtype,ncmvar
If (NCMvar = 1,NCM)
{
clipboard = %servicedate%
Sleep 10
DllCall("SetCursorPos", int, 2258, int, 640)
Send {LButton}
Send {End}
Sleep 10
Send ^v{.}NCM {Space}
}
Else
IniRead,ISWvar,settings.ini,iswtype,iswvar
If (ISWVar = 1,ISW)
{
clipboard = %servicedate%
Sleep 10
DllCall("SetCursorPos", int, 2258, int, 640)
Send {LButton}
Send {End}
Sleep 10
Send ^v{.}ISWCM {Space}
}
Else
IniRead,POCvar,settings.ini,poctype,pocvar
If (POCVar = 1,POC)
{
clipboard = %servicedate%
Sleep 10
DllCall("SetCursorPos", int, 2258, int, 640)
Send {LButton}
Send {End}
Sleep 10
Send ^v{.}POC {Space}
}
(Someone please tell me I'm just being silly!)
THANK YOU!