Jump to content

Intermediate


Recommended Posts

Hello I pass a Parameter to a function, I dont know how does it change

Thanks for your help

Code:

Func Message($sPwm)
  ConsoleWrite($sPwm&@CR)
EndFunc
ConsoleWrite(Message(011000101010101011111000000001)&@CR)

My code:

PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.

Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners.

MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. 

Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression.

Link to comment
Share on other sites

I get the following result:

>Running:(3.3.8.1):C:Program Files (x86)AutoIt3autoit3.exe "C:Temptest2.au3"   
9223372036854775807
0
+>10:33:40 AutoIT3.exe ended.rc:0
>Exit code: 0    Time: 1.652
0 is the value returned by function Message.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

no i wanted to know why 9223372036854775807 is getting printed, it should be 011000101010101011111000000001

My code:

PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.

Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners.

MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. 

Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression.

Link to comment
Share on other sites

well my mistake this should be the code

Func Message($sPwm)
ConsoleWrite($sPwm&@CR)
EndFunc
Message(011000101010101011111000000001)

My code:

PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.

Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners.

MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. 

Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression.

Link to comment
Share on other sites

The parameter you pass is interpreted as a number and therefore converted to integer before being printed.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

is there a way to avoid that

I meant is there a way to get the result which is passed

My code:

PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.

Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners.

MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. 

Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression.

Link to comment
Share on other sites

Pass it as a string?

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

yeah that way works but i want to pass it as the number format

so can i carryout any sort of procedures inside the function that will return it back to the same format

My code:

PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.

Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners.

MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. 

Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression.

Link to comment
Share on other sites

Then pass it as a string and convert it to a number and use this for your calculations:

Func Message($sPwm)
    ConsoleWrite($sPwm & @CR)
    $Number = Number($sPwm)
    ConsoleWrite($Number & @CRLF)
EndFunc ;==>Message
Message("011000101010101011111000000001")

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

Thanks but isnt it possible to pass it as a number only

#include <String.au3>
#include <C:UsersabhishekDesktopPresentationAbhishekSCriptsMathsEx.au3>

;ConsoleWrite(_BinStr(_StrBinary('hey there'))&@CR)
Func Message($sPwm)
ConsoleWrite($sPwm&@CR)
EndFunc
Message(011000101010101011111000000001)
Func _StrBinary($sString)
Local $Binary = ""
For $i = 1 To StringLen($sString)
$Binary &= _IntBinary(Asc(StringMid($sString, $i, 1)))
Next
Return $Binary
EndFunc

Func _BinStr($sBin)
ConsoleWrite('Bin:'&$sBin&@CR)
Local $sWidth=Ceiling(StringLen($sBin)/ 8)
ConsoleWrite($sWidth&@CRLF)
$sBin=StringFormat("%0"&$sWidth*8&"s", $sBin)
ConsoleWrite($sBin&@CR)
If IsInt(StringLen($sBin)/8)<>1 Then Return SetError(1,StringLen($sBin),-1)
Local $sOffset=StringLen($sBin)/8
Local $sBinString
Local $sString
For $i=1 To $sOffset
$sBinString=StringMid($sBin,(($i-1)*8)+1,8)
ConsoleWrite($sBinString&@CRLF)
$sString&=Chr(_BinInteger($sBinString))
Next
ConsoleWrite('---------'&@CR)
Return $sString
EndFunc

Func _IntBinary($sInteger)
If $sInteger <= 0 Then Return SetError(1,$sInteger,-1)
Local $sParameter
While $sInteger> 0
$sParameter &= Mod($sInteger, 2)
$sInteger = _Quotient($sInteger, 2)
WEnd
$sParameter = _StringOpposite($sParameter)
Return StringFormat("%08s", $sParameter)
EndFunc
ConsoleWrite(_StrBinary('blaasdasdwad')&@CR)
ConsoleWrite(Message(011000101010101011111000000001)&@CR)
Func _BinInteger($in)
Local $sInteger, $x, $i = 1, $aTmp = StringSplit(_StringOpposite($in), "")
For $x = 1 To $aTmp[0]
$sInteger += $aTmp[$x] * $i*(2^($x-1))
Next
$aTmp = 0
Return StringFormat('%d', $sInteger)
EndFunc

Func _StringOpposite($sString)
Local $sLen=StringLen($sString),$sReturn
For $i=$sLen To 1 Step -1
$sReturn&=StringMid($sString,$i,1)
Next
Return $sReturn
EndFunc

Basically that is the code Since the FuncName is _BinStr therefore i want to pass the parameter as a number and not as a string

Nothing More

Edited by PhoenixXL

My code:

PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.

Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners.

MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. 

Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression.

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...