Remove included script
Moderators: JRL, Dorian (MJT support)
Remove included script
Hello to all,
Is there any way of removing script that has been included? For example, I create new commands and use IncludeFromVar. It works fine. The commands are executed. But later, that subroutine is called to create new commands, meaning the old previous commands are no longer needed. It won't work. Not for all my clever thinking. I tried DelVariable. That may delete the var, but the included command lines still remain.
The script I am working on is a database of sorts. I read in some text file that contains a data block. I include the data block and then include the contents of said block by using LabelToVar. Problem is I can't unload what I already included. The data block is required as it is the data that I load into (I can't think of it) the database form in a Dialog.
I am always open for suggestion. Maybe another way of thinking. (I feel I should clarify, nice suggestions.)
@Marcus - Maybe you might consider adding an "unload" command. (??)
A quote from a comedian I just love......
May the forces of evil become confused on the way to your home,
PepsiHog
Is there any way of removing script that has been included? For example, I create new commands and use IncludeFromVar. It works fine. The commands are executed. But later, that subroutine is called to create new commands, meaning the old previous commands are no longer needed. It won't work. Not for all my clever thinking. I tried DelVariable. That may delete the var, but the included command lines still remain.
The script I am working on is a database of sorts. I read in some text file that contains a data block. I include the data block and then include the contents of said block by using LabelToVar. Problem is I can't unload what I already included. The data block is required as it is the data that I load into (I can't think of it) the database form in a Dialog.
I am always open for suggestion. Maybe another way of thinking. (I feel I should clarify, nice suggestions.)
@Marcus - Maybe you might consider adding an "unload" command. (??)
A quote from a comedian I just love......
May the forces of evil become confused on the way to your home,
PepsiHog
Windows 7
PepsiHog. Yep! I drink LOTS of Pepsi (still..in 2024) AND enjoy programming. (That's my little piece of heaven!)
The immensity of the scope of possibilities within Macro Scheduler pushes the user beyond just macros!
PepsiHog. Yep! I drink LOTS of Pepsi (still..in 2024) AND enjoy programming. (That's my little piece of heaven!)
The immensity of the scope of possibilities within Macro Scheduler pushes the user beyond just macros!
- Grovkillen
- Automation Wizard
- Posts: 1132
- Joined: Fri Aug 10, 2012 2:38 pm
- Location: Bräcke, Sweden
- Contact:
Re: Remove included script
If you use include from file and actually produce a file with the subroutines you can later overwrite this external file and reloop the include from file. Just a thought, haven't tried it.
Re: Remove included script
Below is a proof of concept I wrote a long time ago. Sorry its not cleaned up or annotated and I don't have time to do either. Basically you enter an include or includefromvar at the end of the included code block then control the execution of each code block using flag variables.
Put this in your editor and step through with F8 and you can watch the results.
If you actually run it your screen will fill with light green dialogs. You can close the script using the key combo WINKEY + Esc
Hope this is helpful.
Put this in your editor and step through with F8 and you can watch the results.
If you actually run it your screen will fill with light green dialogs. You can close the script using the key combo WINKEY + Esc
Hope this is helpful.
Code: Select all
OnEvent>Key_Down,VK1,2,CloseWin
OnEvent>Key_Down,VK27,8,Close
//Let>XSpan=200
//Let>YSpan=200
//Dialogs' opacity
Let>Opacity=100
//Number of dialogs in a row
Let>kX=10
//Number of dialogs in a column
Let>kY=10
GetScreenRes>scrX,scrY
//Let>kX={round(%scrX%/%Xspan%)}
//Let>kY={round(%scrY%/%Yspan%)}
Let>Xspan={round(%scrX%/%kX%)}
Let>Yspan={round(%scrY%/%kY%)}
Let>krow=0
Let>kcol=0
Let>kk=0
//Usage:
//GoSub>MakeDialog,sequence number,wide,high,Xlocation,Ylocation
Repeat>krow
Add>krow,1
Repeat>kcol
Add>kcol,1
Add>kk,1
Let>Xpos={(%krow%*%Xspan%)-%Xspan%}
Let>Ypos={(%kcol%*%Yspan%)-%Yspan%}
GoSub>MakeDialog,%kk%,%Xspan%,%Yspan%,%Xpos%,%Ypos%
Until>kcol,%kY%
Let>kcol=0
Until>krow,%kX%
//Set a few values for windows API functions
Let>WS_BORDER=
Let>WS_THICKFRAME=262144
Let>WS_CHILD=1073741824
Let>HWND_TOPMOST=-1
Let>ESB_DISABLE_BOTH=3
Let>SB_BOTH=3
Let>SWP_NOREDRAW=8
Let>GWL_EXSTYLE=-20
Let>WS_EX_LAYERED=524288
Let>LWA_ALPHA=2
Random>%kk%,TheOne
Add>TheOne,1
Let>showk=0
Repeat>showk
Random>16777215,color
Add>showk,1
Show>Dialog%showk%
Let>WinName=D~L~o~g%showk%
GetWindowPos>WinName,WinNameX,WinNameY
Let>MouseX=%WinNameX%+%Xspan%
Let>MouseY=%WinNameY%+%Yspan%
//Selection window Opacity settings
LibFunc>user32,GetWindowLongA,Selattribs,Dialog%showk%.handle,GWL_EXSTYLE
Let>SelAttribs={%Selattribs% OR %WS_EX_LAYERED%}
LibFunc>user32,SetWindowLongA,swl,Dialog%showk%.handle,GWL_EXSTYLE,SelAttribs
LibFunc>user32,SetLayeredWindowAttributes,res,Dialog%showk%.handle,0,Opacity,LWA_ALPHA
LibFunc>user32,SetWindowLongA,sres,Dialog%showk%.handle,-16,1
CloseDialog>Dialog%showk%
Show>Dialog%showk%
//SetDialogObjectColor>Dialog%showk%,,color
If>%showk%=%TheOne%
SetDialogObjectColor>Dialog%showk%,,16537180
Else
SetDialogObjectColor>Dialog%showk%,,1234567
EndIf
//LibFunc>User32,SetWindowPos,swpr,Dialog%showk%.handle,HWND_TOPMOST,%WinNameX%,%WinNameY%,%MouseX%,%MouseY%,80
ResizeWindow>%WinName%,%Xspan%,%Yspan%
Until>showk,%kk%
Label>Loop
GetDialogAction>Dialog%TheOne%,res1
If>res1=2
Exit>0
EndIF
/////////////////////////////////////////////////Notice the small wait///////////////////////////////////////////////
//////////////////////////////////////////////This prevents high CPU usage///////////////////////////////////////////
Wait>0.01
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Goto>Loop
SRT>MakeDialog
Let=FileName=%temp_Dir%Dialogtest%MakeDialog_var_1%.scp
Let>includeFlag=%MakeDialog_var_1%
IfFileExists>FileName
DeleteFile>FileName
EndIf
LabelToVar>CreateDialog,WrDia
/*
CreateDialog:
If>IncludeFlag=%MakeDialog_var_1%
Dialog>Dialog%MakeDialog_var_1%
Caption=D~L~o~g%MakeDialog_var_1%
Height=0
Width=0
Left=%MakeDialog_var_4%
Top=%MakeDialog_var_5%
EndDialog>Dialog%MakeDialog_var_1%
EndIf
If>IncludeFlag<>%MakeDialog_var_1%
IncludeFromVar>WrDia
EndIf
*/
IncludeFromVar>WrDia
END>MakeDialog
SRT>Close
Exit>0
END>Close
SRT>CloseWin
GetCursorPos>CurX,CurY
MouseMove>CurX,CurY
Lclick
Wait>0.1
GetActiveWindow>WinTitle,WinX,WinY
MidStr>WinTitle,1,7,First
If>First=D~L~o~g
MidStr>WinTitle,8,1,Second
If>{(%second%>-1)and(%second%<10)}
CloseWindow>WinTitle
EndIf
EndIf
END>CloseWin
Re: Remove included script
Hey JRL,
Nice to have you in the forum again. Thanks for the sample script. I should have it decoded within a year. Just out of curiosity, do you like ever write simple scripts? Is there one script of yours that doesn't have LibFunc or API something this that and the other in it?
Like always I love your help. But, like always I now have a headache.
What I am trying to do is remove the previously included and replace it with a new include. I estimate my database having over 400 pages and growing. I have not yet tried it, but I don't think Windows will take too kindly to that much being in memory. Plus, right now I am using my Windows 7 machine. I think it won't take too kindly even more.
Do you have a book reference you use for LibFunc? What is your source? If you don't mind telling. If it is a book, I need to buy it.
I think "they" need to come up with a term that describes obsession with creating dialogs. If there were such a term, you may be able to get help. Maybe, instead of AA it would be DA.
Seriously, welcome back. You may not be able to get help, but now I can. That's just the cold hard truth, bro!
PepsiHog
Nice to have you in the forum again. Thanks for the sample script. I should have it decoded within a year. Just out of curiosity, do you like ever write simple scripts? Is there one script of yours that doesn't have LibFunc or API something this that and the other in it?

Like always I love your help. But, like always I now have a headache.
What I am trying to do is remove the previously included and replace it with a new include. I estimate my database having over 400 pages and growing. I have not yet tried it, but I don't think Windows will take too kindly to that much being in memory. Plus, right now I am using my Windows 7 machine. I think it won't take too kindly even more.
Do you have a book reference you use for LibFunc? What is your source? If you don't mind telling. If it is a book, I need to buy it.
I think "they" need to come up with a term that describes obsession with creating dialogs. If there were such a term, you may be able to get help. Maybe, instead of AA it would be DA.
Seriously, welcome back. You may not be able to get help, but now I can. That's just the cold hard truth, bro!

PepsiHog
Windows 7
PepsiHog. Yep! I drink LOTS of Pepsi (still..in 2024) AND enjoy programming. (That's my little piece of heaven!)
The immensity of the scope of possibilities within Macro Scheduler pushes the user beyond just macros!
PepsiHog. Yep! I drink LOTS of Pepsi (still..in 2024) AND enjoy programming. (That's my little piece of heaven!)
The immensity of the scope of possibilities within Macro Scheduler pushes the user beyond just macros!
Re: Remove included script
@ Grovkillen,
I will give that a try. It's a concept. I only fear though, I suspect it won't work. The script files while loaded into the editor won't allow access to them again. So, back to how do we unload an include?
If only there were a genius programmer that could add a command to the next version of MS like RemoveInclude>. Do you know anyone like this? Look! It's a plane....no! it's super genius!
Thanks for helping,
PepsiHog
I will give that a try. It's a concept. I only fear though, I suspect it won't work. The script files while loaded into the editor won't allow access to them again. So, back to how do we unload an include?
If only there were a genius programmer that could add a command to the next version of MS like RemoveInclude>. Do you know anyone like this? Look! It's a plane....no! it's super genius!
Thanks for helping,
PepsiHog
Windows 7
PepsiHog. Yep! I drink LOTS of Pepsi (still..in 2024) AND enjoy programming. (That's my little piece of heaven!)
The immensity of the scope of possibilities within Macro Scheduler pushes the user beyond just macros!
PepsiHog. Yep! I drink LOTS of Pepsi (still..in 2024) AND enjoy programming. (That's my little piece of heaven!)
The immensity of the scope of possibilities within Macro Scheduler pushes the user beyond just macros!
Re: Remove included script
@ Grovkillen,
Well blow me down! It actually worked. I really did not expect it to work for the aforementioned reasoning! It even let the file be deleted and re-written. I tried that because I want to get rid of previous code.
You are a genius, Grovkillen. Thank you. Thank you. Thank you. I regret my inability to believe in your idea. I am now free to move about the cabin!
Have a Pepsi on me!
PepsiHog
Well blow me down! It actually worked. I really did not expect it to work for the aforementioned reasoning! It even let the file be deleted and re-written. I tried that because I want to get rid of previous code.
You are a genius, Grovkillen. Thank you. Thank you. Thank you. I regret my inability to believe in your idea. I am now free to move about the cabin!
Have a Pepsi on me!
PepsiHog
Windows 7
PepsiHog. Yep! I drink LOTS of Pepsi (still..in 2024) AND enjoy programming. (That's my little piece of heaven!)
The immensity of the scope of possibilities within Macro Scheduler pushes the user beyond just macros!
PepsiHog. Yep! I drink LOTS of Pepsi (still..in 2024) AND enjoy programming. (That's my little piece of heaven!)
The immensity of the scope of possibilities within Macro Scheduler pushes the user beyond just macros!
- Grovkillen
- Automation Wizard
- Posts: 1132
- Joined: Fri Aug 10, 2012 2:38 pm
- Location: Bräcke, Sweden
- Contact:
Re: Remove included script
Happy to have helped!PepsiHog wrote: ↑Thu Jun 20, 2019 6:24 am@ Grovkillen,
Well blow me down! It actually worked. I really did not expect it to work for the aforementioned reasoning! It even let the file be deleted and re-written. I tried that because I want to get rid of previous code.
You are a genius, Grovkillen. Thank you. Thank you. Thank you. I regret my inability to believe in your idea. I am now free to move about the cabin!
Have a Pepsi on me!
PepsiHog

Re: Remove included script
PH wrote:...Is there one script of yours that doesn't have LibFunc or API...
Code: Select all
MDL>Hello World
No book. A lot of research on Microsoft MSDN. The site has changed so much and much of what I spent years learning is now obsolete. Here is a list of APIs I found this afternoon. What I used to do was Lycos (at first) then later Google what I wanted to accomplish and find forums with code written in other languages and pick out the pieces I needed. Then figure out how to make the API work in Macro Scheduler. Way more failures than successes. For example, it took me two years, hundreds of hours and help from this forum's generous members to figure out how to draw a box.PH wrote:...Do you have a book reference you use for LibFunc? What is your source? If you don't mind telling. If it is a book, I need to buy it...
Re: Remove included script
@JRL,
That's not the answer I wanted. Try again. Ha-ha. I was hoping you had some great book that told you everything. You do A LOT of research. That is impressive. I tire out too easily when I start trying to find out about some programming aspect on the net. I know how much it takes to do that type of research. It's all about the way you phrase it, huh? I sometimes will spend weeks doing different searches to find something. And all it is, is figuring out how to phrase that question. But for you, you probably do it also because of the computer work you do, so that's a good motivation for anyone.
It's funny. The simple program you've written... I've also written that same exact one......several times. I use it for a little debugging here and there. It's like it's a small world or something, right? (rhetorical)
You maybe should use your research patience to find that great book for programming with all the answers. So next time you can share it's name with me. Yeah, that's all I want for Christmas. Not much.
Thanks for your time and effort with helping me. I really appreciate it.
Thanks for the new links,
PepsiHog
That's not the answer I wanted. Try again. Ha-ha. I was hoping you had some great book that told you everything. You do A LOT of research. That is impressive. I tire out too easily when I start trying to find out about some programming aspect on the net. I know how much it takes to do that type of research. It's all about the way you phrase it, huh? I sometimes will spend weeks doing different searches to find something. And all it is, is figuring out how to phrase that question. But for you, you probably do it also because of the computer work you do, so that's a good motivation for anyone.
It's funny. The simple program you've written... I've also written that same exact one......several times. I use it for a little debugging here and there. It's like it's a small world or something, right? (rhetorical)
You maybe should use your research patience to find that great book for programming with all the answers. So next time you can share it's name with me. Yeah, that's all I want for Christmas. Not much.
Thanks for your time and effort with helping me. I really appreciate it.
Thanks for the new links,
PepsiHog
Windows 7
PepsiHog. Yep! I drink LOTS of Pepsi (still..in 2024) AND enjoy programming. (That's my little piece of heaven!)
The immensity of the scope of possibilities within Macro Scheduler pushes the user beyond just macros!
PepsiHog. Yep! I drink LOTS of Pepsi (still..in 2024) AND enjoy programming. (That's my little piece of heaven!)
The immensity of the scope of possibilities within Macro Scheduler pushes the user beyond just macros!
Re: Remove included script
Thank you for the kind words. I will get you that book as soon as I find it. While I'm looking you could mail me your "Mastering Regex in Seven Days" book. I'll mail it back to you when I've finished reading it. If it works, I'll mail it back to you with a couple of cases of Pepsi©.
Re: Remove included script
@JRL,
LOL! Don't we wish! I think the book is "Mastering RegEx before the turn of the century"
I'll send you a copy at the turn of the century.
PepsiHog
but go ahead and send the Pepsi. I wouldn't want it to go bad.
LOL! Don't we wish! I think the book is "Mastering RegEx before the turn of the century"
I'll send you a copy at the turn of the century.

PepsiHog
but go ahead and send the Pepsi. I wouldn't want it to go bad.
Windows 7
PepsiHog. Yep! I drink LOTS of Pepsi (still..in 2024) AND enjoy programming. (That's my little piece of heaven!)
The immensity of the scope of possibilities within Macro Scheduler pushes the user beyond just macros!
PepsiHog. Yep! I drink LOTS of Pepsi (still..in 2024) AND enjoy programming. (That's my little piece of heaven!)
The immensity of the scope of possibilities within Macro Scheduler pushes the user beyond just macros!