ScriptUp - Many scripts, One process

Post your working scripts, libraries and tools
Helgef
Posts: 3570
Joined: 17 Jul 2016, 01:02
Contact:

Re: ScriptUp - Many scripts, One process

22 Mar 2018, 04:40

I was considering adding an interface to execute code on a thread directly
I think that is pretty nice, I did something of that sort (if I understand you correctly) for UCR, quite primitive though (link).

Also, I tested to replace the AutoHotkey_64.dll with the corresponding v2 version, it worked as far as I could tell, but I couldn't pause :think:.

Cheers.
User avatar
Masonjar13
Posts: 1437
Joined: 20 Jul 2014, 10:16
GitHub: Masonjar13
Location: Не Россия

Re: ScriptUp - Many scripts, One process

22 Mar 2018, 14:10

I'll look into adding that then.
Helgef wrote:but I couldn't pause :think:.
shrug I've never tried v2. Though I can't imagine the functions would be different. I downloaded it to see the help file, but I didn't see anything in there related to the DLL's, as there is (exclusively) in the v1 help. If you can figure out the issue, I certainly won't mind adding a fix for it, or even adding "Set DLL: [Std/Mini] v2" options to the menu.
OS: Windows 7 Ultimate | Editor: Notepad++
My Personal Function Library | Check Out My Computer Rig
User avatar
Masonjar13
Posts: 1437
Joined: 20 Jul 2014, 10:16
GitHub: Masonjar13
Location: Не Россия

Re: ScriptUp - Many scripts, One process

01 Apr 2018, 20:38

Added code execution for a specified thread (context menu). It's synchronous though and will pause the main process. I think I might offload the entire list object (which includes all threaded scripts) to a child thread, which would also fix the status update problem. It may present other problems though.. I'll test it and see how it works.
OS: Windows 7 Ultimate | Editor: Notepad++
My Personal Function Library | Check Out My Computer Rig
User avatar
Masonjar13
Posts: 1437
Joined: 20 Jul 2014, 10:16
GitHub: Masonjar13
Location: Не Россия

Re: ScriptUp - Many scripts, One process

15 Apr 2018, 08:26

Update: fixed error that was happening during first run.
Drugwash wrote:.
Honestly, I feel like such an idiot. :lol: Oh well, it happens. Fixed now. Thanks for the info, by the way!
OS: Windows 7 Ultimate | Editor: Notepad++
My Personal Function Library | Check Out My Computer Rig
Larry Yang

Re: ScriptUp - Many scripts, One process

15 Apr 2018, 23:52

big help for me, i have 12 scripts thanks
User avatar
Drugwash
Posts: 680
Joined: 29 May 2014, 21:07
Location: Ploieşti, Romania

Re: ScriptUp - Many scripts, One process

16 Apr 2018, 03:47

Masonjar13 wrote:Update: fixed error that was happening during first run. […]
Thanks for the info, by the way!
You're welcome, glad I could be of help. :thumbup:
I've deleted my CloudMe account because of GDPR - the now legal base for privacy invasion and data theft.
User avatar
Masonjar13
Posts: 1437
Joined: 20 Jul 2014, 10:16
GitHub: Masonjar13
Location: Не Россия

Re: ScriptUp - Many scripts, One process

12 May 2018, 01:41

Hey everyone, I've got some news!

First, I pushed a minor update: you can now right-click scripts in the list and choose "Edit" to have the script open in your default editor (whatever you have set for when you right-click > Edit a script file).

Second, I'm working on a new version. Here's a few of the new features:
  • All scripts will be offloaded to a worker thread, making the main GUI *much* more responsive.
  • There will be a more appealing graphical interface, with actual graphics rather than.. well, just a giant listview box.
  • DLLs will be included by default, though you will still be able to change them.
  • Compiled! I'm going to make it work seamlessly both in script form and executable form, so you can take it on the go!
This will take some time to do, since it's a near-complete rewrite. When it's done, I'll post it as the v1 release on Github. :D
OS: Windows 7 Ultimate | Editor: Notepad++
My Personal Function Library | Check Out My Computer Rig
Helgef
Posts: 3570
Joined: 17 Jul 2016, 01:02
Contact:

Re: ScriptUp - Many scripts, One process

12 May 2018, 04:13

Good stuff, I look forward to see the updates. Execute code works well, great for debugging :thumbup:.

Cheers.
User avatar
joedf
Posts: 6875
Joined: 29 Sep 2013, 17:08
Facebook: J0EDF
Google: +joedf
GitHub: joedf
Location: Canada, Quebec
Contact:

Re: ScriptUp - Many scripts, One process

