Indigo Rose Software

Professional Software Development Tools

 
+ Reply to Thread
Results 1 to 8 of 8

Thread: Need help..

  1. #1
    Join Date
    May 2009
    Posts
    4

    Need help..

    Hi all,

    I am very new in AMS.

    I have created a project but i want to bind it in my pendrive.So,I have decided to use script below. But, I have no idea how to get the serial number from my pendrive.Anyone can help me?Thanks in advance

    Script
    -- Set this value to the expected serial number of the
    -- drive that your application will run from.
    Expected_Serial = 123456789;

    -- Gets the source drive's current serial number
    Current_Serial = Drive.GetInformation(_SourceDrive).SerialNumber;

    -- Compares the two serials and, if different, terminates the app.
    if (Current_Serial ~= Expected_Serial) then
    Dialog.Message("ERROR", "This is an unauthorized copy of the original application, and will shut down.", MB_OK, MB_ICONSTOP);
    Application.Exit();
    end

  2. #2
    Join Date
    Jul 2002
    Location
    Just South of Reality
    Posts
    778
    This does not answer your question directly but with this code you should be able to extract ideas to accomplish what you want.

    Place the following code on a button ON Click...

    Code:
    dtbl = Drive.Enumerate()
    
    for x,y in dtbl do
    
    Dinfo = Drive.GetInformation(""..dtbl[x])
    if Dinfo then
    	Dtype=Drive.GetType(""..dtbl[x])
    	if Dtype == 0 then Dtypex = "Unknown"
    	elseif Dtype == 1 then Dtypex = "Invalid"
    	elseif Dtype == 2 then Dtypex = "Removable"
    	elseif Dtype == 3 then Dtypex = "Fixed"
    	elseif Dtype == 4 then Dtypex = "Remote"
    	elseif Dtype == 5 then Dtypex = "CDRom"
    	elseif Dtype == 6 then Dtypex = "RamDisk"
    	end
    	Dsize=Drive.GetSize(""..dtbl[x])
    	Dfree=Drive.GetFreeSpace(""..dtbl[x])
    	Dialog.Message("USB Drive "..String.Left(dtbl[x],2).." ", "Name: "..Dinfo.Label.."\r\nSerial #: "..Dinfo.SerialNumber.."\r\nSystem Name: "..Dinfo.DisplayName.."\r\nType: "..Dtypex.."\r\nCapacity in Mb: "..Dsize.."\r\nSpace Available in Mb: "..Dfree.."\r\n")
    else
    	Dialog.Message("USB Drive "..String.Left(dtbl[x],2).." ", "Drive not found")
    end
    end

  3. #3
    Join Date
    May 2009
    Posts
    4
    hi holtgrewe,
    thanks for your reply,i am still very confuse...

  4. #4
    Join Date
    Aug 2003
    Posts
    2,427
    It's a two stage process as far as I can see. Build the attached example to an .exe drop it onto a memory stick and run it. It'll get the serial number and copy it to the clipboard. Close the application and delete it from the memory stick. Now paste the serial into your main application and then build it. Using your idea it should only run on that memory stick.

  5. #5
    Join Date
    May 2009
    Posts
    4
    hi longedge,
    thanks for your reply,the project shows error and cannot be run."Page1 -> On Show,Line 1 :Argument 1 must be of type string"

    if String.Left(_CommandLineArgs[1], 3) == "SFX" then
    strPath = String.Replace(_CommandLineArgs[1], "SFXSOURCE:", "", true)
    strPath = String.SplitPath(strPath)
    drv = strPath.Drive
    drvinfo = Drive.GetInformation(drv);
    serial= drvinfo.SerialNumber
    Label.SetText("Label1", serial);
    Clipboard.CopyText(serial);
    Paragraph.SetVisible("Paragraph1", true);
    end
    Last edited by ctanl; 06-11-2009 at 04:24 PM.

  6. #6
    Join Date
    Aug 2003
    Posts
    2,427
    Quote Originally Posted by ctanl View Post
    hi longedge,
    thanks for your reply,the project shows error and cannot be run."Page1 -> On Show,Line 1 :Argument 1 must be of type string"
    Yes it needs some error trapping, it's just the bare bones and needs tidying up - you *MUST* build it to an exe and then it will run OK. In the build options choose (from memory) " Web executable ".

    Because it's just a 'tool' to use temporarily it makes much more sense to have it as a single .exe in any case.
    Last edited by longedge; 06-12-2009 at 12:30 AM.

  7. #7
    Join Date
    Aug 2003
    Posts
    2,427
    Try -

    Code:
    if _CommandLineArgs[1] then
    serial = (Drive.GetInformation(((String.SplitPath(String.Replace(_CommandLineArgs[1], "SFXSOURCE:", "", true))).Drive))).SerialNumber;
    Label.SetText("Label1", serial);
    Clipboard.CopyText(serial);
    Paragraph.SetVisible("Paragraph1", true); 
    else
    result = Dialog.Message("N.B.", "You must compile this application to a \"Web\/Email Executable\" for it to work correctly.\r\n\r\nApplication will close when you click \"OK\"", MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);
    Application.Exit();
    end
    -- now to get some work done
    Last edited by longedge; 06-12-2009 at 01:41 AM.

  8. #8
    Join Date
    May 2009
    Posts
    4
    thanks longedge,it works perfectly.i have modified the script and it works perfectly and binded in memory stick.
    Thanks alot

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts