Sign in to follow this  
Followers 0
Aktonius

How can i define variable inside include then check it within main script?

8 posts in this topic

I tried something like using a function from include and inside that function i define $variable which later i try to use within main script but it doesnt recognize the variable.

What would be the right procedure so variable defined somewhere in include file's function is recognized within main script?

Share this post


Link to post
Share on other sites



Aktonius,

It is bad coding practice to try to use variables from within includes in your main script. The whole idea of includes is that they are self-contained and can be used in different scripts. :>

You should get the include to pass the value of the variable as the return value from the function defined within the include. Perhaps if you posted the essential parts of the include and the script we could show you how you might do this. :unsure:

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Melba i am aware of this but i am trying to add some security check for a script that should pay off some hard work i did :unsure:

I am just trying to add few extra blocks of security, its bad coding practice but it helps

If include file gets broken/removed by a crackingkid my main script would break down as well

Edited by Aktonius

Share this post


Link to post
Share on other sites

Aktonius,

If include file gets broken/removed by a crackingkid my main script would break down as well

How does a "crackingkid" get to "break/remove" an include? ;)

If you have all the files in .au3 format the security you get from your scheme will be trivial. If you have compiled the file the include files are (as the name suggests) already included and I do not see how this adds any security at all. :>

Could you explain a little further? :D

M23

P.S. Love the term "crackingkid", by the way. :unsure:


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

hehe, well

Usually those crackingkids will just reove some function calls with debugger like Olly etc..

If i could add some variables in those functions that later my script would check call for then that job wouldnt do much good for them. Understand now?

Example you put in a value in a variable that only you know, later your script will check for that value randomly, if it doesnt exist(means the seccurity function didnt finish) boom, bye bye

Edited by Aktonius

Share this post


Link to post
Share on other sites

Aktonius,

If you want a variable from a function within an include to be recognised outside the include, just define it as Global. You might get a warning from Au3Check about it, but it will work. Just make sure you give it a sufficiently unique name that it will not interfere with any other Global variable. :unsure:

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

Ok, thanks for the help, can you suggest some way to exit a script without just exit macro

I figure it would mess up thing bit more

Share this post


Link to post
Share on other sites

Aktonius,

can you suggest some way to exit a script without just exit macro

If I had the slightest idea what you meant I might! ;)

Do you mean exit without looking for a $GUI_EVENT_CLOSE event? :unsure:

If so then just use any old event to exit - for example this will exit if you click the minimize button or release the right mouse button:

#include <GUIConstantsEx.au3>

$hGUI = GUICreate("Test", 500, 500)

GUISetState()

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_MINIMIZE, $GUI_EVENT_SECONDARYUP
            Exit
    EndSwitch
WEnd

Or have I got completely the wrong end of the stick? :>

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0