15 Aug 2018, 15:50

Just saw this now for the first time through GitHub... Neat! :+1:
Image Image Image Image Image
Windows 10 x64 Professional, Intel i5-8500 @ 3.00 GHz, 16GB DDR4 3200 MHz, NVIDIA GTX 1060 6GB | [About Me] | [ASPDM - StdLib Distribution]
[Populate the AHK MiniCity!] | [Qonsole - Quake-like console emulator] | [LibCon - Autohotkey Console Library] | [About the AHK Foundation]
User avatar
Masonjar13
Posts: 1437
Joined: 20 Jul 2014, 10:16
GitHub: Masonjar13
Location: Не Россия

Re: ScriptUp - Many scripts, One process

18 Aug 2018, 04:05

Thanks, glad you think so, joedf :)

While I'm here, I may as well post an update to the current status of the update. I'm stuck with a bug that I can't get around, which is almost the whole point of creating a v1. It has to do with off-loading the threads to a separate thread. Simply, I can't. I've made a post on it; if anyone can help solve that, I can get back to working on it. Otherwise, good chance I'll leave it where it is. Not really what I want to do, but how can I progress if I can't progress? :eh:
OS: Windows 7 Ultimate | Editor: Notepad++
My Personal Function Library | Check Out My Computer Rig
User avatar
joedf
Posts: 6875
Joined: 29 Sep 2013, 17:08
Facebook: J0EDF
Google: +joedf
GitHub: joedf
Location: Canada, Quebec
Contact:

Re: ScriptUp - Many scripts, One process

19 Aug 2018, 19:33

¯\_(ツ)_/¯
Image Image Image Image Image
Windows 10 x64 Professional, Intel i5-8500 @ 3.00 GHz, 16GB DDR4 3200 MHz, NVIDIA GTX 1060 6GB | [About Me] | [ASPDM - StdLib Distribution]
[Populate the AHK MiniCity!] | [Qonsole - Quake-like console emulator] | [LibCon - Autohotkey Console Library] | [About the AHK Foundation]
User avatar
Masonjar13
Posts: 1437
Joined: 20 Jul 2014, 10:16
GitHub: Masonjar13
Location: Не Россия

Re: ScriptUp - Many scripts, One process

22 Aug 2018, 20:38

Update: v1 has been released! Huge thanks to HotkeyIt! Special thanks to GitKraken ;)

