Quantcast
Channel: AutoIt v3 - General Help and Support
Viewing all articles
Browse latest Browse all 12506

how can a function process all available variables?

$
0
0

ola! i'm trying to create a simple script to close running applications after that shutdown, the code is already working fine, i would like to make it simpler, minimize repetition in the code, i'm thinking of a function that would reuse the available variables.

 

code sample: 

;processes $firefox = "firefox.exe" $chrome = "chrome.exe" Func zz()   If ProcessExists($firefox) then      ProcessClose($firefox)   EndIf   If ProcessExists($chrome) then      ProcessClose($chrome)   EndIf EndFunc If @OSArch = "X86" Then      zz()      Sleep(1000)      Shutdown(1)      Exit EndIf

what i would like is to have func zz() process all the variables, i will just to pass a single variable to func zz(), but this single variable is the culmination of all available variables, i like to make this work so that i would just add new apps easily and it will be processed

 

new code sample:

;processes $firefox = "firefox.exe" $chrome = "chrome.exe" $programs = all available variable here Func zz()   If ProcessExists($programs) then      ProcessClose($programs)   EndIf EndFunc If @OSArch = "X86" Then      zz()      Sleep(1000)      Shutdown(1)      Exit EndIf

TIA


Viewing all articles
Browse latest Browse all 12506

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>