Sign in to follow this  
Followers 0
Damein

Passing a var to a UDF?

4 posts in this topic

Is it possible to do something like this:

Script Using UDF:

#include "TestUDF.au3"

Global $InputBox

$InputBox = InputBox("Test", "Please type in a message")

HotKeySet("{1}", "_Test")

Func _Test()
    _NewInputBox()
    MsgBox(0, "Test", $NewInputBox)
EndFunc

While 1
Sleep(10)
WEnd

UDF:

#Include-Once

Global $NewInputBox

Func _NewInputBox()
$NewInputBox = StringStripWS($InputBox, 8)
EndFunc

So the resulting message would be your message with no spaces in it. But it seems like I can't pass the information because the include tries to run before anything else.

Maybe I need to do something else to prepare the UDF?


MCR.jpg?t=1286371579

Most recent sig. I made

Quick Launcher W/ Profiles Topic Movie Database Topic & Website | LiveStreamer Pro Website | YouTube Stand-Alone Playlist Manager: Topic | Weather Desktop Widget: Topic | Flash Memory Game: Topic | Volume Control With Mouse / iTunes Hotkeys: Topic | Weather program: Topic | Paws & Tales radio drama podcast mini-player: Topic | Quick Math Calculations: Topic

Share this post


Link to post
Share on other sites



Nevermind, I got it :unsure:

Thanks!


MCR.jpg?t=1286371579

Most recent sig. I made

Quick Launcher W/ Profiles Topic Movie Database Topic & Website | LiveStreamer Pro Website | YouTube Stand-Alone Playlist Manager: Topic | Weather Desktop Widget: Topic | Flash Memory Game: Topic | Volume Control With Mouse / iTunes Hotkeys: Topic | Weather program: Topic | Paws & Tales radio drama podcast mini-player: Topic | Quick Math Calculations: Topic

Share this post


Link to post
Share on other sites

Rather than using a separate variable to hold the changed value, why not reurn the changed value itself, or pass the variable ByRef?


This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Share this post


Link to post
Share on other sites

Try like this

#include "TestUDF.au3"

$InputBox = InputBox("Test", "Please type in a message")

HotKeySet("{F1}", "_Test")

While 1
   Sleep(10)
WEnd

Func _Test()
    MsgBox(0, "Test", _NewInputBox())
EndFunc

#Include-Once

Global $InputBox

Func _NewInputBox()
    Return StringStripWS($InputBox, 8)
EndFunc

AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

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