Binaries will be released with each significant update and can always be found on the releases page. Functionality hasn't changed very much, which is what I was going for. It does seem to be performing noticeably faster, however, so that's good! Script/DLL paths can now be relative to the data folder, allowing for full portability. It also defaults to the included DLLs with a relative path during first run. The binaries are off-the-server ready, no extra stuff needed (it's all packed inside). Meaning, if there's an update to the worker/DLLs, you'll need to remove those files so it can unpack the new versions. I didn't force overwrite for efficiency purposes. An easy way would be to back-up your config, delete the data folder, and move the config file back. I don't expect to be changing the config file to the point where you'll have to start over, so that should always work.

I didn't test on W10, so those who use DPI scaling, let me know if there's an issue, or request a pull.

As noted on the readme, I noticed that scripts will not properly use SetWorkingDir, so I recommend always using full-paths in any scripts you add!
OS: Windows 7 Ultimate | Editor: Notepad++
My Personal Function Library | Check Out My Computer Rig
User avatar
Masonjar13
Posts: 1437
Joined: 20 Jul 2014, 10:16
GitHub: Masonjar13
Location: Не Россия

Re: ScriptUp - Many scripts, One process

11 Sep 2018, 15:37

So I was making a new W7 VM to run tests with and I got a curious error in _MemoryLibrary/_Struct: ERROR: BuildImportTable failed

Here's the last page of ran lines.
Spoiler
Occurs in both the compiled and script versions. VM is fully updated on Windows 7 Ultimate, same image I have on my desktop. Guest additions installed (using VirtualBox). Anyone know why this is happening? Because I have no idea. The error, as I've gathered, means that the DLL couldn't be loaded into memory. The reason why, that's what I have no idea about. It's definitely not an issue of lack of RAM.
OS: Windows 7 Ultimate | Editor: Notepad++
My Personal Function Library | Check Out My Computer Rig
User avatar
Drugwash
Posts: 680
Joined: 29 May 2014, 21:07
Location: Ploieşti, Romania

Re: ScriptUp - Many scripts, One process

13 Sep 2018, 00:56

If the error message is in the least accurate it means the script couldn't find an import table in the respective library, or it couldn't list it. You may have to enhance the code a bit to find out which library exactly fails and then look into it using Dependency Walker or any other similar tool to see if it indeed has an import table and what it consists of; it may be all ordinals, or delayed imports, or something that slipped the original code.

There is also a slight possibility that the respective library might wanna be loaded through LoadLibraryW(), not LoadLibraryA() as I see in the code snippet above.
Make sure the loaded library handle is not getting corrupt somewhere in the process.

All this is off the top of my head, didn't look through the Struct or MemoryLibrary code, so don't rely too much on what I said. Hopefully you find the issue soon. Good luck!
I've deleted my CloudMe account because of GDPR - the now legal base for privacy invasion and data theft.
User avatar
Masonjar13
Posts: 1437
Joined: 20 Jul 2014, 10:16
GitHub: Masonjar13
Location: Не Россия

Re: ScriptUp - Many scripts, One process

13 Sep 2018, 12:22

If it were any of the aforementioned issues, it would also fail on my host and other computers I've tried it on. It works fine everywhere else though, just not in the VM. I didn't write or modify _MemoryLibrary or _Struct, those are both written by HotKeyIt. He's actually going to be the guest host of the next AHK webinar, and I see "MemoryLibrary" on the list of topics, so I'll ask him about it then.
OS: Windows 7 Ultimate | Editor: Notepad++
My Personal Function Library | Check Out My Computer Rig
WOlfen
Posts: 14
Joined: 14 Jan 2018, 16:48

Re: ScriptUp - Many scripts, One process

Today, 02:49

Hello.
I really like this script and use it very often.
It is almost perfect, there are just some things that are still annoy me.
Okay, so...
I use 2 Scripts with this. The first is "Wallpaper-Randomizer"
Spoiler
and the second is "Process-Whitelist"
Spoiler

My ScriptUp Ini looks like this:
Spoiler

"Wallpaper-Randomizer" as the name says randomizes some Wallpapers from a Folder for your background automatically. It needs a "top.exe" all the time in it´s folder when a new Wallpaper is shuffled.
"Process-Whitelist" terminates or whitelists your processes automaticly, it does this by looking at 2 Logs, named "Process-Whitelist.ahk.BLACKLIST.log" and "Process-Whitelist.ahk.WHITELIST.log".

The Problem i have is that whenever i use your script, it need to has the files from the 2 scripts in it´s own folder, which doesn´t speak not really for portablility. Is it not possible for your script that all the other scripts have it´s own folder and files? It´s not only for these 2 scripts, i found out it´s globally for all scripts that needs some extra files besides only the ahk file. Besides, look how my "Wallpaper-Randomizer" looks because of "ScriptUp":
2019-03-22 09_06_35-Wallpaper-Randomizer.png
2019-03-22 09_06_35-Wallpaper-Randomizer.png (33.57 KiB) Viewed 42 times
That speaks for the other Folders too. Even "ScriptUp" need the "top.exe", "Process-Whitelist.ahk.BLACKLIST.log", "Process-Whitelist.ahk.WHITELIST.log" in it´s folder, which mean no true portability.

Please don´t get all that in the wrong meaning. I´m not raging.
Besides all of that your script is great. :thumbup:
User avatar
Masonjar13
Posts: 1437
Joined: 20 Jul 2014, 10:16
GitHub: Masonjar13
Location: Не Россия

Re: ScriptUp - Many scripts, One process

Today, 11:59

Hey, glad you like it! I have spent quite a lot of time (about 3 years) on this, so if even a few people are using, that's awesome. :thumbup:

I've actually noted this limitation on the Github readme. SetWorkingDir will be overridden. They will take on the working directory of the worker script, which is in the library. Full paths will need to be used in scripts.

The reason for it being this way: it allows paths in the ScriptUp ini file to be relative, therefore allowing actual portability on, say, a USB drive. When you connect a USB drive, it gets assigned a drive letter, which may or may not be the same as when you had set the script path. Making relative paths work here allows it to always be able to find the script.

Easy fix: in your other two scripts, don't use relative paths, but use full paths instead. If you need to, when launching a process with Run, set the working directory for it so it can find the files it needs to. If you want to use relative paths, make it a full path instead with a_scriptDir.

Besides the benefit of using relative paths for the scripts, it also keeps a stable working directory. All scripts ran under ScriptUp share the same working directory, since they're all under one single process. That's simply the nature of hosting scripts as threads instead of processes.
OS: Windows 7 Ultimate | Editor: Notepad++
My Personal Function Library | Check Out My Computer Rig

Return to “Scripts and Functions”

Who is online

Users browsing this forum: No registered users and 14 guests